Macro input/output capability
The AREAD facility complements the PUNCH facility to provide macros with direct input/output
(I/O) capability. The total I/O capability of macros is as follows:
- Implied input:
- Parameter values and global SET symbol values that are passed to the macro
- Implied output:
- Generated statements passed to the assembler for later processing. See also the AINSERT operation below.
- Direct input:
- AREAD
- Direct output:
- MNOTE for printed messages; PUNCH for punched records
- Conditional I/O:
- SET symbol values provided by external functions, using the SETAF and SETCF conditional assembly instructions.
For example, you can use AREAD and PUNCH to write simple conversion
programs. The following macro interchanges the left and right halves
of records placed immediately after a macro instruction calling it.
End-of-input is indicated with the word FINISHED in the first columns
of the last record in the input to the macro.
Name Operation Operand
MACRO
SWAP
.loop ANOP
&CARD AREAD
AIF ('&CARD'(1,8) EQ 'FINISHED').MEND
&CARD SETC '&CARD'(41,40).'&CARD'(1,40)
PUNCH '&CARD'
AGO .LOOP
.MEND MEND