z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Retrieving a Member of a PDSE

z/OS DFSMS Using Data Sets
SC23-6855-00

To retrieve a specific member from a PDSE, use either BSAM or QSAM as follows:

  1. Code DSORG=PS in the DCB macro.
  2. Specify in the DD statement that the data is a member of an existing PDSE by coding DSNAME=name(membername) and DISP=OLD.
  3. Process the member with an OPEN macro, a series of GET or READ macros, and the CLOSE macro.

Figure 1 gives an example of retrieving a member of a PDSE.

Figure 1. Retrieving One Member of a PDSE
   //PDSEDD DD    ---,DSN=MASTFILE(MEMBERK),DISP=OLD
            ...
            OPEN  (INDCB)            Open for input, automatic FIND
            ...
            GET   INDCB,INAREA       Read member record
            ...
            CLOSE (INDCB)
            ...
   INAREA   DS    CL80               Area to read into
   INDCB    DCB   ---,DSORG=PS,DDNAME=PDSEDD,MACRF=GM

When your program is run, OPEN searches the directory automatically and positions the DCB to the member.

To retrieve several PDSE or PDS members without closing and reopening the data set, use this procedure or the procedure shown in Figure 3:

  1. Code DSORG=PO in the DCB macro.
  2. Specify the name of the PDSE in the DD statement by coding DSNAME=name.
  3. Issue the BLDL macro to get the list of member entries you need from the directory.
  4. Repeat the following steps for each member to be retrieved.
    1. Use the FIND or POINT macro to prepare for reading the member records. If you use the POINT macro, it will not work in a partitioned concatenation.
    2. The records can be read from the beginning of the member. If you want to read out of sequential order, use the POINT macro to point to records within the member.
    3. Read and check the records until all those required have been processed.
    4. Your end-of-data-set (EODAD) routine receives control at the end of each member. At that time, you can process the next member or close the data set.

To read randomly within a member, use the POINT macro.

Figure 2 shows the technique for processing several members without closing and reopening. Figure 3 shows a variation of retrieving members. It gives better performance with a PDS or a concatenation of PDSs and PDSEs.

Figure 2. Retrieving Several Members of a PDSE or PDS
//PDSEDD DD    ---,DSN=D42.MASTFILE,DISP=SHR
         ...
         OPEN  (INDCB)               Open for input, no automatic FIND
         ...
         BLDL  INDCB,BLDLLIST        Retrieve the relative disk locations
*                                    of several user-supplied names in
*                                    virtual storage.
         LA    BLDLREG,BLDLLIST+4    Point to the first entry in the list
         ...
Begin a "MEMBER", possibly in another concatenated data set
         MVC   TTRN(4),8(BLDLREG)     Get relative disk address of member
         FIND  INDCB,TTRN,C           Point to the member
         ...
         READ  DECBX,SF,INDCB,INAREA  Read a block of the member
         CHECK DECBX                  Wait for completion of READ

         ...                          READ and CHECK additional blocks
EODRTN   EQU   *                      EOD routine label

         AH    BLDLREG,BLDLLIST+2     Move to next member entry
Repeat from label "MEMBER" for each additional member:
         ...
         CLOSE (INDCB)
         ...

INAREA   DS    CL80
INDCB    DCB   ---,DSORG=PO,DDNAME=PDSEDD,MACRF=R,EODAD=EODRTN
TTRN     DS    F                 TTRN of the start of the member
BLDLREG  EQU   5                 Register to address BLDL list entries
BLDLLIST DS    0F                List of member names for BLDL
         DC    H'10'             Number of entries (10 for example)
         DC    H'14'             Number of bytes per entry
         DC    CL8'MEMBERA'      Name of member, supplied by user
         DS    CL3               TTR of first record (set by BLDL)
*                                The following 3 fields are set by BLDL
         DS    X                 K byte, concatenation number
         DS    X                 Z byte, location code
         DS    X                 C byte, flag and user data length
         ...                     one list entry per member (14 bytes each)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014