Ideally, if the FTPSTEP goes fine the ERRMAIL1 step should not execute. But when I ran the job, I got a '0' RC for FTPSTEP and still the ERRMAIL1 step was also executed, it didnt flush out. What could be the reason?
One more thing is that, in my job flow a previous step ( well before FTPSTEP) got a RC of 8. Is this playing the reason?
But my confusion is that the COND parameter is very specific to the required step!
The name for the step within the COND statement should be a combination of the stepname within the job and the stepname within the proc. The proc name doesn't matter, unless it's also the name of the step within the proc.
The logic of COND statements is "Don't run if true".
So in your case... since you don't want to run the SASLPA program if the FTP was successful, COND=(0,EQ,JOBSTEP.PROCSTEP) style would seem to be what you are needing.
Where "PSTEP01" is the stepname within the proc "MYFTP".
Alternatively, you could use the new "IF/THEN/ELSE" logic you can use in JCL these days, which is much easier to read and maintain..
//USERID1F JOB (),'COND FTP',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//JSTEP01 EXEC PROC=MYFTP
//IF01 IF (JSTEP01.PSTEP01.RC NE 0) THEN
//JSTEP02 EXEC PGM=MYPGM
I tend to use the "IF01/EIF01" labels on IF/ENDIF statements for readability... especially where you are using nested IF statements.
Then you can code things later that could check if "MYPGM" ran, or even if your FTP abended by coding something like:
//IF07 IF (JSTEP02.RUN=FALSE) OR (JSTEP01.PSTEP01.ABEND=TRUE) THEN
//JSTEP18 EXEC PGM=MYPGM2
These are just sample bits of code, so excuse any typo. The flow of running a 2nd program if a first didn't run or the ftp failed may not be what you are looking for, but I included it to show the flexibility that exists. Trapping abending steps this way could also cause you problems if you are running a scheduler like TWS, OPC, etc.
Thanks for all those responses. I finally got the bug which was causing the COND code in my proc to be ignored. The culprit was the COND code given in the JCL EXEC stmt for the given proc.
The proc would be executed based on the COND codes from previous job step. This has overrided all the COND codes in the proc. So we have changed the JCL EXEC stmt for the proc to have IF conditions instead of COND.