View previous topic :: View next topic
|
Author |
Message |
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Hi,
I have a requirement in which i need to change the DSN name in some steps in the JCL based on first step. For e.g.
Step 1 can have RC as 0 or 4.
In steps 2,4 and 6 the input DSN name should be AAA if RC of step1 is 0 else it should be BBB.
Can you please suggest me on this?
Thanks in advance |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One way to do what you want is to include steps 2, 4, and 6 in the job twice. One set of these would name dsn AAA, the other would name dsn BBB. Depending on the condition code of the first step, one set or the other would be conditoinally executed. |
|
Back to top |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Hi Dick,
Thanks for the suggestion. However the steps in my JCL are very long. Repeating the steps in my JCL would make the JCL a very long one. Can you please suggest some other way which could make this thing simple? If there is no other way then I would have to go ahead with this method itself.
Thanks again. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Andy,
Quote: |
In steps 2,4 and 6 the input DSN name should be AAA if RC of step1 is 0 else it should be BBB. . . |
Is adding 3 new steps such a large task? Are there more steps than originally mentioned?
Another way to do what you want is create 2 new jobs and a proc that uses a symbolic parameter for the aaa or bbb - one for the A run one for B. When step1 runs, the conditon code is set and the last part of job1 submits either the A job or the B job via the internal reader. The difference in the 2 is the symbolic parameter. The jcl for both is the same. |
|
Back to top |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Hi,
Thankssss.I can use this........
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Can I ask the reason for needing to change which DSN gets processed ? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
My guess would be that one data set gets processed if the input to the 1st step is either nonexistant or empty, otherwise a different data set gets processed. |
|
Back to top |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Quote: |
Can I ask the reason for needing to change which DSN gets processed ?
|
In my first step I have take input file containing some key values. Complete data for this key is present in the input file of next step. So if my first step's input file is empty then its an indication that I need to do processing for all key values and hence i will take file1 as input in step2. However, if my first step's input file is not empty then its an indication that I need to do processing for only those key values present in that input file. Hence I would be using that file2 as input in second shift since it contains data only for those few keys. |
|
Back to top |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Quote: |
My guess would be that one data set gets processed if the input to the 1st step is either nonexistant or empty, otherwise a different data set gets processed.
_________________
.... Terry
|
Can you please elaborate on this? Please note that the input file names are different. How it will pick up the different data set unless I mention it explicitly? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Now that we see what you are doing, I would define both data sets as OPTIONAL in your COBOL programs and based on the return code of the 1st step, process either all keys of one optional file or selected keys of the other optional file. The return code from step 1 is determined by the number of records in it. There are many examples here of how to do that if you search. |
|
Back to top |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
Quote: |
Now that we see what you are doing, I would define both data sets as OPTIONAL in your COBOL programs and based on the return code of the 1st step, process either all keys of one optional file or selected keys of the other optional file. The return code from step 1 is determined by the number of records in it. There are many examples here of how to do that if you search.
_________________
.... Terry
|
My steps 2 and 3 are not COBOL programs. They are SORT steps. So I wont be able to define them as OPTIONAL.So I would require some JCL trick for this thing. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
add a step that checks if the 1st output file is empty and have it set a return code for that. There are examples for that process around already -- do a search. Then based on that return code, run a step with the correct data sets allocated. Or run all or part of this from a clist or rexx program. That would be much easier and less error prone than doing all that JCL |
|
Back to top |
|
|
|