WRITE—Write a block (create a direct data set with BSAM)

The WRITE macro adds a block to the direct data set being created. For fixed-length blocks, the system writes the capacity record automatically when the current track is filled. For variable and undefined-length blocks, a WRITE macro must be issued for the capacity record. Control might be returned to the problem program before the block is written. The output operations must be tested for completion using a CHECK macro. A data event control block, shown in Status information following an input/output operation, is constructed as part of the macro expansion.

The standard form of the WRITE macro is written as follows (the list and execute forms are shown following the descriptions of the standard form):

decb name—symbol
specifies the name that is assigned to the data event control block that is created as part of the macro expansion.
type—{SF|SFR|SD|SZ}
is coded as shown, to specify the type of write operation performed by the system:
SF
specifies that a new data block is written in the data set.
SFR
specifies that a new variable-length spanned record is written in the data set, and next address feedback is requested.This parameter can be specified only for variable-length spanned records (BFTEK=R and RECFM=VS are specified in the data set control block). If type SFR is specified, the next address parameter must be included.
SD
specifies that a dummy data block is written in the data set. Dummy data blocks can be written only when fixed-length records with keys are used.
SZ
specifies that a capacity record (R0) is written in the data set. Capacity records can be written only when variable-length or undefined-length records are used.
dcb address—A-Type Address or (2-12)
specifies the address of the data control block opened for the data set being created. You must specify DSORG=PS (or PSU) and MACRF=WL in the DCB macro to create a direct data set.
area address—A-Type Address or (2-12)
specifies the address of the area containing the data block to be added to the data set. If keys are used, the key must precede the data in the same area. For writing capacity records (SZ), area address is ignored and can be omitted (the system supplies the information for the capacity record). For writing dummy data blocks (SD), the area need be only large enough to hold the key plus one data byte. The system constructs a dummy key with the first byte set to all 1 bits (hexadecimal FF) and adds the block number in the first byte following the key. When a dummy block is written, a complete block is written from the area immediately following the area address. Therefore, area address plus the value specified in BLKSIZE and KEYLEN must be within the area allocated to the program writing the dummy blocks.
length—symbol, decimal digit, absexp, (2-12), or 'S'
is used only when undefined-length (RECFM=U) blocks are being written. The parameter specifies the length of the block, in bytes, up to a maximum of 32760. If 'S' is coded, it specifies that the system uses the length in the block size (DCBBLKSI) field of the data control block as the length of the block to be written.

If length is omitted for format-U records, no error indication is given when the program is assembled, but the problem program must insert a length into the data event control block before the WRITE is issued.

next address—A-Type Address or (2-12)
specifies the address of the area where the system places the relative track address of the next record to be written. Next address feedback can be requested only when variable-length spanned records are used.
Using Variable-length Spanned Records: When variable-length spanned records are used (RECFM=VS and BFTEK=R are specified in the data control block), the system writes capacity records (R0) automatically in the following cases: