View previous topic :: View next topic
|
Author |
Message |
ibmuserj
New User
Joined: 03 Mar 2022 Posts: 3 Location: India
|
|
|
|
Need help. Requirement is to get file name from card input and dynamically allocate in the next step in same JCL. File name contain last month and year as part of name. Possible to perform dynamic file allocation in STEP2? Please advise, Thanks
STEP1: Get last month and year based on run date & append to file name (eg; XXX.TEST.FEB2022). Write the file name to a temporary file
STEP2: Allocate above file. Get file name from card input or temporary file and then allocate
STEP3: Execute program with output written to XXX.TEST.FEB2022 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
ibmuserj wrote: |
Need help. Requirement is to get file name from card input and dynamically allocate in the next step in same JCL. File name contain last month and year as part of name. Possible to perform dynamic file allocation in STEP2? Please advise, Thanks
STEP1: Get last month and year based on run date & append to file name (eg; XXX.TEST.FEB2022). Write the file name to a temporary file
STEP2: Allocate above file. Get file name from card input or temporary file and then allocate
STEP3: Execute program with output written to XXX.TEST.FEB2022 |
1. All this plan is very similar to the flight from Washington to New York, with transfer on the Moon. There is absolutely no need to store any dataset name (NOT! file name) in any temporary dataset (not FILE!). Otherwise it makes all further operations even more complicated.
2. I do not not think it is extremely critical to use the name of the month, instead of its number, as part of DSNAME, isn't it?
3. What JCL does (as the major part of its functionality) is, allocation and re-allocation of datasets (not files); there is no need to call it "dynamic allocation". There is nothing dynamic in this operation.
Code: |
//NEWDSN DD DISP=(NEW,CATLG),
// . . . . . . .
// DSNAME=XXX.TEST.D&MON&YEAR
//* or DSN=XXX.TEST.D&YEAR&MON - for better name list sorting |
That's it. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
One possibility would be to generate DFSORT/SYNCSORT SYMNAMES using the input dataset and system symbols. A first step would build the SYMNAMES to be used in the second step. The second step would then dynamically generate the JCL containing the dataset name and, optionally, submit the generated JCL.
Garry. |
|
Back to top |
|
|
ibmuserj
New User
Joined: 03 Mar 2022 Posts: 3 Location: India
|
|
|
|
Thanks, will try the options |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 734 Location: Denmark
|
|
|
|
A simple REXX or CSECT should do the trick. Could even combine all 3 steps into 1. |
|
Back to top |
|
|
ibmuserj
New User
Joined: 03 Mar 2022 Posts: 3 Location: India
|
|
|
|
trying to achieve via jcl step - not too familiar with REXX |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Welcome!
Have you searched before posting ? I am sure similar topic has been discussed several times in past , please use SEARCH option on the top to get closest post and tweak to get it work and that is one of the reason why historical posts are preserved.
E.g ibmmainframes.com/about52338.html |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Willy Jensen wrote: |
A simple REXX or CSECT should do the trick. Could even combine all 3 steps into 1. |
How a CSECT could do the trick, or whatever else, at all?
CSECT stands for "Control Section" - this is a physical part of any object module created by any compiler from any language, when running in zOS environment. One even can't create it manually! |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 734 Location: Denmark
|
|
|
|
oops, I meant CLIST. Been doing too much assembler lately. |
|
Back to top |
|
|
|