Read PDS Directory
The partitioned data set (PDS) on IBM mainframe allows one data set to contain hundreds of members. Each member contains data and is a file. A PDS contains its own internal directory that is readable by TSO utilities(ISPF). This web site show the technique to read the PDS directory. This directory contains for each member its name, size, creation size, creation date, last updated date and last updated time.
This information is valuable in the TSO environment for editing members and can be used in SAS batch jobs. My primary use of the PDS directory information is to transfer code and data between PDS members and P/C directory files. Maintaining the data set name as the P/C directory name and the PDS member name as the file name allows for easy transition between P/C and Mainframe. This technique allows me to easly maintain a single version of code in a multiple MVS system environment.
MVS has many ways to scan PDS and make changes but all utilities have limitations. Using SAS to scan and change strings extends the capability. I was successful using a SAS batch job to scan for the last updated version of a member on several data sets.
The member information is accurate since it is obtain from the PDS's own directory. Using the SAS INFILE statement with RECFM=U LRECL=256 and BLKSIZE=256 is a technique to obtain information about a PDS.
The following steps accomplish the transfer from PDS to P/C:
- With SAS, copy each PDS member to a single flat file
- Transfer the flat file to UNIX or P/C using FTP or RUMBA.
- With VBA or P/C SAS macro create a P/C directory from transfered file.
The following steps accomplish the transfer from P/C to PDS:
- Transfer the P/C file to the mainframe using FTP or RUMBA.
- With SAS create a PDS from the transfered file.
The SAS Fifth Dimension Macros contain the code to easly maintain a single version of code in a multiple MVS system environment.
The Read PDS Directory Technique
DATA PDSREAD( KEEP = MEMBER ) ; INFILE DDN RECFM=U LRECL = 256 BLKSIZE = 256 MISSOVER ; COL = 3 ; INPUT COUNT PIB2. @ ; IF COUNT < 14 THEN STOP ; LOOP:INPUT @COL MEMBER $8. @COL+11 IND PIB1 ; IF 'Z9999999' < MEMBER THEN STOP ; IF MEMBER = '99999999' THEN STOP ; COL = COL + 12 + 2 * MOD(IND,32) ; OUTPUT ; IF COL < COUNT THEN GO TO LOOP ;
Creation date, changed date, original size and latest size are also on the PDS directory.