Quick reminder. IN RPG, how do we return a parameter using C-style "Return value" syntax, instead of passing in parameter list? Using RPGLE /free.
// pgm: PARM1
dcl-pr PARM2 EXTPGM('PARM2');
PrOption char(1) const;
RET char(5) ;
end-pr;
dcl-s RET char(5) ;
Eval RET='';
callP PARM2('1':RET);
*inlr = *on;
return;
// pgm: PARM2
dcl-pr PARM2 EXTPGM('PARM2');
PrOption char(1) ;
RET char(5) ;
end-pr;
dcl-pI PARM2 ;
PrOption char(1) ;
RET char(5) ;
end-pI;
// do some stuff
Eval Ret= '1';
Eval *inlr = *on;
//Return RET;
return;
The RPG programs on IBM i do not support a returned value from a *PGM object.
Returned values are only supported from subprocedures.
*PGM Return codes for RPG and COBOL are handled by the system.