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.
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
.....