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


Tape-to-Disk Add—Direct Data Set

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

The example in Figure 1 involves adding records to the data set allocated in Figure 1.

Figure 1. Adding Records to a Direct Data Set
   //DIRADD  DD       DSNAME=SLATE.INDEX.WORDS,---
   //TAPEDD  DD       ---
             ...
   DIRECTAD  START
             ...
             OPEN     (DIRECT,(OUTPUT),TAPEIN)
   NEXTREC   GET      TAPEIN,KEY
             L        4,KEY            Set up relative record number
             SH       4,=H'1000'
             ST       4,REF
             WRITE    DECB,DA,DIRECT,DATA,'S',KEY,REF+1
             WAIT     ECB=DECB
             CLC      DECB+1(2),=X'0000'   Check for any errors
             BE       NEXTREC

Check error bits and take required action  

   DIRECT    DCB      DDNAME=DIRADD,DSORG=DA,RECFM=F,KEYLEN=4,BLKSIZE=200,   C
                 MACRF=(WA)
   TAPEIN    DCB      ---
   KEY       DS       F
   DATA      DS       CL200
   REF       DS       F
             ...

The write operation adds the key and the data record to the data set. If the existing record is not a dummy record, an indication is returned in the exception code of the DECB. For that reason, it is better to use the WAIT macro instead of the CHECK macro to test for errors or exceptional conditions.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014