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

COND Parameter Problem


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

New User


Joined: 18 Feb 2005
Posts: 14

PostPosted: Wed Aug 17, 2005 8:36 pm
Reply with quote

Please find the details of the requirement given below ?



There are 2 steps in a proc.


The 2nd step has to be executed only if the return code (RC) of the previous step is 4 or 20.


For any other RC value of STEP1, the 2nd step needs to be bypassed.


This has to be done using COND parameter. (IF ? THEN cannot be used)

I tried searchin for 'AND' operator in this forum, but to no avail. Immediate Reply will be appreciated
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed Aug 17, 2005 8:50 pm
Reply with quote

Hi sundeep,

Try the COND Below...

Code:
//STEP1
//::
//::
//STEP2 EXEC=PGM,COND=((4,NE,STEP1),(20,NE,STEP1))
//::
//::
//


Regards,

Priyesh.
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 18, 2005 9:36 am
Reply with quote

Like Priyesh's code, you can have maximum of 8 conditions in one exec-cond.

jus FYI plz
Back to top
View user's profile Send private message
senti

New User


Joined: 18 Aug 2005
Posts: 19

PostPosted: Thu Aug 18, 2005 11:15 am
Reply with quote

Hey Priyesh,
- A step will be executed only if the CONDition is "false".
- If, you are specifying more than one condition in a step, Logical 'OR'
condition is applied( and not 'AND')
- Hence, your condition code as below will not work as Sundeep wants the
step to be executed only if the previous step return either 4 or 20.
COND=((4,NE,STEP1),(20,NE,STEP1))

Sundeep, There is no stright forward method of performing 'AND'
operation in condition codes.I guess, on a similar occassion i remember introducing a dummy step in between.

Condition codes are pretty nifty, and i hope i am not wrong this time around icon_exclaim.gif

Thanks, Senthil
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 18, 2005 12:04 pm
Reply with quote

Quote:
you are specifying more than one condition in a step, Logical 'OR'
condition is applied( and not 'AND')


Senti...what u said is rt.....but also jus refer what he mentioned

Quote:
2nd step has to be executed only if the return code (RC) of the previous step is 4 or 20


whatever it is...the prev step can have only one RC not both....what do u say?[/quote]
Back to top
View user's profile Send private message
senti

New User


Joined: 18 Aug 2005
Posts: 19

PostPosted: Thu Aug 18, 2005 12:16 pm
Reply with quote

OK, Lets work on expanding the condition,

Case1) Previous step returns '4'

COND=((4,NE,STEP1),(20,NE,STEP1))
= ((4,NE,4) OR (20 NE 4))
= F OR T
= TRUE Hence the step will not be executed.

Similarly, step will not be executed if the previous step returns 20.

Case2) Previous step returns '10'
COND=((4,NE,STEP1),(20,NE,STEP1))
= ((4,NE,10) OR (20 NE 10))
= T OR T
= TRUE Hence the step will not be executed.

Hence, the step will always be flushed out.

Right..?


Thanks, Senthil
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 18, 2005 12:23 pm
Reply with quote

Yes...Senthil...

I agree:)

Thanks...
Back to top
View user's profile Send private message
sundeep_rajasekaran
Warnings : 1

New User


Joined: 18 Feb 2005
Posts: 14

PostPosted: Thu Aug 18, 2005 12:30 pm
Reply with quote

Hi ppl,

Thanks for the quick replies. As senthil said, it is being bypassed everytime. Can we not do something with 'ONLY' or 'EVEN' operators?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Aug 18, 2005 12:35 pm
Reply with quote

Hi Senthil,

You are correct....In the code above STEP2 will always be flushed.

sundeep,

Why dont you use IF- THEN instead......

Well, If that is mandatory not to use IF - THEN, use another trick.... I would have coded two consecutive STEP2 with two different COND...
One for 4 & other for 20...

Let me know if that work.

Regards,

Priyesh.
Back to top
View user's profile Send private message
sundeep_rajasekaran
Warnings : 1

New User


Joined: 18 Feb 2005
Posts: 14

PostPosted: Thu Aug 18, 2005 10:29 pm
Reply with quote

Hi Priyesh,

The Jcl gave an error when i tried your solution. cuz of duplicate step name. As you said, If - then will be a lot more easier, but client insists on using only COND parameters. If COND is truly not feasible, then i will have to insist on changing to IF-THEN. Are you sure that there is no other alternative?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Aug 18, 2005 10:36 pm
Reply with quote

Hi sundeep,

Quote:
The Jcl gave an error when i tried your solution. cuz of duplicate step name

So change the name of steps man...whats the problem....

Quote:
As you said, If - then will be a lot more easier, but client insists on using only COND parameters.

icon_biggrin.gif ....why so....

Quote:
Are you sure that there is no other alternative?

That I already gave you above....

Regards,

Priyesh.
Back to top
View user's profile Send private message
senti

New User


Joined: 18 Aug 2005
Posts: 19

PostPosted: Fri Aug 19, 2005 2:25 pm
Reply with quote

Hey priyesh,
If you are having two consequetive steps then, How do u specify the condition code the second step.(i.e step checking RC=20)?
Please note that at this point we need to check for the return code of the belwo two

1) Step returning RC 4 or 20
2) Previous step which checks for RC= 4. FYI - If this step executes or flushes, do we have a way to determine?

Thanks, Senti[/quote]
Back to top
View user's profile Send private message
Kumar Madhavam

New User


Joined: 19 Aug 2005
Posts: 3

PostPosted: Fri Aug 19, 2005 2:50 pm
Reply with quote

