View previous topic :: View next topic
|
Author |
Message |
lalitha_gld
New User
Joined: 12 Jul 2006 Posts: 24
|
|
|
|
Hi,
In my JCL I'm using the COND parameter to skip a step, if the previous step has run successfully with '0' return code. The way I have coded is as below,
ERRMAIL1 EXEC PGM=SASLPA,PARM='EMAILHOST=&IP',
COND=(0,EQ,FTPSTEP)
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!
Thanks & Regards,
Lalitha. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Is FTPSTEP native or part of a PROC ? |
|
Back to top |
|
|
lalitha_gld
New User
Joined: 12 Jul 2006 Posts: 24
|
|
|
|
The FTPSTEP is part of the proc.
Regards,
Lalitha. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
COND=(0,EQ,PROCNAME.PROCSTEP) |
|
Back to top |
|
|
mftrigger
New User
Joined: 18 Feb 2006 Posts: 23 Location: chennai
|
|
|
|
It must b coded as
COND=(0,NE,FTPSTEP)
If none of the tests in COND is satisfied, the system executes the job step; if any test is satisfied, the system skips the job step on which the
COND= parameter is coded.
Quote: |
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?
|
I don think other jobs RC wud impact the current job RC. Except if the previous job got abended, the next job wud not xcute. |
|
Back to top |
|
|
lalitha_gld
New User
Joined: 12 Jul 2006 Posts: 24
|
|
|
|
Hi expat,
Quote: |
COND=(0,EQ,PROCNAME.PROCSTEP) |
I tried this out, but this also didn't work. I guess I might have to try with IF logic only to curtail the ERRMAIL1 step. But I'm quite not able to understand how this is still ignored!
Hi mftrigger,
The required condition is that the ERRMAIL1 step should be triggered only if the FTPSTEP returns an RC other than '0'. Hence it was coded as
Quote: |
ERRMAIL1 EXEC PGM=SASLPA,PARM='EMAILHOST=&IP',
COND=(0,EQ,FTPSTEP) |
Pls suggest if you have any ideas.
Thanks,
Lalitha. |
|
Back to top |
|
|
mftrigger
New User
Joined: 18 Feb 2006 Posts: 23 Location: chennai
|
|
|
|
Lalitha,
Can u show us some light on ur proc.. so tat it is easy 4 us to detect wat actually is happening .. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Well, I have just tested a conditional execution / exclusion and it works fine for me.
Code: |
//TESTPROC EXEC TESTPROC
//*
//CONDTEST EXEC PGM=IEFBR14,
// COND=(0,EQ,TESTPROC.STEP020)
|
I get a JCL error if I do not code it as TESTPROC.STEP020 - did you get one when you tested it as coded without ?
The fact that you have not said that you received a JCL error maybe makes me think that you have a step called FTPSTEP as well as one in the PROC.
As already requested, post your JCL & output. |
|
Back to top |
|
|
Woe
New User
Joined: 03 Sep 2007 Posts: 2 Location: UK
|
|
|
|
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.
So something like:
Code: |
//USERID1F JOB (),'COND FTP',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*
//JSTEP01 EXEC PROC=MYFTP
//*
//JSTEP02 EXEC PGM=MYPGM,COND=(0,EQ,JSTEP01.PSTEP01)
//*
// |
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..
Code: |
//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
//*
//EIF01 ENDIF
//*
// |
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:
Code: |
//IF07 IF (JSTEP02.RUN=FALSE) OR (JSTEP01.PSTEP01.ABEND=TRUE) THEN
//*
//JSTEP18 EXEC PGM=MYPGM2
//*
//EIF07 ENDIF
//*
// |
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. |
|
Back to top |
|
|
lalitha_gld
New User
Joined: 12 Jul 2006 Posts: 24
|
|
|
|
Hey all,
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.
Hope it helps!
Thanks,
Lalitha. |
|
Back to top |
|
|
|