Please enable JavaScript to view this site.

A-Shell Reference

UNDEF <symbol>

The UNDEF directive cancels (undefines) a symbol created by a prior DEFINE, DEFALIAS or DEFTYPE directive.

For example:

++IFDEF Flavor_of_the_Month$

    ++MESSAGE Out with the old flavor (Flavor_of_the_Month$)

    UNDEF Flavor_of_the_Month$

    DEFINE Flavor_of_the_Month$ = "Marmite"

++ELSE

    ++MESSAGE Flavor of the month program not currently active

++ENDIF

 

Note that in the above case, without the UNDEF, the DEFINE statement would generate a "redefined symbol" error unless the new definition was the same as the prior one. On the other hand, an UNDEF of a symbol that hasn't yet been defined is not considered an error, so the above ++IFDEF would only be necessary or sensible if the objective was to change the flavor of the month only if a flavor of the month had already been established, and otherwise to leave it undefined.

History

2022 June, A-Shell 6.5.1717, compiler edit 994:  UNDEF extended to work on DEFALIAS definitions. It previously worked only for DEFINEs.