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

how to execute steps randomly


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

New User


Joined: 02 Dec 2004
Posts: 4
Location: Chennai

PostPosted: Sat Dec 04, 2004 10:49 am
Reply with quote

I have 5 steps.I want to execute from 2nd step,then 1st,then 4th and then 3rd steps.Is it possible.can anyone clear my doubt.
Back to top
View user's profile Send private message
Aditya Bhardwaj
Warnings : 1

New User


Joined: 02 Nov 2004
Posts: 18
Location: Noida, India

PostPosted: Tue Dec 07, 2004 10:28 am
Reply with quote

As per my knowledge, i don't think that it is possible to execute steps randomly in a JCL. Rather you have to execute it sequentially, and write in the manner you wnat them to be executed.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Dec 07, 2004 1:48 pm
Reply with quote

It is always asked whether i can execute only odd/even steps of JCL or random steps etc. But it is not possible to do so in JCL. Restart parameter helps you if you need to start executing from certain steps and it is possible to bypass certain steps using COND parameter.

Quote:
I have 5 steps.I want to execute from 2nd step,then 1st,then 4th and then 3rd steps.Is it possible.can anyone clear my doubt.


Why dont you change your Job in that required manner?
Back to top
View user's profile Send private message
veera
Warnings : 1

New User


Joined: 24 Nov 2004
Posts: 20
Location: chennai

PostPosted: Tue Dec 07, 2004 6:17 pm
Reply with quote

[quote="anuradha"]It is always asked whether i can execute only odd/even steps of JCL or random steps etc. But it is not possible to do so in JCL. Restart parameter helps you if you need to start executing from certain steps and it is possible to bypass certain steps using COND parameter.

[quote]I have 5 steps.I want to execute from 2nd step,then 1st,then 4th and then 3rd steps.Is it possible.can anyone clear my doubt.[/quote]

Why dont you change your Job in that required manner?[/quote]


hello,
executing steps randomly by using DPART parames
second way is using IEBEDIT COMMAND.

REGARDS,
VEERA
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Dec 07, 2004 7:05 pm
Reply with quote

Hi Veera,

Can you please describe clearly about the two methods you mentioned.
Back to top
View user's profile Send private message
veera
Warnings : 1

New User


Joined: 24 Nov 2004
Posts: 20
Location: chennai

PostPosted: Tue Dec 07, 2004 11:14 pm
Reply with quote

[quote="anuradha"]Hi Veera,

Can you please describe clearly about the two methods you mentioned.[/quote]
hai anu
it can be solved by using the following two mehods
1. in step card u have to mention the dprty=(val1,val2)
priority=16*val1 +val2 according to result value step will be executed higher number higher priority
2. By using IEBEDIT u have to specify the name after sysin dd *
steps (step10 step2.....) in ur prefered manner
during runtime these r executed as mentioned manner
regs
veera
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Dec 07, 2004 11:28 pm
Reply with quote

Hi veera,

I wonder if coding DPRTY on step name will serve you the purpose. Did u test this?

And regarding IEBEDIT utility iam not aware of this.

Anyway let me check from my part and i will let you know the results.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Dec 08, 2004 3:17 pm
Reply with quote

Hi veera,

When I am searching about this IEBEDIT utility nowhere i found that this utility is used to execute the steps in a selective manner.

I wonder if you got the result in this way.
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Wed Dec 08, 2004 5:29 pm
Reply with quote

Hey Man,

Try the following method. it may work efficiently.

Create a flat file using ISPF option 3.2 A and enter step numbers which u want to execute.

Eg: 2
5
7
12
and so on.... Then write a Cobol program which reads your source JCL and starts a Step_Counter as 0 ( a WS variable) for each step it is incremented by one. Compare present Step_Counter Value with The Step numbers available in Flat file. If match then copy that step ( read as record) into a new flat file ( will be your result JCL).

Repeat the process for all steps then either manually execute newly generated JCL file or automatically submit using (*,INTRDR) ( refer to previous faq for automatically submitting jcl from cobol).

If u have chance and patience you can create a tool with above specifications. Ok.

