Page 1 of 1

CONDition codes in PROC

PostPosted: Wed Feb 03, 2016 1:23 pm
by dk1987
Hi,

I've a catalogued proc and a jcl to invoke it.
objective: want to run few steps for some testing purpose.

question:
say, the catalaogued proc has steps - 1,2,3,4,5,6,7. I want to run only step 1 and 2.. rest of the steps should be bypassed. I know that by coding condition code as (0,LE) for step 3,4,5,6,7 can bypass all those steps. but is there some other way to bypass all the steps below step 2, (of course, not by deleting/commenting out the steps ;). the thing is I should not modify PROC). Why I need to know an alternate method because, I've to find all the step name below step 2 and put the condition code in JCL, which is time consuming. Could anyone please help me in this regard.

Thanks :)

Re: CONDition codes in PROC

PostPosted: Wed Feb 03, 2016 1:55 pm
by Aki88
Hello,

dk1987 wrote:Why I need to know an alternate method because, I've to find all the step name below step 2 and put the condition code in JCL, which is time consuming. Could anyone please help me in this regard.


If step names is all that you're looking for, can't this be achieved without running the JCL at all?
One of the ways (remove the double-quotes during actual usage of the commands):
a. Open the JCL/PROC in question, in ISPF (option 3.4) VIEW mode
b. Type "X ALL;F ALL 'EXEC' "

The above should give you all the places where a program/EXEC (call to a PROC) is being called; if it is commented, then you can filter it as well, by simply typing: "X ALL '//*' 1", which hides all lines containing '//*' in first column; why execute the JCL at all.

Having said that, at the end of it all, you WILL have to manually add the COND parameters to each step, unless you have a tool in place to do it for you.


Edit: You can also look here.

Re: CONDition codes in PROC

PostPosted: Wed Feb 03, 2016 3:13 pm
by swe_das
You can use IEBEDIT utility, ofcourse. you can specify the exact steps that need to be executed(provided you are not lazy enough to not know them :D)

//IEBEDITA JOB (XXXXXXXX,,,,,XXXX),' ',CLASS=T,
// MSGCLASS=Y,NOTIFY=&SYSUID
//*===========================================================
//* EXAMPLE FOR IEBEDIT UTILITY
//*===========================================================
//STEP001 EXEC PGM=IEBEDIT
//SYSUT1 DD DSN=USERID.ABC.JCLLIB(JOBNAM1),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
EDIT TYPE=INCLUDE,STEPNAME=(STEP010,STEP020)
/*
Link to another Mainframe forum removed.

Re: CONDition codes in PROC

PostPosted: Wed Feb 03, 2016 9:34 pm
by NicC
You can put a deliberate JCL error into the third step e,g, a non-existent dataset. That will abend the job.
Or you can copy the proc and delete the unwanted steps.

Re: CONDition codes in PROC

PostPosted: Wed Feb 03, 2016 9:35 pm
by Terry Heinze
It would require a one-time change to your PROC, but if I understand you, it can be done like this:

COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 //jobname JOB (xxxxx,xxxx),'TERRY HEINZE -- xxxx',
000002 //             CLASS=B,
000003 //             MSGCLASS=H,
000004 //*  I AM 'userid.AAA.CNTL(TESTIFS)'
000005 //*  +------------------------------------------------------------+
000006 //*  |  MODIFY THE SXEXEC PARAMETERS TO {EXEC|SKIP} THE STEP      |
000007 //*  +------------------------------------------------------------+
000008 //             NOTIFY=&SYSUID
000009 //*
000010 //TESTPROC PROC
000011 //*
000012 //SX      EXEC PGM=IEFBR14
000013 //*
000014 //         IF &S1EXEC THEN
000015 //S1      EXEC PGM=IEFBR14
000016 //         ENDIF
000017 //*
000018 //         IF &S2EXEC THEN
000019 //S2      EXEC PGM=IEFBR14
000020 //         ENDIF
000021 //*
000022 //         IF &S3EXEC THEN
000023 //S3      EXEC PGM=IEFBR14
000024 //         ENDIF
000025 //*
000026 //         IF &S4EXEC THEN
000027 //S4      EXEC PGM=IEFBR14
000028 //         ENDIF
000029 //*
000030 //         IF &S5EXEC THEN
000031 //S5      EXEC PGM=IEFBR14
000032 //         ENDIF
000033 //*
000034 //         IF &S6EXEC THEN
000035 //S6      EXEC PGM=IEFBR14
000036 //         ENDIF
000037 //*
000038 //         IF &S7EXEC THEN
000039 //S7      EXEC PGM=IEFBR14
000040 //         ENDIF
000041 //*
000042 //         PEND
000043 //*
000044 //PROCTEST EXEC TESTPROC,
000045 //             S1EXEC='(RC EQ 0000)',  <---  EXEC THIS STEP
000046 //             S2EXEC='(RC EQ 0000)',  <---  EXEC THIS STEP
000047 //             S3EXEC='(RC LT 0000)',  <---  SKIP THIS STEP
000048 //             S4EXEC='(RC LT 0000)',  <---  SKIP THIS STEP
000049 //             S5EXEC='(RC LT 0000)',  <---  SKIP THIS STEP
000050 //             S6EXEC='(RC LT 0000)',  <---  SKIP THIS STEP
000051 //             S7EXEC='(RC LT 0000)'   <---  SKIP THIS STEP
000052 //

Re: CONDition codes in PROC

PostPosted: Thu Feb 04, 2016 2:38 pm
by dk1987
Thanks all for the reply/suggestion.. :) Thats the beauty of these type of forums. you got to know how to approach a problem in different ways/perception - good learning.

But reading all the comments, i think there is no better alternate than coding COND code. may be a tool to automate that would only help to avoid extra coding time or as Akki88 quoted, need to find some 'ways' to reduce the overall time.

Re: CONDition codes in PROC

PostPosted: Thu Feb 04, 2016 8:41 pm
by NicC
If this is a regular thing then create a new proc with only the required steps and run that instead of the other one when required.

Re: CONDition codes in PROC

PostPosted: Fri Feb 05, 2016 1:46 pm
by prino
Set up all new JCL with logical step names, i.e.

SA001
SA002
SA003
SA004

And code IF-THEN-ENDIF statements around them with logical RC's, i.e.

IF RC &RC001 THEN

and by changing the default variables from

RC001='= 0'

to

RC001='= 0 & RC001=1'

You can very easly do what you want to do...