>>*  Case 1, symbol A is checked before definition:
>>         AIF   (T'A EQ 'F').SKIP
>>A        DC    F'42'
>>.SKIP    ANOP
>>
>>*  Case 2, same as Case 1, but X is undefined:
>>         AIF   (T'X EQ 'F').SKIP2
>>A        DC    F'42'
>>.SKIP2   ANOP

>>Results:
>>Case 1, nothing was created and no (error) messages;
>>Case 2, symbol A was assembled as a fullword without error even though
>>X is undefined.

This is working correctly.  Keep in mind that each different version of
the assembler has redesigned / changed the assembly language, especially
assembler H and after which have lookahead.

Looking at the High Level Assembler for z/OS & z/VM & z/VSE Language
Reference Version 1 Release 6 (SC26-4940-08) on Lookahead in Chapter 9
How to write conditional assembly instructions.

  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
  * Ignores the record following a REPRO statement
  * Establishes interim data attributes for undefined symbols it
    encounters in operand fields of instructions. The data attributes
    are replaced when a symbol is 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 lookahead are saved on an internal file, and are fully processed
  when the lookahead scan ends.

Case 1:
  The attribute reference to A isn't known so lookahead is entered.
Lookahead finds the next statement which provides the attribute reference
of A so the AIF can evaluate to true.  Now the .skip is unknown and
Lookahead is again entered (starting with the .skip line since the
prevous line was already scanned by lookahead).  Now that the AIF target
has been found the AIF can happen (and the DC F doesn't get assembled).

Case 2:
  The attribute reference to X isn't known so lookahead is entered.
Lookahead processes all the statements to the end of input looking for
X and doesn't find any definition so T'X evaluates to 'U'.  This doesn't
match 'F' and the AIF to evaluate to false.  Assembly proceeds, assembling
the F'42", no errors.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to