AINSERT instruction

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:
While inserted records may be placed at either end of the buffer queue, the records are removed only from the front of the buffer queue.
Read syntax diagramSkip visual syntax diagram>>-+-----------------+--AINSERT--'record'--+-,BACK--+----------><
   '-sequence_symbol-'                     '-,FRONT-'  
 
sequence_symbol
is a sequence symbol.
record
is the record stored in the internal buffer. It may be any characters enclosed in single quotation marks.

The rules that apply to this character string are:

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:
  1. 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.
  2. The assembler does not check the sequence field of the stored records, even when the ISEQ instruction is active.
  3. 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.


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