Running an Exec from a CLIST
A CLIST can invoke an exec with the EXEC command explicitly or implicitly. If it
invokes an exec implicitly, the exec must be in a PDS allocated to SYSEXEC or
SYSPROC. The CLIST that invokes the exec does not have to be allocated to
SYSPROC. After the invoked exec and other programs it might call complete,
control returns to the CLIST instruction following the invocation.
Similarly, an exec can invoke a CLIST with the EXEC command explicitly or
implicitly. If it invokes a CLIST implicitly, the CLIST must be in a PDS allocated to
SYSPROC, yet the exec does not have to be in a PDS allocated to a system file.
Note:
Execs and CLISTs cannot access each other’s variables and GLOBAL
variables cannot be declared in a CLIST that is invoked from an exec.
The following examples demonstrate how a CLIST invokes an exec and how a
number is returned to the invoking CLIST. The CLIST named TEST explicitly
executes an exec named EXEC1. EXEC1 calls EXEC2, which returns the result "A
OK". EXEC1 then returns to the CLIST with a numeric return code of 100 if
information was passed correctly and 50 if information was not passed correctly.
The results from this series of programs is as follows:
USERID.MY.CLIST(TEST)
EXEC MYREXX.EXEC(EXEC1) EXEC
WRITE THE RESULT FROM THE EXECS IS &LASTCC.
END
USERID.MYREXX.EXEC(EXEC1)
SAY 'We are now in Exec1.'
CALL Exec2
SAY 'The result from Exec2 is' RESULT
IF RESULT = 'A OK' THEN
DO
SAY 'The result is 100% correct.'
EXIT 100
END
ELSE
DO
SAY 'The result is less than perfect.'
EXIT 50
END
USERID.MYREXX.EXEC(EXEC2)
SAY 'Exec2 speaking.'
var = 'A OK'
RETURN var
Running Execs in a TSO/E Address Space
Chapter 13. Using REXX in TSO/E and Other MVS Address Spaces
175
Summary of Contents for TSO/E REXX
Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 2: ......
Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Page 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Page 241: ......