The AINSERT instruction inserts records into the input stream.
These records are queued in an internal buffer until the macro generator
has completed expanding the current outermost macro instruction. At
that point the internal buffer queue provides the next record or records.
An operand controls the sequence of the records within the internal
buffer queue.
Note: You can place inserted records at either end of the buffer queue,
the records are removed only from the front of the buffer queue.
>>-+-----------------+--AINSERT--'record'--+-,BACK--+----------><
'-sequence_symbol-' '-,FRONT-'
- sequence_symbol
- Is a sequence symbol.
- record
- Is the record stored in the internal buffer. It can be any characters
enclosed in apostrophes.
The rules that apply to this character
string are:
- Variable symbols are allowed.
- The string can be up to 80 characters in length. If the string
is longer than 80 characters, only the first 80 characters are used,
the rest of the string is ignored.
- BACK
- The record is placed at the back of the internal buffer.
- FRONT
- The record is placed at the front of the internal buffer.
Notes: - The ICTL instruction does not affect the format of the stored
records. The assembler processes these records according to the standard
begin, end, and continue columns.
- The assembler does not check the sequence field of the stored
records, even when the ISEQ instruction is active.
- Continuation is ignored for the last record in the AINSERT buffer
but is active for all other records.
Example: MACRO
MAC1
.
.A AINSERT 'INSERT RECORD NUMBER ONE',FRONT Insert record into the input stream
.B AINSERT 'INSERT RECORD NUMBER TWO',FRONT Insert record at the top of the input stream
.C AINSERT 'INSERT RECORD NUMBER THREE',BACK Insert record at the bottom of the input stream
.
.
.
&FIRST AREAD Retrieve record TWO from the top of the input stream
.
.D AINSERT 'INSERT RECORD NUMBER FOUR',FRONT Insert record at the top of the input stream
.
&SECOND AREAD Retrieve record FOUR from the top of the input stream
.
MEND
CSECT
.
MAC1
.
END
In this example, the variable &FIRST receives the operand of
the AINSERT statement created at .B. &SECOND receives the operand
of the AINSERT statement created at .D. The operand of the AINSERT
statements at .A and .C are in the internal buffer in the sequence
.A followed by .C and are the next statements processed when the macro
generator has finished processing.