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:
- Code DSORG=PS or PSU in the DCB macro.
- Do one of the following:
- Code a DD statement to describe the data set. See z/OS MVS JCL Reference.
If SMS is implemented on your system, you can specify a data class
in the DD statement or have the ACS routines assign a data class.
- Create the data set using the TSO or access method services ALLOCATE
command. See z/OS DFSMS Access Method Services Commands. If SMS is implemented on your system,
you can specify the DATACLAS parameter or have the ACS routine assign
a data class.
- Call dynamic allocation (SVC 99) from your program. See z/OS MVS Programming: Authorized Assembler Services Guide.
If SMS is implemented on your system, you can specify the data class
text unit or have the ACS routines assign a data class.
- Optionally, use a data class to simplify and standardize data
attributes. You can take advantage of a data class for data sets that
are system managed or not system managed.
- Process the data set with an OPEN macro (the data set is opened
for OUTPUT, OUTIN, OUTINX, or EXTEND), a series of PUT or WRITE and
CHECK macros, and the CLOSE macro.
The example in
Figure 1 shows that the GET-move and
PUT-move require two movements of the data records.
Figure 1. Creating a Sequential Data Set—Move Mode, Simple Buffering 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.