Calling Another Program with the EXEC Command

About this task

To explicitly call another program from within a program, use the EXEC command as you would any other REXX/CICS command. The called program should end with a RETURN or EXIT instruction, ensuring that control returns to the caller. The REXX special variable RC is set to the return code from the EXEC command. You can optionally return a value to the caller on the RETURN or EXIT instruction. When control passes back to the caller, the REXX special variable RC is set to the value of the expression returned on the RETURN or EXIT instruction.

For example, to call a program named CALC and pass it an argument of four numbers, you could include the following instructions:
"EXEC calc 24 55 12 38"
SAY 'The result is' RC
CALC might contain the following instructions:
ARG number1 number2 number3 number4
answer = number1 * (number2 + number3) - number4
RETURN answer

Task Task

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/dfhrx00067.html