Hi,
I think if u replace ur NE with EQ then it will work.
I mean to say that
//STEP1
//
//
//STEP2 EXEC PGM='ABC', COND=((4,EQ,STEP1),(20,EQ,STEP1))
//
I think it will work.
Madhavam
FIC,Hyderabad
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Aug 19, 2005 2:59 pm
Reply with quote

Dear Senti,

Quote:
If you are having two consequetive steps then, How do u specify the condition code the second step.(i.e step checking RC=20)?


Code:
//S001  EXEC PGM=IDCAMS                         
//IN   DD DSN=TEST.DATA.SET,DISP=SHR     
//SYSPRINT DD SYSOUT=*                           
//SYSIN    DD DATA                               
   PRINT INFILE(IN) COUNT(1)                     
/*                                               
//*                                             
//S002  EXEC PGM=IDCAMS,COND=(4,NE,S001)         
//IN   DD DSN=TEST.DATA.SET.OTHER,DISP=SHR     
//SYSPRINT DD SYSOUT=*                           
//SYSIN    DD DATA                               
   PRINT INFILE(IN) COUNT(1)                     
/*                                               
//*                                             
//S003  EXEC PGM=IDCAMS,COND=(0,NE,S001)         
//IN   DD DSN=TEST.DATA.SET.OTHER,DISP=SHR     
//SYSPRINT DD SYSOUT=*                           
//SYSIN    DD DATA                               
   PRINT INFILE(IN) COUNT(1)             
/*
//       


Here in the code S002 & S003 are same in functioning. But they are being executed on the basis of RC from S001.

S001 checking for empty file...Returns 4 in case of empty, else 0.
S002 executes if S001.RC=4
S003 executes if S001.RC=0.

Quote:
Please note that at this point we need to check for the return code of the belwo two

1) Step returning RC 4 or 20
2) Previous step which checks for RC= 4. FYI - If this step executes or flushes, do we have a way to determine?


1) Its being done in the code above.
2) FYI - If this step executes or flushes, do we have a way to determine?
What do you want to determine in this case....If S002 executes means S001 returned 4 & not 0....So it'll flush S003.
If S002 flushes means S001 returned 0, not 4....So S003 executes.

I hope I m clear ....else try to execute the code.....

Sundeep,

Please change the code as per your requirement.

Regards,

Priyesh.
Back to top
View user's profile Send private message
senti

New User


Joined: 18 Aug 2005
Posts: 19

PostPosted: Fri Aug 19, 2005 3:19 pm
Reply with quote

Hey Priyesh, Somehow we are not on same page, From what sundeep has posted i guess he needs to execute a step if the previous step has returned either 4 or 20. Your code handles only 4. What about RC 20..?

Regds, Senti
Back to top
View user's profile Send private message
elonics

New User


Joined: 05 Jul 2005
Posts: 49
Location: India

PostPosted: Fri Aug 19, 2005 3:34 pm
Reply with quote

Hi Friends,


Priyesh is correct. But u have to take care of return code 20 also.


So i wat i request the needy is to code the cond in the following way.

In Step2 Code the condition as Cond=(4,NE,STEP1)
In Step3 Code the Condition as Cond=((20,NE,STEP1),(0,E,STEP2))

Step2 and Step3 will have same things to be executed.

Corrections are Sweetly Regreted since this will work

Elo'nics
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Aug 19, 2005 3:56 pm
Reply with quote

elonics,

Quote:
But u have to take care of return code 20 also.


For that only I mentioned Please change the code as per your requirement. .

The code I gave above is for either 4 or 0. By replacing 0 from the code to 20 will exactly sove ...what sundeep asked for.....

Quote:
In Step3 Code the Condition as Cond=((20,NE,STEP1),(0,E,STEP2))


Why one bothering for RC from STEP2, when it is irrelevent to the STEP3.

Senti,
Quote:

Hey Priyesh, Somehow we are not on same page, From what sundeep has posted i guess he needs to execute a step if the previous step has returned either 4 or 20. Your code handles only 4. What about RC 20..?


Our original prob started executing a stepon having 4 or 20 from STEP1. I m just coded the same step two times (S002 & S003). & they 'll execute on the different RC from S001, which u can mention on COND parm.

Please try to execute the code given....It should help ...

P.S. Please change RC 0 to 20 in the code above, along with the steps concerned. I did it for 4 & 0.

Regards,

Priyesh.
Back to top
View user's profile Send private message
elonics

New User


Joined: 05 Jul 2005
Posts: 49
Location: India

PostPosted: Fri Aug 19, 2005 4:17 pm
Reply with quote

Got u.


Thanx,
Elonics.
Back to top
View user's profile Send private message
senti

New User


Joined: 18 Aug 2005
Posts: 19

PostPosted: Fri Aug 19, 2005 4:56 pm
Reply with quote

Yes priyesh, U are rite..!! icon_cool.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Aug 19, 2005 5:05 pm
Reply with quote

Thanks Senti/elonics....for putting effort.....

Sundeep...

Let all of us know.... whether you were able to deliver up to ur clients expactation....Do this work for you....

Regards,

Priyesh.
Back to top
View user's profile Send private message
sundeep_rajasekaran
Warnings : 1

New User


Joined: 18 Feb 2005
Posts: 14

PostPosted: Fri Aug 19, 2005 10:38 pm
Reply with quote

Hi ppl,

Thanks a lot for all those responses,

That problem currently on hold, as some other production problem has crept up, and we need to take care of that first.

Will surely let you guys know if it ran fine. Thanks a lot for all the effort.
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Using the Jobname parameter in a Qual... ABENDS & Debugging 1
No new posts Demand with DEADLINE TIME parameter CA Products 4
No new posts Option DYNALLOC second parameter. DFSORT/ICETOOL 11
Search our Forums:

Back to Top