JCLCheck REXX interface: How to check for member existence
search cancel

JCLCheck REXX interface: How to check for member existence

book

Article ID: 271191

calendar_today

Updated On:

Products

JCLCheck Workload Automation

Issue/Introduction

 Using a TSO command such as LISTDS in a REXX exec works fine when invoked in ISPF, but fails with RC(-3) when running JCLCheck in batch mode.

The goal is to check for member existence using the JCLCheck REXX interface. 

Environment

Release : 12.0

Component: JCLCheck Workload Automation

Resolution

JCLCheck provides a routine named CAZ1ALDS to allocate a data set, and CAZ2LPDS to return a list of PDS members.

The following REXX codes call program CAZ1ALDS to allocate a PDS to DD name INPUT.   Next, program CAZ2LPDS is called to check for a member named PAYJOB from the PDS that is allocated to DD name INPUT. 

 

mymember = 'PAYJOB'                                
Chkpgm   = 'N'                                 
var      = 'INPUT,PUBLIC.BATCH.JCLLIB'      
env      = 'ENV(REXX)'                         
result   = 'RESULT(?)'                         
iddn     = 'IDDN(INPUT)'                       
oddn     = 'ODDN(@RXSTACK)'                    
                                               
ADDRESS ATTCHMVS "CAZ1ALDS var"                
SAY 'CAZ1ALDS RC=' || rc                       
  If  RC  \=  0  Then Do                       
    SAY 'CAZ1ALDS failed ' RC                  
    return 16                                  
  End                                          
                                               
ADDRESS LINKMVS "CAZ2LPDS env result iddn oddn"
SAY 'CAZ2LPDS RC=' || rc                       
/* SAY result  */                              
DO WHILE QUEUED() > 0                          
  PULL text                                    
   If mymember = text Then                     
   Do                                          
     SAY 'found mymember: ' text               
     ChkPgm = 'Y'                              
     Leave                                     
   End                                         
END                                            
If ChkPgm \= 'Y' Then                          
   Do                                          
     SAY 'mymember not found !!! '             
   End                                         
Return

 

Additional Information

List PDS Members with CAZ2LPDS

Allocate a data set with CAZ1ALDS

At this time, LISTDIR is the only function supported by the CAZ2LPDS routine.  Therefore this is the only method of checking for member existence.