Use either the QSAM or the BSAM to store and retrieve the records of a sequential data set. To create a sequential data set on magnetic tape or DASD, take the following actions:
OPEN (INDATA,,OUTDATA,(OUTPUT))
NEXTREC GET INDATA,WORKAREA Move mode
AP NUMBER,=P'1'
UNPK COUNT,NUMBER Record count adds 6
OI COUNT+5,X'F0' Set zone bits
PUT OUTDATA,COUNT bytes to each record
B NEXTREC
ENDJOB CLOSE (INDATA,,OUTDATA)
...
COUNT DS CL6
WORKAREA DS CL50
NUMBER DC PL4'0'
SAVE14 DS F
INDATA DCB DDNAME=INPUTDD,DSORG=PS,MACRF=(GM),EODAD=ENDJOB, X
LRECL=50,RECFM=FB
OUTDATA DCB DDNAME=OUTPUTDD,DSORG=PS,MACRF=(PM), X
LRECL=56,RECFM=FB
...
If the record length (LRECL) does not change during processing, but only one move is necessary, you can process the record in the input buffer segment. A GET-locate provides a pointer to the current segment.
Related reading: See QSAM in an Application for more information.