I have extensively researched the problem and tried various combinations to no avail.
I want to check a file to see if it empty,
Then depending if it empty perform the next step.
Now the problem I run into is that the job still fails if I leave the return code more than 0
Here is the code:
/SYSIN DD *
/CHECK EXEC PGM=IDCAMS
/SYSPRINT DD SYSOUT=*
/INDD DD DSN=MYFILE,DISP=OLD
/SYSIN DD *
PRINT INFILE(INDD) CHARACTER COUNT(1)
IF LASTCC NE 0 THEN SET MAXCC = 1
//COND01 IF CHECK.RC EQ 0 THEN
Perform Step
//CONDEL ELSE
//EMPTY EXEC PGM=IDCAMS,COND=EVEN
//SYSPRINT DD SYSOUT=*
// SET JOBRC=0
//SYSIN DD *
//ENDCOND ENDIF
//WTOOK EXEC PGM=TEST01,COND=(0,NE)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
SE '*** JOB TEST01 PROGRAM COMPLETED SUCCESSFULLY'
/*
//WTOFAIL EXEC PGM= TEST01,COND=((0,EQ,WTOOK),EVEN)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
SE '+++ JOB TEST01 PROGRAM HAS FAILED =='
/CHECK EXEC PGM=IDCAMS
/SYSPRINT DD SYSOUT=*
/INDD DD DSN=MYFILE,DISP=OLD
/SYSIN DD *
PRINT INFILE(INDD) CHARACTER COUNT(1)
IF LASTCC NE 0 THEN SET MAXCC = 1
//COND01 IF CHECK.RC EQ 0 THEN
Perform Step
//CONDEL ELSE
//EMPTY EXEC PGM=IDCAMS,COND=EVEN
//SYSPRINT DD SYSOUT=*
// SET JOBRC=0
//SYSIN DD *
//ENDCOND ENDIF
//WTOOK EXEC PGM=TEST01,COND=(0,NE)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
SE '*** JOB TEST01 PROGRAM COMPLETED SUCCESSFULLY'
/*
//WTOFAIL EXEC PGM= TEST01,COND=((0,EQ,WTOOK),EVEN)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
SE '+++ JOB TEST01 PROGRAM HAS FAILED =='
I tried using a user variable but it seems the steps condition code has not been set as yet
Did do the following // SET EF=0 in a previous step
PRINT INFILE(INDD) CHARACTER COUNT(1)
IF LASTCC NE 0 THEN SET MAXCC = 1
//COND01 IF RC EQ 1 THEN
// SET EF=5
// SET MAXCC=0
// SET LASTCC=0
//ENDCOND ENDIF
IF LASTCC NE 0 THEN SET MAXCC = 1
//COND01 IF RC EQ 1 THEN
// SET EF=5
// SET MAXCC=0
// SET LASTCC=0
//ENDCOND ENDIF
And
//IF LASTCC NE 0 THEN SET MAXCC = 1
//DO
// SET &EF = '5'
// SET MAXCC = 0
// END
//COND01 IF &EF EQ 0 THEN
Perform step
//DO
// SET &EF = '5'
// SET MAXCC = 0
// END
//COND01 IF &EF EQ 0 THEN
Perform step
Any susgestions?