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

Dynamic file allocation using JCL


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

New User


Joined: 03 Mar 2022
Posts: 3
Location: India

PostPosted: Thu Mar 03, 2022 4:18 pm
Reply with quote

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

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Mar 03, 2022 7:46 pm
Reply with quote

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

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Thu Mar 03, 2022 9:21 pm
Reply with quote

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

New User


Joined: 03 Mar 2022
Posts: 3
Location: India

PostPosted: Fri Mar 04, 2022 8:58 am
Reply with quote

Thanks, will try the options
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Fri Mar 04, 2022 12:47 pm
Reply with quote

A simple REXX or CSECT should do the trick. Could even combine all 3 steps into 1.
Back to top
View user's profile Send private message
ibmuserj

New User


Joined: 03 Mar 2022
Posts: 3
Location: India

PostPosted: Fri Mar 04, 2022 12:52 pm
Reply with quote

trying to achieve via jcl step - not too familiar with REXX
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Mar 04, 2022 5:58 pm
Reply with quote

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

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Fri Mar 04, 2022 6:21 pm
Reply with quote

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

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Fri Mar 04, 2022 7:01 pm
Reply with quote

oops, I meant CLIST. Been doing too much assembler lately.
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 Unable to interpret a hex value to De... COBOL Programming 7
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
Search our Forums:

Back to Top