HLASM Language Reference
HLASM Language Reference HLASM Language Reference
Lookahead MACRO &NAME MOVE &TO,&FROM Statement 1 &NAME ST 2,SAVEAREA Statement 2 L 2,&FROM ST 2,&TO L 2,SAVEAREA MEND ------------------------------------------------------------------ .SYM MOVE FIELDA,FIELDB Statement 3 ------------------------------------------------------------------ + ST 2,SAVEAREA Statement 4 + L 2,FIELDB + ST 2,FIELDA + L 2,SAVEAREA The symbolic parameter &NAME is used in the name field of the prototype statement (Statement 1) and the first model statement (Statement 2). In the macro instruction (Statement 3), a sequence symbol (.SYM) corresponds to the symbolic parameter &NAME. &NAME is not replaced by .SYM and, therefore, the generated statement (Statement 4) does not contain an entry in the name field. Lookahead Symbol attributes are established in either definition mode or lookahead mode. Definition mode occurs whenever a previously undefined symbol is encountered in the name field of a statement, or in the operand field of an EXTRN or WXTRN statement during open code processing. Symbols within a macro definition are defined when the macro is expanded. Lookahead mode is entered: When the assembler processes a conditional assembly instruction and encounters an attribute reference (other than D' and O') to an ordinary symbol that is not yet defined. When the assembler encounters a forward AGO or AIF branch in open code to a sequence symbol that is not yet defined. Lookahead is a sequential, statement-by-statement, forward scan over the source text. If the attribute reference is made in a macro, forward scan begins with the first source statement following the outermost macro instruction. During lookahead the assembler: Bypasses macro definition and generation Does not generate object text Does not perform open-code variable substitution Ignores AIF and AGO branch instructions Establishes interim data attributes for undefined symbols it encounters in operand fields of instructions. The data attributes are replaced when a symbol is subsequently encountered in definition mode. Lookahead mode ends when the desired symbol or sequence symbol is found, or when the END statement or end of file is reached. All statements read by 340 HLASM V1R5 Language Reference
Lookahead lookahead are saved on an internal file, and are fully processed when the lookahead scan ends. If a COPY instruction is encountered during lookahead, it is fully processed at that time, the assembler copies the statements from the library, scans them, and saves them on the lookahead file. When lookahead mode has ended any COPY instructions saved to the lookahead file are ignored, as the statements from the copy member have already been read and saved to the lookahead file. If a variable symbol is used for the member name of a COPY that is expanded during lookahead, the value of the variable symbol at the time the COPY is expanded is used. For purposes of attribute definition, a symbol is considered partially defined if it depends in any way upon a symbol not yet defined. For example, if the symbol is defined by a forward EQU that is not yet resolved, that symbol is assigned a type attribute of U. In this case, it is quite possible that, by the end of the assembly, the type attribute has changed to some other value. Generating END statements: Because no variable symbol substitution is carried out during lookahead, you should consider the following effects of using macro, AINSERT or open code substitution to generate END statements that separate source modules assembled in one job step (BATCH assembler option). If a symbol is undefined within a module, lookahead might read statements past the point where the END statement is to be generated. Lookahead stops when: 1. It finds the symbol 2. It finds an END statement 3. It reaches the end of the source input data set In the first two cases, the assembler begins the next module at the statement after lookahead stopped, which could be after the point where you wanted to generate the END statement. Lookahead Restrictions The assembler analyzes the statements it processes during lookahead, only to establish attributes of symbols in their name fields. Variable symbols are not replaced. Modifier expressions are evaluated only if all symbols involved were defined prior to lookahead. Possible multiple or inconsistent definition of the same symbol is not diagnosed during lookahead because conditional assembly may eliminate one (or more) of the definitions. Lookahead does not check undefined operation codes against library macro names. If the name field contains an ordinary symbol and the operation code cannot be matched with one in the current operation code table, then the ordinary symbol is assigned the type attribute of M. If the operation code contains special characters or is a variable symbol, a type attribute of U is assumed. This may be wrong if the undefined operation code is later substituted with a known operation code or is later defined by OPSYN. OPSYN statements are not processed; thus, labels are treated in accordance with the operation code definitions in effect at the time of entry to lookahead. Chapter 9. How to Write Conditional Assembly Instructions 341
- Page 310 and 311: &SYSPUNCH_MEMBER System Variable Sy
- Page 312 and 313: &SYSSTEP System Variable Symbol Not
- Page 314 and 315: &SYSTERM_DSN System Variable Symbol
- Page 316 and 317: &SYSTIME System Variable Symbol Not
- Page 318 and 319: Macro Instruction Format sequence_s
- Page 320 and 321: Macro Instruction Format Operand En
- Page 322 and 323: Macro Instruction Format When you n
- Page 324 and 325: Sublists in Operands the order in w
- Page 326 and 327: Sublists in Operands &SYSLIST( n,m)
- Page 328 and 329: Values in Operands Notes: 1. Spaces
- Page 330 and 331: Values in Operands Parentheses In m
- Page 332 and 333: Inner and Outer Macro Instructions
- Page 334 and 335: Levels of Macro Call Nesting When t
- Page 336 and 337: Levels of Macro Call Nesting System
- Page 338 and 339: How to Write Conditional Assembly I
- Page 340 and 341: SET Symbols SET Symbol Specificatio
- Page 342 and 343: SET Symbols Figure 86 (Page 3 of 3)
- Page 344 and 345: Data Attributes this example indica
- Page 346 and 347: Data Attributes variable_symbol is
- Page 348 and 349: Data Attributes The value of an att
- Page 350 and 351: Data Attributes The following attri
- Page 352 and 353: Data Attributes Assembler gives a t
- Page 354 and 355: Data Attributes The scale attribute
- Page 356 and 357: Data Attributes Number Attribute (N
- Page 358 and 359: Data Attributes The operation code
- 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
Lookahead<br />
lookahead are saved on an internal file, and are fully processed when the<br />
lookahead scan ends.<br />
If a COPY instruction is encountered during lookahead, it is fully processed at that<br />
time, the assembler copies the statements from the library, scans them, and saves<br />
them on the lookahead file. When lookahead mode has ended any COPY<br />
instructions saved to the lookahead file are ignored, as the statements from the<br />
copy member have already been read and saved to the lookahead file.<br />
If a variable symbol is used for the member name of a COPY that is expanded<br />
during lookahead, the value of the variable symbol at the time the COPY is<br />
expanded is used.<br />
For purposes of attribute definition, a symbol is considered partially defined if it<br />
depends in any way upon a symbol not yet defined. For example, if the symbol is<br />
defined by a forward EQU that is not yet resolved, that symbol is assigned a type<br />
attribute of U.<br />
In this case, it is quite possible that, by the end of the assembly, the type attribute<br />
has changed to some other value.<br />
Generating END statements: Because no variable symbol substitution is carried<br />
out during lookahead, you should consider the following effects of using macro,<br />
AINSERT or open code substitution to generate END statements that separate<br />
source modules assembled in one job step (BATCH assembler option). If a symbol<br />
is undefined within a module, lookahead might read statements past the point<br />
where the END statement is to be generated. Lookahead stops when:<br />
1. It finds the symbol<br />
2. It finds an END statement<br />
3. It reaches the end of the source input data set<br />
In the first two cases, the assembler begins the next module at the statement after<br />
lookahead stopped, which could be after the point where you wanted to generate<br />
the END statement.<br />
Lookahead Restrictions<br />
The assembler analyzes the statements it processes during lookahead, only to<br />
establish attributes of symbols in their name fields.<br />
Variable symbols are not replaced. Modifier expressions are evaluated only if all<br />
symbols involved were defined prior to lookahead. Possible multiple or inconsistent<br />
definition of the same symbol is not diagnosed during lookahead because<br />
conditional assembly may eliminate one (or more) of the definitions.<br />
Lookahead does not check undefined operation codes against library macro names.<br />
If the name field contains an ordinary symbol and the operation code cannot be<br />
matched with one in the current operation code table, then the ordinary symbol is<br />
assigned the type attribute of M. If the operation code contains special characters<br />
or is a variable symbol, a type attribute of U is assumed. This may be wrong if the<br />
undefined operation code is later substituted with a known operation code or is later<br />
defined by OPSYN. OPSYN statements are not processed; thus, labels are treated<br />
in accordance with the operation code definitions in effect at the time of entry to<br />
lookahead.<br />
Chapter 9. How to Write Conditional Assembly Instructions 341