Search code examples
db2rpgle

FREE RPG How to convert %SUBST to TIMESTAMP?


I need to move a Substring into a Timestamp Field. But if I compile it, I get the Error Number

RNF7416 - The types of operands on the right and left sides of the expression in the EVAL operation do not match.

The Code:

MONITOR;
  TSTPFIELD = %SUBST(NEWDS:01:26);
ON-ERROR;
  TSTPFIELD =  %TIMESTAMP();
ENDMON;

Do someone know how to convert the %SUBST(NEWDS:01:26) to Timestamp?


Solution

  • I believe this should do

    tstamp = %timestamp(%SUBST(NEWDS:01:26))

    You need to cast it to timestamp