AREAD instruction

The AREAD instruction assigns an arbitrary character string value to a SETC symbol.

The AREAD instruction has two formats. The first format lets you assign to a SETC symbol the character string value of a statement that is placed immediately after a macro instruction.

The AREAD instruction can only be used inside macro definitions.

Assign character string value
Read syntax diagramSkip visual syntax diagram>>-SETC_symbol--AREAD--+---------+-----------------------------><
                       +-NOPRINT-+  
                       '-NOSTMT--'  
 

The second format of the AREAD instruction assigns to a SETC symbol a character string containing the local time.

Assign local time
Read syntax diagramSkip visual syntax diagram>>-SETC_symbol--AREAD--+-CLOCKB-+------------------------------><
                       '-CLOCKD-'  
 
SETC_symbol
is a SETC symbol. See SETC instruction.
NOSTMT
specifies that the statement to be read by the AREAD instruction is printed in the assembly listing, but not given any statement number.
NOPRINT
specifies that the statement does not appear in the listing, and no statement number is assigned to it.
CLOCKB
assigns an 8-character string to SETC_symbol containing the local time in hundredths of a second since midnight.
CLOCKD
assigns an 8-character string to SETC_symbol containing the local time in the format HHMMSSTH, where HH is a value between 00 and 23, MM and SS each have a value between 00 and 59, and TH has a value between 00 and 99.

Assign character string value

The first format of AREAD functions in much the same way as symbolic parameters, but instead of providing your input to macro processing as part of the macro instruction, you can supply full input records from either the AINSERT buffer (if any are present), or from the records in the primary input stream that follow immediately after the macro instruction. Any number of successive records can be read into the macro for processing. If no records remain, a null value is assigned, but no diagnostic message is issued.

SETC_symbol may be subscripted. When the assembler encounters a Format-1 AREAD statement during the processing of a macro instruction, it reads the source record following the macro instruction and assigns an 80-character string to the SETC symbol in the name field. In the case of nested macros, it reads the record following the outermost macro instruction.

If no operand is specified, the record to be read by AREAD is printed in the listing and assigned a statement number. The AREAD action is indicated in the listing by a minus sign between the statement number and the first character of the record.

Repeated AREAD instruction statements read successive records. In the following example, the input record starting with INRECORD1 is read by the first AREAD statement, and assigned to the SETC symbol &VAL. The input record starting with INRECORD2 is read by the second AREAD statement, and assigned to the SETC symbol &VAL1.

Example:

         MACRO
         MAC1
         .
&VAL     AREAD
         .
&VAL1    AREAD
         .
         MEND
         CSECT
         .
         MAC1
INRECORD1 THIS IS THE STATEMENT TO BE PROCESSED FIRST
INRECORD2 THIS IS THE NEXT STATEMENT
         .
         END

The records read by the AREAD instruction can be in code brought in with the COPY instruction, if the macro instruction appears in such code. If no more records exist in the code brought in by the COPY instruction, subsequent records are read from the AINSERT buffer or the primary input stream.

Assign local time of day

The second format of AREAD functions in much the same way as a SETC instruction, but instead of supplying the value you want assigned to the SETC symbol as a character string in the operand of the AREAD instruction, the value is provided by the operating system in the form of an 8-character string containing the local time. A Format-2 AREAD instruction does not cause the assembler to read the statement following the macro instruction.

Example:

         MACRO
         MAC2
         .
&VAL     AREAD CLOCKB
         DC    C'&VAL'
&VAL1    AREAD CLOCKD
         DC    C'&VAL1'
         .
         MEND

When the macro definition described above is called, the following statements are generated:

          MAC2
+         DC    C'03251400'
+         DC    C'09015400'

[ Top of Page | Previous Page | Next Page | Contents | Index ]