EasyManua.ls Logo

IBM TSO/E REXX - Page 149

IBM TSO/E REXX
242 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Example 2 Part 1 - Using the OUTTRAP Function
/**************************** REXX *********************************/
/* This exec adds a data set to the front of the data sets in the */
/* SYSPROC concatenation. It first asks for the name of the data */
/* set to add, then it finds all data sets currently allocated to */
/* SYSPROC, adds the new data set to the beginning and re-allocates*/
/* the concatenation to SYSPROC. */
/*******************************************************************/
SAY 'Enter the fully-qualified data set name you want added'
SAY 'to the beginning of the SYSPROC concatenation. Do NOT'
SAY 'place quotation marks around the data set name.'
PULL addname .
x = OUTTRAP('name.')/*Begin trapping lines of output from commands*/
/* Output goes to variables beginning with 'name.'*/
"LISTA ST" /* List the status of your currently allocations */
found = 'NO' /* Set the found flag to no */
i = 1 /* Set the index variable to 1 */
/*******************************************************************/
/* Loop through the lines of trapped command output to find lines */
/* 9 characters long or longer. Check those lines for the word */
/* SYSPROC until it is found or until all lines have been checked. */
/* If SYSPROC is found, the index is decreased one and the name of */
/* the first data set concatenated to SYSPROC is stored in variable*/
/* "concat". */
/*******************************************************************/
DO WHILE (found = 'NO') & (i <= name.0)
IF LENGTH(name.i) >= 9 THEN
IF SUBSTR(name.i,3,7) = 'SYSPROC' THEN
DO
found = 'YES'
i=i-1
concat = "'"name.i"'"
END
ELSE
i=i+1
ELSE
i=i+1
END
Additional Examples
Chapter 10. Using TSO/E External Functions 131

Table of Contents

Related product manuals