PreviousNext
Help > Development > W-Language Functions for AS/400 > Program and Procedure calls > ASRtvCall > Details
Details

 

Most of the commands that can be called using this function are the "retrieve" commands (RTV*) and "receive" commands (RCV*).

You can create your own commands returning result values (CRTCMD).

 

Commands can return one or more results.

Example: RTVJOBA can return multiple attributes of the current job.

RTVJOBA USER(&USER) CURLIB(&CURLIB) OUTQ(&OUTQ)

 

Some result variables need to be declared when calling the command.
For it, the command string is prefixed with the variable declarations, separated by semicolons, in the form: VARIABLE=Type(n,p).

VARIABLE is the variable name.

Type can be:

     DEC(n,p) For Decimal type;.
n = number of digits, including decimal digits.
p = number of decimal digits.

     CHAR(n) For Character; .
n = number pf characters.

Examples:

CmdLine ="CCSID=DEC(5 0);RTVJOBA JOB(&JOB) USER(&USER) USRLIBL(&USRLIB) SYSLIBL(&SYSLIB) CCSID(&CCSID) CURLIB(&CURL)"

 

CmdLine =" DATA=CHAR(100);RTVDTAARA DTAARA(MYDTAARA (*N 100)) RTNVAR(&DATA)"

 

You get the result value of a variable with function ASRtvResult.

 

You need to get and check value of internal result variable RC to know if the command ran successfully.