Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How is the COND paramter ignored for the step in this case?
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: 8593
Location: Back in jolly old England

PostPosted: Fri Mar 07, 2008 12:53 pm    Post subject:
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    Post subject: Reply to: How is the COND paramter ignored for the step in t
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: 8593
Location: Back in jolly old England

PostPosted: Fri Mar 07, 2008 4:02 pm    Post subject:
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    Post subject: Re:
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    Post subject: Reply to: How is the COND paramter ignored for the step in t
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    Post subject: Reply to: How is the COND paramter ignored for the step in t
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: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 11, 2008 5:22 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: How is the COND paramter ignored for the step in t
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us