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

Changing DSN in JCL during run time


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

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Sat Feb 14, 2009 11:41 am
Reply with quote

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 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 Feb 14, 2009 11:53 am
Reply with quote

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
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Sat Feb 14, 2009 11:58 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Feb 14, 2009 12:21 pm
Reply with quote

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
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Sat Feb 14, 2009 1:06 pm
Reply with quote

Hi,

Thankssss.I can use this........


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 Feb 14, 2009 1:20 pm
Reply with quote

You're welcome - good luck icon_smile.gif

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

Global Moderator


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

PostPosted: Sat Feb 14, 2009 7:18 pm
Reply with quote

Can I ask the reason for needing to change which DSN gets processed ?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Sun Feb 15, 2009 10:04 pm
Reply with 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.
Back to top
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Mon Feb 16, 2009 9:37 am
Reply with quote

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
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Mon Feb 16, 2009 9:47 am
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Mon Feb 16, 2009 10:14 am
Reply with 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.
Back to top
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Mon Feb 16, 2009 10:32 am
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Mon Feb 16, 2009 11:03 am
Reply with quote

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
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 To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts C Compile time time stamps Java & MQSeries 10
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts changing defaults in db2 admin - Unlo... DB2 0
Search our Forums:

Back to Top