Without in any way criticizing OP, who was just trying to solve a real problem, it's always illustrative to think of how powerful the macro language is! I'm continually appalled by how weak C macros are, to the point that I generally avoid them because every time I try to use one, I get irritated by its lack of functionality.
-----Original Message----- From: IBM Mainframe Assembler List <[email protected]> On Behalf Of Jonathan Scott Sent: Tuesday, February 17, 2026 4:12 PM To: [email protected] Subject: Re: Calculating a SET symbol from a label Since Assembler H the macro language runs during the first pass, so it has access to information from that pass so far, including for example assembler definitions generated by previous macros. SETA processing only calculates arithmetic values and has no way to track relocation; a SETA expression is not an assembler expression, so any assembler symbols included in a SETA expression must resolve to numeric values at the time they are encountered. I think that evaluation of an EQU symbol may be retried at that point if not previously resolved, but I don't remember whether it tries lookahead. Lookahead is in any case quite limited. It can only see information which is in open code (ignoring any conditional assembly logic), and some information cannot be resolved until after the first pass, when sections and LOCTRs are known to be complete and their relative addresses can be resolved. The assembler carries a lot of historical baggage, but the world relies heavily on compatibility. When the PL/X or metal C compilers ran into problems generating the most negative decimal number, we thought it should be completely safe to enhance HLASM to allow negative decimal self-defining terms, because such terms could already be coded in hex or binary, but some customers ran into problems caused by macros which relied on negative decimal self-defining terms not being valid self-defining terms and hence not having type attribute "N". That was easy to work around, but it made us even more aware of the potential impact of the slightest change. Jonathan Scott -----Original Message----- From: IBM Mainframe Assembler List <[email protected]> On Behalf Of Paul Gilmartin Sent: 17 February 2026 20:42 To: [email protected] Subject: Re: Calculating a SET symbol from a label On 2/17/26 11:49, Jonathan Scott wrote: > ... > EQU is not necessarily evaluated when encountered, but can be deferred and > retried later if anything isn't yet resolved. SETA must be evaluated when > encountered. > ... This is redolent of classic two-pass assemblers (IFOX00) which required definition before use in defining further symbols (EQU) or storage (ORG). SETA could have done better and required only an absolute expression after lookahead. -- gil
