IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How is the COND paramter ignored for the step in this case?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lalitha_gld

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Fri Mar 07, 2008 12:28 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Mar 07, 2008 12:53 pm
Reply with quote

Is FTPSTEP native or part of a PROC ?
Back to top
View user's profile Send private message
lalitha_gld

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Fri Mar 07, 2008 3:59 pm
Reply with quote

The FTPSTEP is part of the proc.

Regards,
Lalitha.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Mar 07, 2008 4:02 pm
Reply with quote

COND=(0,EQ,PROCNAME.PROCSTEP)
Back to top
View user's profile Send private message
mftrigger

New User


Joined: 18 Feb 2006
Posts: 23
Location: chennai

PostPosted: Tue Mar 11, 2008 3:00 pm
Reply with quote

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
View user's profile Send private message
lalitha_gld

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Tue Mar 11, 2008 4:16 pm
Reply with quote

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
View user's profile Send private message
mftrigger

New User


Joined: 18 Feb 2006
Posts: 23
Location: chennai

PostPosted: Tue Mar 11, 2008 5:12 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Mar 11, 2008 5:22 pm
Reply with quote

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
View user's profile Send private message
Woe

New User


Joined: 03 Sep 2007
Posts: 2
Location: UK

PostPosted: Wed Mar 12, 2008 7:34 pm
Reply with quote

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
View user's profile Send private message
lalitha_gld

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Thu Apr 10, 2008 7:26 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top