View previous topic :: View next topic
|
Author |
Message |
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
COND=(0,NE) on the jobcard
Job sysout will tell you FLUSH or RC |
|
Back to top |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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. . . |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
There seems to some doubt that my solution won't work.
I tested it. It does exactly what the OP specified. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
superk,
Not a doubt 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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Quote: |
Oh boy, not the birch twigs again .......................................... |
Should have been
Oh boy, not the birch twigs again .......................................... |
|
Back to top |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 . So wht will be the fate of conditional coding ???
Thanks you all |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 ) .... 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 |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Why not try to restart from STEP3 and let us know if
a) there are problems
b) if it works fine |
|
Back to top |
|
|
sandeep1dimri
New User
Joined: 30 Oct 2006 Posts: 76
|
|
|
|
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 |
|
|
|