HLASM Language Reference
HLASM Language Reference HLASM Language Reference
AGO Instruction The extended AIF instruction is exactly equivalent to n successive AIF statements. The branch is taken to the first sequence symbol (scanning left to right) whose corresponding logical expression is true. If none of the logical expressions is true, no branch is taken. Example: Cont. AIF ('&L'(&C,1) EQ '$').DOLR, X ('&L'(&C,1) EQ '#').POUND, X ('&L'(&C,1) EQ '@').AT, X ('&L'(&C,1) EQ '=').EQUAL, X ('&L'(&C,1) EQ '(').LEFTPAR, X ('&L'(&C,1) EQ '+').PLUS, X ('&L'(&C,1) EQ '-').MINUS This statement looks for the occurrence of a $, #, @, =, (, +, and -, in that order; and causes control to branch to .DOLR, .POUND, .AT, .EQUAL, .LEFTPAR, .PLUS, and .MINUS, respectively, if the string being examined contains any of these characters at the position designated by &C. Alternative Format for AIF Instruction The alternative statement format is allowed for extended AIF instructions. This format is illustrated in the above example. AIFB—Synonym of the AIF Instruction For compatibility with some earlier assemblers, High Level Assembler supports the AIFB symbolic operation code as a synonym of the AIF instruction. However, you should not use the AIFB instruction in new applications as support for it might be removed in the future. 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. ►►──┬─────────────────┬──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: In open code, if the corresponding AGO instruction appears in open code In the same macro definition in which the corresponding AGO instruction appears. 392 HLASM V1R5 Language Reference
AGO Instruction 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. ►►──┬─────────────────┬──AGO────────────────────────────────────────► └─sequence_symbol─┘ ┌─,───────────────┐ ►──(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 Chapter 9. How to Write Conditional Assembly Instructions 393
- Page 362 and 363: Open Code Sequence Symbols The cond
- Page 364 and 365: GBLA, GBLB, and GBLC Instructions G
- Page 366 and 367: LCLA, LCLB, and LCLC Instructions s
- Page 368 and 369: SETA Instruction expression is an a
- Page 370 and 371: SETA Instruction | The logical-exp
- Page 372 and 373: SETA Instruction | Figure 99 (Page
- Page 374 and 375: SETA Instruction | The result of C2
- Page 376 and 377: SETA Instruction NOT Format: Logica
- Page 378 and 379: SETA Instruction | X2A Name Operati
- Page 380 and 381: SETA Instruction In evaluating the
- Page 382 and 383: SETB Instruction Any expression tha
- Page 384 and 385: SETB Instruction ┌─────
- Page 386 and 387: SETB Instruction | ISDEC | Format:
- Page 388 and 389: SETB Instruction The two comparands
- Page 390 and 391: SETC Instruction Notes: 1. The asse
- Page 392 and 393: Figure 103. Substring Notation in C
- Page 394 and 395: Loc Object Code Addr1 Addr2 Stmt So
- Page 396 and 397: | B2C('111111') has value '3' | B2C
- Page 398 and 399: | Output: D2B('decstring') converts
- Page 400 and 401: SIGNED Format: Logical-expression,
- Page 402 and 403: | X2D('') has value '+' | X2D('91')
- Page 404 and 405: Concatenation of strings containing
- Page 406 and 407: MACRO &NAME MOVE &TO,&FROM LCLC &PR
- Page 408 and 409: SETAF Instruction Alternative State
- Page 410 and 411: Branching Branching You can control
- Page 414 and 415: ACTR Instruction AGOB—Synonym of
- Page 416 and 417: ANOP Instruction statement processe
- Page 418 and 419: MHELP Instruction MHELP B'10000000'
- Page 420 and 421: 400 HLASM V1R5 Language Reference
- Page 422 and 423: Assembler Instructions and Statemen
- Page 424 and 425: Assembler Instructions and Statemen
- Page 426 and 427: Assembler Instructions and Statemen
- Page 428 and 429: Summary of Constants Figure 113. Su
- Page 430 and 431: Macro and Conditional Assembly Lang
- Page 432 and 433: Macro and Conditional Assembly Lang
- Page 434 and 435: Macro and Conditional Assembly Lang
- Page 436 and 437: Macro and Conditional Assembly Lang
- Page 438 and 439: Macro and Conditional Assembly Lang
- Page 440 and 441: Macro and Conditional Assembly Lang
- Page 442 and 443: Standard Character Set Code Table H
- Page 444 and 445: Standard Character Set Code Table H
- Page 446 and 447: Trademarks AIX BookMaster CICS DFSM
- Page 448 and 449: Bibliography SMP/E Reference, SC28-
- Page 450 and 451: Index A2C (SETC built-in function)
- Page 452 and 453: Index B B-type binary constant 141
- Page 454 and 455: Index conditional assembly instruct
- Page 456 and 457: Index elements of conditional assem
- Page 458 and 459: Index instructions (continued) asse
- Page 460 and 461: Index machine instruction statement
AGO Instruction<br />
Example:<br />
MACRO<br />
&NAME MOVE &T,&F<br />
AIF (T'&T EQ 'F').FIRST Statement 1<br />
AGO .END Statement 2<br />
.FIRST AIF (T'&T NE T'&F).END Statement 3<br />
&NAME ST 2,SAVEAREA<br />
L<br />
2,&F<br />
ST<br />
2,&T<br />
L<br />
2,SAVEAREA<br />
.END MEND Statement 4<br />
Statement 1 determines if the type attribute of the first macro instruction operand is<br />
the letter F. If the type attribute is the letter F, Statement 3 is the next statement<br />
processed by the assembler. If the type attribute is not the letter F, Statement 2 is<br />
the next statement processed by the assembler.<br />
Statement 2 indicates to the assembler that the next statement to be processed is<br />
Statement 4 (the statement named by sequence symbol .END).<br />
Computed AGO Instruction<br />
The computed AGO instruction makes branches according to the value of an<br />
arithmetic expression specified in the operand.<br />
►►──┬─────────────────┬──AGO────────────────────────────────────────►<br />
└─sequence_symbol─┘<br />
┌─,───────────────┐<br />
►──(arithmetic_expression)<br />
── ▼ ─sequence_symbol─┴─────────────────────►◄<br />
sequence_symbol<br />
is a sequence symbol.<br />
arithmetic_expression<br />
is an arithmetic expression the assembler evaluates to k, where k lies between<br />
1 and n (the number of occurrences of sequence_symbol in the operand field)<br />
inclusive. The assembler branches to the k-th sequence symbol in the list. If k<br />
is outside that range, no branch is taken.<br />
In the following example, control passes to the statement at .THIRD if &I= 3.<br />
Control passes through to the statement following the AGO if &I is less than 1 or<br />
greater than 4.<br />
Cont.<br />
AGO (&I).FIRST,.SECOND, X<br />
.THIRD,.FOURTH<br />
Alternative Format for AGO Instruction<br />
The alternative statement format is allowed for computed AGO instructions. The<br />
above example could be coded as follows:<br />
Cont.<br />
AGO (&I).FIRST, X<br />
.SECOND,<br />
X<br />
.THIRD,<br />
X<br />
.FOURTH<br />
Chapter 9. How to Write Conditional Assembly Instructions 393