Reputation: 43
I need to make date calculations for ROBOT in AS400 (that the built in pgm cant do), for the reserved command variables.
Robot is calling my cl-program and the cl-program is calling my rpgle-program (because the cl program cant make the date calculations i want).
How do i get the result from the date calculation in the rpgle program back to the CL-variable? So that ROBOT can fetch it.
Can i update the variable in the cl program by calling a rpgle. But how do i do it.
Upvotes: 1
Views: 1067
Reputation: 2473
parameters passed from CL
to RPG
are passed by address. So any value placed in the parameter by the RPG
program will be returned to the CL
program.
here is a CL program calling RPG:
PGM
dcl &rtndate *char 10
/* call RPG program. RPG program sets &rtnDate parm to date of yesterday */
/* in *ISO format. */
call test0290r parm(&rtnDate)
SNDPGMMSG MSG('yesterday date:' *BCAT &RTNDATE)
ENDPGM
and the called RPG program:
** test0290r: return yesterdate as iso date.
h option(*srcstmt:*nodebugio)
** --------------------------- test0290r --------------------
** test0290r: return yesterdate as iso date.
dtest0290r pr extpgm('TEST0290R')
d outDate 10a
** --------------------------- test0290r --------------------
** test0290r: call open api using ifs_openNew.
dtest0290r pi
d outDate 10a
d ch80 s 80a varying
d yesterday_date s d
/free
yesterday_date = %date(%timestamp( )) - %days(1) ;
outDate = %char(yesterday_date:*iso) ;
*inlr = '1' ;
return ;
/end-free
Upvotes: 2