Previous Topic: Batch Execution ExamplesNext Topic: User Exits


REXX Execution Examples

CAZ2LPDS can be invoked from a REXX program through the LINKMVS and ATTCHMVS functions. When invoked in this manner, the program parameters are supplied as variables on the LINKMVS or ATTCHMVS statement.

Example: Write a List of Members to the Output File #1

The following REXX program reads the input PDS (defaulted to SYSIN), and writes a list of members to the output file (defaulted to SYSPRINT). A detailed description of the return code is returned in the result variable.

REXX Program:
/* REXX */
env  = 'ENV(REXX)' 
result  = 'RESULT(?)'
ADDRESS LINKMVS "CAZ2LPDS env result”
SAY 'CAZ2LPDS RC=' || rc
SAY result
DO WHILE QUEUED() > 0 
  PULL text  
  SAY 'Stack>' text
END 
EXIT RC 
REXX Output:
CAZ2LPDS RC=0  
RESULT(SUCCESSFUL)
*** 
SYSPRINT Output:
....+....10...+....20...+....30...+....40...+....50...+....6
MEMBER1
MEMBER2
MEMBER3
MEMBER4
************************* End of Data **********************

Example: Write a List of Members to the Output File #2

The following REXX program reads the input PDS (MYPDS), and writes a list of members to the output file (MYSYSP). A detailed description of the return code is returned in the result variable.

REXX Program:
/* REXX */
env  = 'ENV(REXX)'   
result  = 'RESULT(?)'
iddn = 'IDDN(MYPDS)' 
oddn = 'ODDN(MYSYSP)'  
ADDRESS LINKMVS "CAZ2LPDS env result iddn oddn”
SAY 'CAZ2LPDS RC=' || rc
SAY result
DO WHILE QUEUED() > 0 
  PULL text  
  SAY 'Stack>' text
END 
EXIT RC  
REXX Output:
CAZ2LPDS RC=0 
RESULT(SUCCESSFUL)
*** 
SYSPRINT Output:
....+....10...+....20...+....30...+....40...+....50...+....6
MEMBER1
MEMBER2
MEMBER3
MEMBER4
************************* End of Data **********************

Example: Write a List of Members to the REXX Stack

The following REXX program reads the input PDS (MYPDS), and writes a list of members to the REXX stack. A detailed description of the return code is returned in the result variable.

REXX Program:
/* REXX */
env  = 'ENV(REXX)'   
result  = 'RESULT(?)'
iddn = 'IDDN(MYPDS)' 
oddn = 'ODDN(@RXSTACK)'  
ADDRESS LINKMVS "CAZ2LPDS env result iddn oddn”
SAY 'CAZ2LPDS RC=' || rc
SAY result
DO WHILE QUEUED() > 0 
  PULL text  
  SAY 'Stack>' text
END  
EXIT RC 
REXX Output:
CAZ2LPDS RC=0  
RESULT(SUCCESSFUL)
Stack> MEMBER1
Stack> MEMBER2
Stack> MEMBER3
Stack> MEMBER4
***