We are now in Exec1.
Exec2 speaking.
The result from Exec2 is A OK
The result is 100% correct.
THE RESULT FROM THE EXECS IS 100
Sending a Return Code Back to the Calling CLIST: As demonstrated in the
previous example, an exec can return a number to a CLIST with the EXIT
instruction followed by the number or a variable representing the number. The
CLIST receives the number in the variable &LASTCC.
When an exec invokes a CLIST, the CLIST can return a number to the exec by the
EXIT CODE() statement with the number to be returned enclosed in parentheses
after CODE. The exec receives the number in the REXX special variable RC.
Note: &LASTCC is set after each CLIST statement or command executes as
compared to RC, which is set after each command executes. To save the
values of each special variable, set a new variable with the value at the point
where you want the special variable value saved.
In the following two examples, exec USERID.MYREXX.EXEC(TRANSFER) passes
an argument to CLIST USERID.MY.CLIST(RECEIVE), and the CLIST returns a
number through the CODE parameter of the EXIT statement.
USERID.MYREXX.EXEC(TRANSFER)
/***************************** REXX *******************************/
/* This exec passes a percent sign to a CLIST and depending on */
/* the success of the transfer, the CLIST returns 100 (if it was */
/* successful) or 50 (if it was not successful). */
/******************************************************************/
SAY 'We are about to execute CLIST RECEIVE and pass it % '
"EXEC my.clist(receive) '%' clist"
SAY 'We have returned from the CLIST.'
IF RC = 100 THEN
SAY 'The transfer was a success.'
ELSE
SAY 'The transfer was not a success.'
USERID.MY.CLIST(RECEIVE)
PROC 1 &VAR
IF &VAR = % THEN SET SUCCESS = 100
ELSE SET SUCCESS = 50
EXIT CODE(&SUCCESS)
Running an Exec in the Background
Execs run in the background are processed when higher priority programs are not
using the system. Background processing does not interfere with a person’s use of
the terminal. You can run time-consuming and low priority execs in the background,
or execs that do not require terminal interaction.
Running Execs in a TSO/E Address Space
176
z/OS V1R1.0 TSO/E REXX User’s Guide