Reputation: 2440
I want to create some Rexx code that allows me to allocate new data sets, in any format, such as PDS, Sequential etc.. by reading the data set information of an existing data set then applying those parameters to the new allocation.
For example, when I enter in a data set name in 3.2 and press enter I am provided with this information:
Data Set Name . . . . : HLQ.ETE.CNTL
General Data Current Allocation
Management class . . : MC000101 Allocated blocks . : 6
Storage class . . . : SC002020 Allocated extents . : 1
Volume serial . . . : VOL007 Maximum dir. blocks : 11
Device type . . . . : 3390
Data class . . . . . : None
Organization . . . : PO Current Utilization
Record format . . . : FB Used blocks . . . . : 5
Record length . . . : 80 Used extents . . . : 1
Block size . . . . : 27920 Used dir. blocks . : 6
1st extent blocks . : 6 Number of members . : 35
Secondary blocks . : 2
Data set name type : PDS Dates
Creation date . . . : 2014/04/02
Referenced date . . : 2014/07/01
Expiration date . . : ***None***
So in my Rexx I would like to do two things:
Read an existing data sets allocation parameters like those shown above
Allocate a new data set using the read in parameters
I would run this Rexx as part of a JCL batch job.
I would appreciate any assistance with this as I have researched for days and cannot see a way to do this.
Upvotes: 1
Views: 2587
Reputation: 10543
If running under ISPF, the SPF command DSINFO is easier to use as it setups variables for you.
If running under TSO, Kenny's answer of ListDsi is correct.
For ISPF DSINFO you would do (where the variable holds the dsname):
Address ispexec 'DSINFO DATASET('dsname')'
say 'dsn=' dsname
say 'volume=' ZDSVOL
say 'recfm=' ZDSRF
.....
Upvotes: 3
Reputation: 654
However, depending on what you're doing, I'd also point you to the DD LIKE parameter (for SMS managed datasets), or the DCB= option, for non-SMS managed datasets. See http://pic.dhe.ibm.com/infocenter/zos/v1r11/topic/com.ibm.zos.r11.ieab600/xddlike.htm and http://pic.dhe.ibm.com/infocenter/zos/v1r11/topic/com.ibm.zos.r11.ieab600/iea2b690169.htm#dcbdsn for documentation.
Instead of writing your own REXX to go through and do this, why not take advantage of built in tools? Especially since you say you'll be running this in batch anyway?
Upvotes: 2
Reputation:
You need to look at the TSO function LISTDSI. That will give you everything you need. http://pic.dhe.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.ikjb800/listdsi.htm
Upvotes: 2