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


Retrieving a Sequential Data Set

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

To retrieve a sequential data set from magnetic tape, DASD, or other types of devices, take the following actions:

  1. Code DSORG=PS or PSU in the DCB macro.
  2. Tell the system where your data set is located (by coding a DD statement, or by calling dynamic allocation (TSO ALLOCATE command or SVC 99)).
  3. Process the data set with an OPEN macro (data set is opened for input, INOUT, RDBACK, or UPDAT), a series of GET or READ macros, and the CLOSE macro.

The example in Figure 1 is similar to that in Figure 1. However, because there is no change in the record length, the records can be processed in the input buffer. Only one move of each data record is required.

Related reading: See QSAM in an Application for more information.
Figure 1. Retrieving a Sequential Data Set—Locate Mode, Simple Buffering
          ....
          OPEN       (INDATA,,OUTDATA,(OUTPUT),ERRORDCB,(OUTPUT))
NEXTREC   GET        INDATA                 Locate mode
          LR         2,1                    Save pointer
          AP         NUMBER,=P'1'
          UNPK       0(6,2),NUMBER          Process in input area
          PUT        OUTDATA                Locate mode
          MVC        0(50,1),0(2)           Move record to output buffer
          B          NEXTREC
ENDJOB    CLOSE      (INDATA,,OUTDATA,,ERRORDCB)
          ...
NUMBER    DC         PL4'0'
INDATA    DCB        DDNAME=INPUTDD,DSORG=PS,MACRF=(GL),EODAD=ENDJOB
OUTDATA   DCB        DDNAME=OUTPUTDD,DSORG=PS,MACRF=(PL)
ERRORDCB  DCB        DDNAME=SYSOUTDD,DSORG=PS,MACRF=(PM),RECFM=V,         C
                     BLKSIZE=128,LRECL=124
SAVE2     DS         F
          ...

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014