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

JCL exceution flow with typical requirement


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

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Fri May 18, 2007 4:29 pm
Reply with quote

Hi,

Could anybody put a logic to below requiremet::

JCL is with 10 to 15 steps and return code of one steps governs the excecution of rest of the steps in the JCL for example

STEP1

-----

STEP 2
-----

.
.
.
.
.
.
Step 20.

Step 2 exceutes only if step 1 return 0 . and if step 1 return code is other then zero then none of the steps of the JCL will execute

similarly
Step 3 exceutes only if step 2 return 0 . and if step 2 return code is other then zero then none of the steps of the JCL will execute

and SO . If you append condition code for each steps and based on the previous steps at last step one can land with lots of condition codes .

So is we can do following in JCL to solve this problem
1. Some sort of GOTO type in JCL.
2. Can we find out whether a step executes or flused in JCL

Waiting for logics :-)))
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri May 18, 2007 4:38 pm
Reply with quote

COND=(0,NE) on the jobcard

Job sysout will tell you FLUSH or RC
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Fri May 18, 2007 5:20 pm
Reply with quote

Hi

Oops i forgot to mention that not all the steps return code is based "zero". So of the steps return code 1 4 or 8 is acceptable so we can't go with job card logic

Sorry for missing out the requiement :-(

Ples suggest
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri May 18, 2007 5:58 pm
Reply with quote

WOW, a can of worms.

The only quick, and very dirty, idea I can come up with is that after each step you have a IEFBR14 step that will try to access a non existent dataset, and if the IEFBR14 is executed then the job will fail JCL error.

Apart from that ..............................................
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Fri May 18, 2007 6:16 pm
Reply with quote

Hey

But i dont want to loose the jobs return code in between :-(((

hey i need to code JCL like we calls user abend in between :-))) the cobol program :-)

Its like that to check the return code of previous step and based on it next steps need to execute and if it did not meet the acceptable Return code other down the line steps need to be flused ... I m really stucked

I m looking forward with only option left to use nested IF in my JCL.

Please suuugest if anbody have another approach
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri May 18, 2007 6:21 pm
Reply with quote

Maybe I'm over simplifying the question, but wouldn't a set of OR conditions work:

Code:

//STEP1 EXEC PGM=PROG1
//*
//  IF (STEP1.RC=0 | STEP1.RC=1 | STEP1.RC=4 | STEP1.RC=8) THEN
//STEP2 EXEC PGM=PROG2
//  ENDIF
//*
//  IF (STEP2.RC=0 | STEP2.RC=1 | STEP2.RC=4 | STEP2.RC=8) THEN
//STEP3 EXEC PGM=PROG3
//  ENDIF
//*
... and so on
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri May 18, 2007 6:32 pm
Reply with quote

The way that I understood it ......... if STEP2 gets bypassed, then unless we have reams and reams of condition checks STEP3 would run.

So each step would have checks for all acceptable options for all previous steps, which would
a) probably exceed the allowed limit on cond= checks per step
b) be a complete nightmare to maintain

Is there a "NOT RUN" option/parm in IF / THEN / ELSE code ???

Mmmmmmmmmmmm, off to the manuals to see.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri May 18, 2007 11:46 pm
Reply with quote

Hello,

For my $.02, the programs and/or jobstream needs to be made more supportable.

Let's assume that there is a way to handle the myriad of possible codes - think of what this might be like to restart. . . icon_confused.gif
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat May 19, 2007 12:37 am
Reply with quote

There seems to some doubt that my solution won't work. icon_sad.gif

I tested it. It does exactly what the OP specified. icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat May 19, 2007 12:48 am
Reply with quote

Hello,

Quote:
There seems to some doubt that my solution won't work.


