IF STATEMENT OVERRIDE causing CAY6339E
search cancel

IF STATEMENT OVERRIDE causing CAY6339E

book

Article ID: 248983

calendar_today

Updated On:

Products

JCLCheck Workload Automation

Issue/Introduction

 The following JCL is using an IF statement to override a DD 


//Jobcard                             
//STEP10 EXEC TESTPRC                                            
//         IF (STEP10.STEP10.RC GE 4) THEN                      
//STEP20.DD2 DD DSN=DATASET.DD2.OVERRIDE,DISP=SHR                    
//         ENDIF                                                     
//*                                                                  
//STEP20 EXEC TESTPRC                

 

The TESTPRC is as follows:

 

//TESTPRC PROC                                               
//STEP10  EXEC PGM=IEFBR14                                  
//DD1      DD DSN=DATASET.DD1,DISP=(MOD,DELETE,DELETE),
//             SPACE=(TRK,(1,1)),UNIT=DASD                   
//DD2      DD DSN=DATASET.DD2,DISP=SHR                
//*                                                          
//STEP20  EXEC PGM=IEFBR14                                  
//DD1      DD DSN=DATASET.DD1,DISP=(MOD,DELETE,DELETE),
//             SPACE=(TRK,(1,1)),UNIT=DASD                   
//DD2      DD DSN=DATASET.DD2,DISP=SHR           

JCLCHECK issues the following error message:

//         IF (STEP10.STEP10.RC GE 4) THEN                      
//STEP20.DD2 DD DSN=DATASET.DD2.OVERRIDE,DISP=SHR
//STEP20.DD2 DD DSN=DATASET.DD2.OVERRIDE,DISP=SHR                   
CAY6033W ATTEMPTED OVERRIDE OF "DD2" IN STATEMENT 14 FAILED -      
         STATEMENTS OUT OF ORDER                                   
CAY6339E STATEMENT MISPLACED WITHIN AN IF-THEN-ELSE CLAUSE         
//         ENDIF                                                   

                            

Cause

The IF/THEN/ELSE/ENDIF statements are used to conditionally execute job steps within a JCL but not to override JCL sentences so the format of the following IF sentence in the JCL is not valid.

//         IF (STEP10.STEP10.RC GE 4) THEN                        
//STEP20.DD2 DD DSN=DATASET.DD2.OVERRIDE,DISP=SHR               
//         ENDIF   

 

This is not valid JCL coding and the JCL fails when it is submitted.

So this is correct that JCLCHECK issues the CAY6033W message and is working as designed

 

Resolution

Use IF/THEN/ELSE/ENDIF to conditionally execute job steps within a job, and not as an override.

Refer to the IBM z/OS MVS JCL Reference guide for the IF/THEN/ELSE/ENDIF syntax and usage.