READ

Restriction: This topic applies to Windows environments only.

[label] READ decb

,SF|SB

,dcb-address

,area-address

[,length|'S']

Parameters

decb
Label to use for generated data event control block.
dcb-address
Address of DCB for file to read.
area-address
Address of buffer to receive data.
length|'S'
Number of bytes to transfer or 'S' to indicate entire block should be read (default). The single quote marks around the S are required.

The format of the data event control block is as follows:

Bytes Contains
0-3 Full word of zeroes.
4 Type flag: x'80' if 'S' parameter used in macro else x'00'.
5 Subtype flag: always x'20'.
6 - 7 Two-byte binary field set to value of the length parameter unless 'S' specified or register notation used in which case the field will be set to 0.
8 - 11 Address of DCB.
12 - 15 Address of area to receive data.

Comments

Causes one block of a BSAM file to be transferred from a file to a buffer in memory. The user program is responsible for any deblocking or other processing that may be required if the block contains more than one logical record.

The data event control block (DECB) generated by the macro is mainframe-compatible, however, each READ operation is synchronous, that is, control is not returned to the calling program until the operation is complete.

Input/output parameter blocks are not generated or used.

Examples

Example 1:

QREAD READ INDECB,SF,INFILE,INBUF,'S'

This example reads one entire block from file identified by the open DCB at INFILE into a buffer identified by INBUF.

Example 2:

READ RDECB5,SF,(*,FILEADDR),(3)

This example reads one block from DCB identified by the indirect S type address constant (*,FILEADDR) into the buffer whose address is held in register 3.