[mod.computers.vax] How to tell if global symbol is defined?

BEC.SHAPIN@USC-ECL.ARPA.UUCP (02/19/87)

How can I tell from within a command procedure whether or not a symbol
has been defined in the proces global symbol table?
-------

art@MITRE.ARPA.UUCP (02/20/87)

It appears that there is no easy way to solve your problem.
Two possible solutions (SPELL THAT KLUDGES) are:

1) $ASSIGN TEMP.LIS SYS$OUTPUT
   $SHOW SYMBOL/LOCAL B
   $SHOW SYMBOL/GLOBAL B
   $DEASSIGN SYS$OUTPUT
   now read the temp.lis file.  If globally defined will find 
   an entry with "==".  If locally defined the entry will have
   "=".

2) A more direct apporach is to use the ON WARNING to catch a failure.

    $ON WARNING THEN $GOTO UNDEFINED
    $C=A
    $ON WARNING THEN $GOTO GLOBAL 
    $DELETE/SYMBOL/LOCAL A
    
    $WRITE SYS$OUTPUT "LOCAL SYMBOL"
    $A=C		!RESTORE LOCAL SYMBOL
    $....
    $GLOBAL: WRITE SYS$OUTPUT "GLOBAL SYMBOL"
    $....
    $UNDEFINED: WRITE SYS$OUTPUT "UNDEFINDED SYMBOL"
    $...
* 
*---Art 
* 
*Arthur T. McClinton Jr.     ARPA: ART@MITRE.ARPA 
*Mitre Corporation MS-Z305   Phone: 703-883-6356 
*1820 Dolley Madison Blvd    Internal Mitre: ART@MWVMS or M10319@MWVM 
*McLean, Va. 22102           DECUS DCS: MCCLINTON 
* 
=-=- This note is in response to yours which follows -=-= 
How can I tell from within a command procedure whether or not a symbol has been defined in the proces global symbol table? -------