Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Changing DSN in JCL during run time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Changing DSN in JCL during run time
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

Site Director


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

PostPosted: Sat Feb 14, 2009 11:53 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Feb 14, 2009 12:21 pm    Post subject:
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    Post subject:
Reply with quote

Hi,

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


icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Sat Feb 14, 2009 1:20 pm    Post subject: Reply to: Changing DSN in JCL during run time
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: 8593
Location: Back in jolly old England

PostPosted: Sat Feb 14, 2009 7:18 pm    Post subject:
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: 1239
Location: Richfield, MN, USA

PostPosted: Sun Feb 15, 2009 10:04 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1239
Location: Richfield, MN, USA

PostPosted: Mon Feb 16, 2009 10:14 am    Post subject:
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    Post subject:
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: 401
Location: Mumbai

PostPosted: Mon Feb 16, 2009 11:03 am    Post subject: Reply to: Changing DSN in JCL during run time
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
No new posts CICS transaction slow response time vasanthz All Other Mainframe Topics 1 Thu Jan 19, 2017 1:31 am
No new posts DD DUMMY & CPU TIME Nileshkul Testing & Performance analysis 16 Mon Dec 19, 2016 11:35 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us