Source stream input—AREAD

The AREAD assembler operation permits a macro to read a record directly from the source stream into a SETC variable symbol. The card image is assigned in the form of an 80-byte character string to the symbol specified in the name field of the instruction. Figure 1 shows how the instruction is used:

Figure 1. AREAD assembler operation

The assembler processes the instructions in Figure 1 as follows:

The macro instruction MAC ( 1 ) causes the macro MAC ( 2 ) to be called. When the AREAD instruction ( 3 ) is encountered, the next sequential record ( 4 ) following the macro instruction is read and assigned to the SETC symbol &S ( 5 ).

Repeated AREAD statements read successive records.

When macro instructions are nested, the records read by AREAD must always follow the outermost macro instruction regardless of the level of nesting in which the AREAD instruction is found.

If the macro instruction is found in code brought in by the COPY instruction (copy code), the records read by the AREAD instruction can also be in the copy code. If no more records exist in the copy code, subsequent records are read from the ordinary input stream.

Records that are read in by the AREAD instruction are not checked by the assembler. Therefore, no diagnostic is issued if your AREAD statements read records that are meant to be part of your source program. For example, if an AREAD statement is processed immediately before the END instruction, the END instruction is lost to the assembler.