End Note: It means I dont have yet.
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Wed Dec 08, 2004 10:53 pm
Reply with quote

any body has a sample JCL to do this?
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Thu Dec 09, 2004 6:06 pm
Reply with quote

Hi veera,

Where are you man. Why dont you provide the Sample JCl for the two methods which you suggested. But AFAIK coding DPRTY in the step level will just ignore that and i dont think it will give us the solution. But it is appreciable If you provide us the JCL if it works for you.

And one small suggestion from me. Why dont you preview your post before posting. Because i have seen many of your posts have the QUOTES but not in a fine way. and just dont say hello. It is very rude. Its only my suggestion.Hope you will take in a positive sense.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Dec 09, 2004 7:04 pm
Reply with quote

Here is a sample IEBEDIT job as requested that submits a job (JOB1) from steps 2, 1, 4, and 3:
Code:

//JOB0 JOB (T,67423,000),'ME',CLASS=T,MSGCLASS=X,
//     MSGLEVEL=(1,1),NOTIFY=&SYSUID             
//*                                               
//STEP0001 EXEC PGM=IEBEDIT                       
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1       
//SYSUT2   DD   SYSOUT=(A,INTRDR)                 
//SYSPRINT DD   SYSOUT=*                         
//SYSIN    DD   *                                 
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0002
/*                                               
//*                                               
//STEP0002 EXEC PGM=IEBEDIT                       
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1       
//SYSUT2   DD   SYSOUT=(A,INTRDR)                 
//SYSPRINT DD   SYSOUT=*                         
//SYSIN    DD   *                                 
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0001
/*                                               
//*                                                     
//STEP0003 EXEC PGM=IEBEDIT                             
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1             
//SYSUT2   DD   SYSOUT=(A,INTRDR)                       
//SYSPRINT DD   SYSOUT=*                               
//SYSIN    DD   *                                       
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0004       
/*                                                     
//*                                                     
//STEP0004 EXEC PGM=IEBEDIT                             
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1             
//SYSUT2   DD   SYSOUT=(A,INTRDR)                       
//SYSPRINT DD   SYSOUT=*                               
//SYSIN    DD   *                                       
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0003       
/*                                                     
//*                                                     

I coded JOB1 to have 5 steps that just write the stepname to a dataset as proof that the process is working. Here is the results from the dataset:
Code:

JOB JOB1 RAN STEP0002 <= START AT STEP2
JOB JOB1 RAN STEP0003
JOB JOB1 RAN STEP0004
JOB JOB1 RAN STEP0005
JOB JOB1 RAN STEP0001 <= START AT STEP1
JOB JOB1 RAN STEP0002
JOB JOB1 RAN STEP0003
JOB JOB1 RAN STEP0004
JOB JOB1 RAN STEP0005
JOB JOB1 RAN STEP0004 <= START AT STEP4
JOB JOB1 RAN STEP0005
JOB JOB1 RAN STEP0003 <= START AT STEP3
JOB JOB1 RAN STEP0004
JOB JOB1 RAN STEP0005
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Thu Dec 09, 2004 7:37 pm
Reply with quote

Hi Kevin,

The job given by you is almost like starting particular job from particular step right! icon_idea.gif

And my doubt is can we use this utility to execute steps randomly in a selective way. Suppose i want to execute job1 in the following way:
Step2,step4,step1 and then execute step3.Is this possible. I dont think it is. Even i tried to do.But i couldn't. If it is possible please give us the jCL for this.
Back to top
View user's profile Send private message
mprabhuram

New User


Joined: 09 Jun 2005
Posts: 1
Location: Chennai

PostPosted: Thu Jun 09, 2005 10:47 pm
Reply with quote

Hi,

Inorder to run step 6 then 3 then step 11.....

First create a simple program which will read a file and set the return code based on the file... Once the first record is read and return code is set it will then place a flag next to the first record that this step is executed... Afterwards when the program is again called it will check the first record and if there is there is flag it will skip that record and read the next record.... if there is no flag set in the second record it will set the second record content as the return code.....


i.e

Consider the following file as sample....


RETURNCODE STEP EXECUTED STATUS FLAG
----------------FILE START------------------------------------------
6 Y
3
11
----------------FILE END---------------------------------------------


Our jCL should be coded like this



step1
Execute the program which will read the input file and set the rc code as value of RETURNCODE field in the input file. Once the return code is genrated that record is marked as processed (Y)... If there all records were already processed the retun code is set to say 99


if rc=3
execute step3

if rc=6
execute step6

if rc=11
execute step3


if rc <> 99
last step ... submit the same job again through intr reader


So now the job will be submited 3 times as per our example.. and in the first run the program will read the input file and set the rc as 6 .. and it also sets the first records status flag as Y(inorder to skip the 6 step when the job is submitted again through the internal reader) Since the rc is set as 6 only the step 6 will be executed... and at end the last step will again submit the jcl..

When the jcl is submitted again the program is executed again, it has to skip the first record(step 6) since the flag is set as Y(already processed in run 1) and read the next reacord and set the rc as 3..Now only the step 3 will be executed and the whole process will be replicated untill the exit conditon is reached

NOTE : Please let me know if any body knows a better solution...

thanks
Prabhuram Mohan
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Fri Jun 10, 2005 4:12 am
Reply with quote

Call me too curious, but has anyone actually ever had to run a job with the steps out of order or randomized other that restarting at a particular step?

This questions appears regularly on several MVS discussion boards and it sounds too much like an interview or classroom question.

I worked in a large insurance company IT shop as well as a large retailer IT shop and I never saw a production problem addressed by executing steps out of order. If a situation required unusual step order, a job was created containing them in the order required, placed in a special JOB library and operations notified that it was ready to execute.

Dave
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Jun 14, 2005 7:03 pm
Reply with quote

Yep Even I agree with you Dave. I bet these are Interview questions. Never we got this kind of situation. And am sure if we get also we go for another job rather than trying in the above ways.
Back to top
View user's profile Send private message
mf_user
Currently Banned

New User


Joined: 05 Jan 2006
Posts: 47

PostPosted: Fri Mar 10, 2006 12:27 pm
Reply with quote

Hi SuperK,

After reading the content from this link, I've created job as shown below and executed it. But it did not executed the steps randomly.

Code:

//USERIDXX JOB (XXXXXX),'TEST JOB',                 
//             CLASS=J,                             
//             MSGCLASS=Y,                         
//             NOTIFY=&SYSUID                       
//*                                                 
//STEP0001 EXEC PGM=IEBEDIT                         
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1         
//SYSUT2   DD   SYSOUT=(*,INTRDR)                   
//SYSPRINT DD   SYSOUT=*                           
//SYSIN    DD   *                                   
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0002   
/*                                                 
//STEP0002 EXEC PGM=IEBEDIT                         
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1         
//SYSUT2   DD   SYSOUT=(*,INTRDR)                   
//SYSPRINT DD   SYSOUT=*                           
//SYSIN    DD   *                                   
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0001   
/*                                               
//STEP0003 EXEC PGM=IEBEDIT                       
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1       
//SYSUT2   DD   SYSOUT=(*,INTRDR)                 
//SYSPRINT DD   SYSOUT=*                         
//SYSIN    DD   *                                 
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0004
/*                                               
//STEP0004 EXEC PGM=IEBEDIT                       
//SYSUT1   DD   DISP=SHR,DSN=&SYSUID..JOB1       
//SYSUT2   DD   SYSOUT=(*,INTRDR)                 
//SYSPRINT DD   SYSOUT=*                         
//SYSIN    DD   *                                 
  EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0003
/*                                               
//                                               


And, in the &SYSUID..JOB1 (USERIDXX.JOB1) dataset I put the following content.

Code:

//USERIDXX JOB (XXXXXX),'TEST JOB',
//             CLASS=J,             
//             MSGCLASS=Y,         
//             NOTIFY=&SYSUID       
//*                                 
//STEP0001 EXEC PGM=IEFBR14         
//*                                 
//STEP0002 EXEC PGM=IEFBR14         
//*                                 
//STEP0003 EXEC PGM=IEFBR14         
//*                                 
//STEP0004 EXEC PGM=IEFBR14         
//*                                 
//STEP0005 EXEC PGM=IEFBR14         
//*                                 


The spool has shown the following:

Code:

                IEBEDIT LISTING                   
   EDIT START=JOB1,TYPE=POSITION,STEPNAME=STEP0002
 IEB022I  JOB NAME NOT FOUND BEFORE END OF FILE   
 IEB024I  4 WAS HIGHEST SEVERITY CODE             


Please help me in understanding this.

Thanks a lot.
Back to top
View user's profile Send private message
Thiruppathi

New User


Joined: 12 Mar 2006
Posts: 2
Location: memphis,TN, USA

PostPosted: Sun Mar 12, 2006 7:19 pm
Reply with quote

you can code step1 step3 step4 and step2 in JCl
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Mon Mar 13, 2006 3:05 pm
Reply with quote

hy,

dneufarth is very right,
use the most easiest way to find a solution.
thanks for your experience.

martin9
Back to top
View user's profile Send private message
sudheer_kumar

New User


Joined: 27 Dec 2005
Posts: 16

PostPosted: Mon Mar 13, 2006 6:07 pm
Reply with quote

Sample JCL for random execution of Steps
************************************

//JOBNAME JOB (T,DH,STK),' '
//ISTEP1 EXEC PGM=IEBEDIT
//SYSUT1 DD DSN=WORK.SOURCE(IEBE2JOB),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
EDIT START=TIEBEDJ,TYPE=INCLUDE,STEPNAME=STEP2,STEP1,STEP4,STEP3
//

Contents of 'WORK.SOURCE(IEBE2JOB)' were as follows:
****************************************************

//TIEBEDJ JOB (T,FA,STK),....
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DUMMY
//STEP2 EXEC PGM=IEFBR14
//DD2 DD DUMMY
//STEP3 EXEC PGM=IEFBR14
//DD3 DD DUMMY
//STEP4 EXEC PGM=IEFBR14
//DD4 DD DUMMY
//STEP5 EXEC PGM=IEFBR14
//DD5 DD DUMMY
//
Back to top
View user's profile Send private message
pspreddy

New User


Joined: 14 Mar 2006
Posts: 24
Location: Chicago

PostPosted: Fri Mar 17, 2006 3:19 am
Reply with quote

Looking at this discussion, I tried different options with IEBEDIT
Below are my conclusions

1) We can not run steps in a random order using IEBEDIT but can be selective on the steps we need from other JCL's we call from the main JCL
i.e. Suppose you have two jobs A and B. If you call the second job(B) which has five steps and if we say like
TYPE=INCLUDE,STEPNAME=STEP2,STEP1,STEP4,STEP3 in the first Job =(A) then the order of step run will not be STEP2,STEP1,STEP4,STEP3 rather it will be STEP1,STEP2,STEP3,STEP4.
With the TYPE=INCLUDE statement we are only specifying the steps we need to include in the run and the order will be as it is in the second Job(B) that has these steps.

2) We can include steps from more than one Job including more than one EDIT statement, like
//SYSIN DD *
EDIT START=Job(B),TYPE=INCLUDE,STEPNAME=(STEP2,STEP1,STEP4)
EDIT START=Job(C),TYPE=INCLUDE,STEPNAME=(STEP8,STEP9,STEP6)
EDIT START=Job(D),TYPE=INCLUDE,STEPNAME=(STEP11,STEP14)
/*

3) When you say include more than one job like above, all the jobs will eventually be called and will be submitted for a run when you submit Job(A)

4) Another option for TYPE parameter above is TYPE=POSITION. When you say this, all the steps from the particuar step we mention in EDIT statement will be included for the run
Ex: EDIT START=Job(B),TYPE=POSITION,STEPNAME=STEP4
Suppose we have 5 steps in Job B. With the above statement ssteps 4 and 5 will be considered when Job B is called from Job A

5) I tried giving more than one step in TYPE=POSITION like below
EDIT START=Job(B),TYPE=POSITION,STEPNAME=(STEP4,STEP2,STEP3)
Job A returned a code of 4 and Job B went successfully with all the steps from step2 i.e step2, 3, 4 and 5 from Job B ran succesfully. But Job A returned a code of 4 saying invalid operand.
My conclusion here is that irrespective of any number of steps you give with TYPE=POSITION, all the steps from the versy first step mentioned in the EDIT list are considered and will run and the main Job will return a code of 4.
Please correct me if I'm wrong here.

Have a great weekend folks

Thanks
Shiva
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 17, 2006 5:56 pm
Reply with quote

thanks to dneufarth

he has experience and is very right.
if possible, make it as simple as possible,
or murphy might get you one day...
icon_smile.gif

martin9
Back to top
View user's profile Send private message
mf_user
Currently Banned

New User


Joined: 05 Jan 2006
Posts: 47

PostPosted: Sat Mar 18, 2006 10:28 am
Reply with quote

sudheer_kumar,

It did not work either.
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Wed Jul 12, 2006 7:52 pm
Reply with quote

dneufarth wrote:
Call me too curious, but has anyone actually ever had to run a job with the steps out of order or randomized other that restarting at a particular step?

This questions appears regularly on several MVS discussion boards and it sounds too much like an interview or classroom question.

I worked in a large insurance company IT shop as well as a large retailer IT shop and I never saw a production problem addressed by executing steps out of order. If a situation required unusual step order, a job was created containing them in the order required, placed in a special JOB library and operations notified that it was ready to execute.

Dave


I was thinking the same thing. And if a job is set up in such a way you'd want to run the steps randomly and out of order, most likely the steps aren't that closely relately and maybe the job could be broken up into smaller jobs and the schedule or the other jobs decide which to run next.
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Wed Jul 12, 2006 8:28 pm
Reply with quote

I haven't used those fancy tools like IEBEDIT but they look like they'll do for most of what these kinds of questions are asking to do.

I'm not claiming the following is better or should be used instead. Just posting to give ideas. These have been used for years. They have the advantage that you can use them even if you don't have access to the scheduler(they don't always just give that to everyone) and/or want to use them in a test environment in which you couldn't use a scheduler if you wanted to.

1. Use 2 condition codes. Say ODD and EVEN. Create a simple program that simple sets the condition code for ODD and EVEN. When you want to run the odd steps pass 1 to odd and 0 to even. This utility program is simple and just makes the condition code of the step = to whatever you made odd or even. Then in the cond parameter of each odd step you have to say something to the effect that if the CC of the utility step = the value of ODD, then do the step and vice versa for the even steps.

This method of using two condition codes will also enable you to start in a certain step and end in another. You could you CC1 to indicate the step you want to start in and CC2 to indicate the step you want to end in.

In this method you don't need to use RESTART.

2. Base the condition code of one step on the condition code of the previous so the odds don't run if the evens do. This can be tricky so you have to watch your condition codes. Or you can base the condition code of the rest of the job on just steps 1 and 2(2 has to be based on 1). For all of these you have to do a RESTART and start in either first odd or even step.

3. Since we're on the subject, another method I've seen used that I didn't like much at all was to base the restart on 'control datasets'. Basically, if the first REAL step in the job completed successfully, it creates a dataset conforming to conventions and having 'STEP010' in the desigated spot. This dataset is just and empty dataset made via iebgener using disp to keep it if the step finishes ok or delete it if not.

Then STEP020 creates a STEP020 dataset and deletes the STEP010 if it's successful or just leaves the STEP010 if not. Again just using iebgener and the disp parameter.

This continues all the way down until the last step of the job which doesn't create a control dataset but deletes the one from the previous step.

Then there is a utitlity that is the very first step in the job that looks for the existance of the control datasets and sets a condition code equal to the STEP part of the control dataset if one exists. Then each step in the job has a CC that says 'run me if my step is greater than the one that created that control dataset.

I don't recommend that method.
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 Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Fetch data from programs execute (dat... DB2 3
No new posts CA7 deleting files in steps after job... CA Products 4
No new posts Cobol program with sequence number ra... COBOL Programming 5
This topic is locked: you cannot edit posts or make replies. How To Write, Compile and Execute Cob... COBOL Programming 5
Search our Forums:

Back to Top