AGO instruction

The AGO instruction branches unconditionally. You can thus alter the sequence in which your assembler language statements are processed. This provides you with final exits from conditional assembly loops.

Read syntax diagramSkip visual syntax diagram>>-+-----------------+--AGO--sequence_symbol-------------------><
   '-sequence_symbol-'                        
 
sequence_symbol
is a sequence symbol.

The statement named by the sequence symbol in the operand field is the next statement processed by the assembler.

The statement identified by a sequence symbol referred to in the AGO instruction can appear before or after the AGO instruction. However, the statement must appear within the local scope of the sequence symbol. Thus, the statement identified by the sequence symbol must appear:

Example:

         MACRO
&NAME    MOVE            &T,&F
         AIF             (T'&T EQ 'F').FIRST     Statement 1
         AGO             .END                    Statement 2
.FIRST   AIF             (T'&T NE T'&F).END      Statement 3
&NAME    ST              2,SAVEAREA
         L               2,&F
         ST              2,&T
         L               2,SAVEAREA
.END     MEND                                    Statement 4

Statement 1 determines if the type attribute of the first macro instruction operand is the letter F. If the type attribute is the letter F, Statement 3 is the next statement processed by the assembler. If the type attribute is not the letter F, Statement 2 is the next statement processed by the assembler.

Statement 2 indicates to the assembler that the next statement to be processed is Statement 4 (the statement named by sequence symbol .END).

Computed AGO instruction

The computed AGO instruction makes branches according to the value of an arithmetic expression specified in the operand.

Read syntax diagramSkip visual syntax diagram>>-+-----------------+--AGO------------------------------------->
   '-sequence_symbol-'       
 
                           .-,---------------.  
                           V                 |  
>--(arithmetic_expression)---sequence_symbol-+-----------------><
 
sequence_symbol
is a sequence symbol.
arithmetic_expression
is an arithmetic expression the assembler evaluates to k, where k lies between 1 and n (the number of occurrences of sequence_symbol in the operand field) inclusive. The assembler branches to the k-th sequence symbol in the list. If k is outside that range, no branch is taken.

In the following example, control passes to the statement at .THIRD if &I= 3. Control passes through to the statement following the AGO if &I is less than 1 or greater than 4.

                                                               Cont.
         AGO             (&I).FIRST,.SECOND,                     X
                         .THIRD,.FOURTH

Alternative format for AGO instruction

The alternative statement format is allowed for computed AGO instructions. The above example could be coded as follows:

                                                               Cont.
         AGO             (&I).FIRST,                             X
                         .SECOND,                                X
                         .THIRD,                                 X
                         .FOURTH

AGOB--synonym of the AGO instruction

For compatibility with some earlier assemblers, High Level Assembler supports the AGOB symbolic operation code as a synonym of the AGO instruction. However, you should not use the AGOB instruction in new applications as support for it might be removed in the future.


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