I had no doubt (but didn't know if OP would buy in on the IFTHEN), but i am always leery of that much custom condition code testing. So far, at sites where i was actually involved with "methods imroovements", a way to meet the processing need without an intricate set of conditions/restart considerations was found.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Sat May 19, 2007 1:37 am
Reply with quote

superk,

Not a doubt icon_eek.gif just a question.

Unfortunately I didn't get a chance to peruse the documentation.

Let's face it, you have come up with some great solutions, but I only raised a valid question, (well I thought it was valid), with possible options.

Oh boy, not the birch twigs again ..........................................
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Sat May 19, 2007 1:42 am
Reply with quote

Quote:
Oh boy, not the birch twigs again ..........................................

Should have been

Oh boy, not the birch twigs again .......................................... icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Sat May 19, 2007 8:13 am
Reply with quote

Hi

I am still trying to solve this problem. It has one more intricate factor that if you put the condition on the resturn code of some previous step it is possible that the refferrd step got flused icon_sad.gif . So wht will be the fate of conditional coding ???

Thanks you all
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat May 19, 2007 8:27 am
Reply with quote

Hello,

It may be time to explain what this job does rather than how you want to solve this condition code situation.

This kind of complexity usually causes many more problems than if solves.

If we understand what the various steps do, we should be able to offer suggestions on how to get your process to work and be supportable.
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Sat May 19, 2007 10:14 am
Reply with quote

Hi

I have analysed those ways also. IF we some how swaps the steps but the problem still remains the same. An I cant eliminate anay of the steps as they them selves are thr as part of some other requirement :-(

So really got in trouble or need to learn some more to sove it
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat May 19, 2007 7:17 pm
Reply with quote

Hello,

It is unlikely that you have analyzed all of the suggestions you might get from folks here. . .
Quote:
I have analysed those ways also.


There are many here who would help and they have a wide variety of background.

Many of the centers i've supported have jobs that have hundreds of conditional steps and are done in a straightforward manner - setting them up is not a major problem.

As i mentioned previously, if you post what needs to be done rather than how to implement, we may be able to help with the implementation. Keep in mind that while this is a new challange for you - others have worked through it or something similar previously.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Sat May 19, 2007 7:29 pm
Reply with quote

I just noticed that the IF/THEN/ELSE logic can be nested up to 15 levels,
so in this case it is just what is needed not top overcomplicate the jcl
Code:

//STEP1 EXEC PGM=PROG1
//  IF (STEP1.RC ...... is valid ) THEN
//STEP2 EXEC PGM=PROG2
//*
//  IF (STEP2.RC ....... is valid ) THEN
//*
//STEP3 EXEC PGM=PROG3
//  IF (STEP3.RC ....... is valid ) THEN
//STEP4 EXEC PGM=PROG4
...... up to 15 levels
//  ENDIF .... step4 execution
//  ENDIF .... step3 execution
//  ENDIF .... step2 execution
//*


in this way the IF/THEN/ELSE logic is concerned only about the preceding step

regards
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Sat May 19, 2007 8:46 pm
Reply with quote

I think that superk's idea will work, with a little tweak.

Or ........ am I missing something (been desperate to say that for ages now icon_eek.gif ) .... because I think the run check against the previous step should be included too.

My interpretation of the logic is that STEP2 will run on condition of STEP1, so if STEP2 does run, STEP3 checks the return code, but if it doesn't run the STEP2.RUN=TRUE will not allow STEP3 to process, and by continuing the theme through to the end, each step checks its predecessor to (a) see if it did run and (b) if it did, what RC it issued.
Code:

//STEP1 EXEC PGM=PROG1
//*
//  IF (STEP1.RC=0 | STEP1.RC=1 | STEP1.RC=4 | STEP1.RC=8) THEN
//STEP2 EXEC PGM=PROG2
//  ENDIF
//*
//  IF (STEP2.RUN=TRUE & (STEP2.RC=0 | STEP2.RC=1 | STEP2.RC=4 | STEP2.RC=8)) THEN
//STEP3 EXEC PGM=PROG3
//  ENDIF
//*
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Mon May 21, 2007 10:54 am
Reply with quote

Hi

Thanks everbody

Now just i need one more solution If i use

// IF (STEP2.RUN=TRUE & (STEP2.RC=0 | STEP2.RC=1 | STEP2.RC=4 | STEP2.RC=8)) THEN
//STEP3 EXEC PGM=PROG3
// ENDIF

And my job get abend in the step3 how to restart the job from Step 3.

Please suggest
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon May 21, 2007 11:48 am
Reply with quote

Why not try to restart from STEP3 and let us know if

a) there are problems
b) if it works fine
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Mon May 21, 2007 12:29 pm
Reply with quote

If we try to restart the step 3 (when job abended in step 3) the step 3 can't execute as coditional coding stops its execution

I hve tested this
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 Urgent requirement for MF (Exp - 4 to... Mainframe Jobs 0
No new posts Need inputs on Space requirement and... IMS DB/DC 0
No new posts SORT requirement COBOL Programming 6
This topic is locked: you cannot edit posts or make replies. Mainframe Developer requirement in Ku... Mainframe Jobs 0
No new posts Cards mainframe developer requirement... Mainframe Jobs 0
Search our Forums:

Back to Top