1

In z/OS HLASM, I'm wondering if there is a way to "unequate" a symbol that was defined via the EQU instruction. For example:

MyValue  EQU 999
...
         LHI R5,MyValue
...
MyValue  UNEQU     <===== or something that returns MyValue to the undefined state for the next statement in the assembly

I suppose this would be simiar in concept to a DROP following a USING to "scope" the relationship between a register and a DSECT, but in this case it would mean "this symbol is only valid within the scope between the EQU and the 'unEQU'."

Thanks, Scott

  • 1
    What are you trying to achieve? I doubt this is possible. – fuz Mar 11 '20 at 13:21
  • Perhaps you could use a macro preprocessor that lets you `#undef MyValue` so it can have different values at different points in the source? In many assemblers, `EQU` definitions are file-wide, and apply even to uses before the definition. (Similar to how forward references to labels are also valid) – Peter Cordes Mar 11 '20 at 19:06
  • Sounds like an RFE. Probably would be a good one, but you'd need a good case. Maybe raise a SHARE languages requirement? – zarchasmpgmr Mar 12 '20 at 22:29
  • Maybe a good requirement or maybe I look at a different tool in the toolbox. Perhaps SETC symbols? – Scott Fagen Mar 13 '20 at 02:29

1 Answers1

3

EQU creates a symbol and once defined its there for life. Its not like a #define pragma in C.

IBM's Reference Manual for HLASM and the EQU Instruction

In essence you are creating a symbol it is entered and cannot be removed. The manual does not specifically indicate this but given that once a symbol is defined with EQU it also cannot be changed.

For grins I tried a few variations and this was the result of trying to redefine the symbol ABC

  Active Usings: None                                                
  Loc  Object Code    Addr1 Addr2  Stmt   Source Statement           
000000                00000 00000     1 EQUTEST CSECT                
                      00001           2 ABC EQU 1                    
                      00002           3 ABC EQU 2                    
** ASMA043E Previously defined symbol - ABC                          
** ASMA435I Record 3 in USER1.TEST.SOURCE(EQUTEST) on volume: T70502 
Hogstrom
  • 3,581
  • 2
  • 9
  • 25
  • 1
    Yeah, that's where I was when I figured I'd just toss out a message in a bottle. It's not a necessary function, just one that could have been used to simulate "scope" for an equated value. Nothing ventured, nothing gained. – Scott Fagen Mar 12 '20 at 02:53