It is possible to execute a REXX inside another REXX using the EXEC command.
For example, we shall use this approach to Read the pdsname and member name and pass this information to an another REXX procedure which will work upon this file and produce an output file. We shall open that output file and show it to the user using the outer REXX.
Lets us name the REXX reading the PDSNAME and Member Name as REXX 1.
Lets us name the REXX processing the member as REXX 2.
Rexx 1 should call the REXX 2 using the following code
"EXEC 'Dataset where REXX 2 is residing' '"Input-file"'"
Rexx 2 will process the Input file and produce an output file.
This output file could be opened from REXX 1 and displayed to the user using the following code.
ADDRESS ISPEXEC "EDIT DATASET("OUTPUT-FILE") "
In case of queries, please post in the comments.
Subscribe to:
Post Comments (Atom)
Featured Post
REXX Skeleton: Submitting jobs through Rexx
Submitting jobs through REXX and reading the spool through REXX gives us immense potential to automate many manual activities in mainframes....
-
Abend S013 SYSTEM COMPLETION CODE=013 REASON CODE=00000018 AN OPEN WAS ISSUED FOR A PARTITIONED DATASET. THE SPECIFIED MEMBER NAME WAS N...
-
A word is defined as a blank delimited set of characters within a string in REXX. The characters in a word can be alpha, numeric, alphanume...
-
String functions interrogate, compare, and manipulate character strings of data. Some of the built-in function are listed below: COPIES...
It can even be done in a single routine. The only reasons to use an external routine is if it already exists -- and you don't have to write it -- or if it would have some utility as an independent routine.
ReplyDeleteFor instance, a routine which handles several PDSs might call an external routine to return a concise list of members, eliminating the need to have that code local to the new routine.
that's correct... This is just an example here explaining how it could be done... its up to the application programmer to decide and select best possible way to develop a macro...
DeleteDo you have any concrete example on how to call endevor directly from a REXX? If yes, can you post your code and explain it? P.S. Accessing endevor via jcl isn't required.
DeleteVirtually anything you can run via JCL you can run via REXX. It's a simple matter of having all the required allocations:
ReplyDelete"ALLOC FI(C1MSGS1) UNIT(VIO) SPACE(5 5) TRACKS NEW DELETE REU"
"ALLOC FI(ENPSCLIN) UNIT(VIO) SPACE(1) TRACKS NEW DELETE REU"
"ALLOC FI(SYSPRINT) DUMMY REU"
"EXECIO" queued() "DISKW ENPSCLIN (FINIS"
"XEQ ENBP1000" /* invoke endevor */
"EXECIO * DISKR C1MSGS1 (STEM NDV. FINIS" /* Read c1msgs1 (output) */
as a single example.