Previous Topic: SyntaxNext Topic: UPDATE


Keywords

The following is a list of the valid keywords for the READ command. For detailed information regarding these keywords, see Keywords.

READ Examples

Example 1

The READ command and MOVE keyword used in this example initialize the output buffer with the default PADCHAR value and move the input records positions 50 – 149 to the first position of the output buffer. The WRITE keyword writes the output buffer to the ddname NEWMSTR. You can create a new record and format using multiple MOVE keywords.

READ,
  MOVE(CLEAR),
  MOVE(1,100,50),
  WRITE(NEWMSTR)

Example 2

The READ command and ACCUM keyword used in this example, total the packed field found in positions 5, 6, and 7 of the input file. It prints the total line header, Number of Dependents, and the total to the ddname SYSTOTAL. If SYSTOTAL is not allocated, the report is printed to SYSPRINT.

READ,
  ACCUM(5,3,P,'Number of Dependents')

Example 3

The READ command and the SELRECIF keywords used in this example extract the required data and write it to the files referenced by the WRITE keyword's ddname. The first SELRECIF moves the entire input record to the output buffer if it finds the string CT beginning at record position 63, and then writes the record to the data set that is referenced by the ddname CTMASTER. The second SELRECIF writes a record to the ddname MAMASTER if character 63 and 64 equal the string MA.

READ,
  MOVE(CLEAR),
SELRECIF(63,2,EQ,C'CT'),
    MOVE(1,0,1),
    WRITE(CTMASTER),
  SELRECIF(63,2,EQ,C'MA'),
    MOVE(1,0,1),
    WRITE(MAMASTER)