Additional Examples
Example 1 - Using the LISTDSI and SYSDSN Functions
/***************************** REXX ********************************/
/* This exec reallocates a data set with more space. It receives */
/* as arguments the names of a base data set and a new data set. */
/* It uses the SYSDSN function to ensure the base data set exists, */
/* uses the LISTDSI function to set variables with attributes of */
/* the base data set, doubles the primary space variable and then */
/* uses the variables as input to the ALLOCATE command to */
/* reallocate a new data set. */
/*******************************************************************/
PARSE ARG baseds newds /* Receive the data set names */
/* with quotes, if any. */
IF SYSDSN(baseds) = 'OK' THEN
DO /* If the base data set exists, */
x = LISTDSI(baseds) /* use the LISTDSI function. */
IF x = 0 THEN /* If the function code is 0, */
CALL alc /* call an internal subroutine.*/
ELSE
DO /* Else, display the system */
SAY sysmsglvl1 /* messages and codes for LISTDS*/
SAY sysmsglvl2
SAY 'Function code from LISTDSI is' x
SAY 'Sysreason code from LISTDSI is' sysreason
END
END
ELSE
SAY 'Data set' baseds 'not found.'
EXIT
alc:
newprimary=2*sysprimary /* Compute new primary space. */
"ALLOC DA("newds") NEW SPACE("newprimary sysseconds") LIKE("baseds")"
/* Allocate the new data set. */
IF RC = 0 THEN /* If return code from allocate is 0 */
SAY 'Data set' newds 'was allocated.'
ELSE
SAY 'Data set' newds 'was not allocated. Return code was' RC
Additional Examples
130
z/OS V1R1.0 TSO/E REXX User’s Guide