1747988 Members
5043 Online
108756 Solutions
New Discussion юеВ

Re: Symbol Table ED

 
SOLVED
Go to solution
Jack Trachtman
Super Advisor

Symbol Table ED

Could use some insight into symbol tables:

I'm beginning to test APACHE. The example CGI DCL script given displays symbols made available to the script by showing each one.

I modified the script and added:

$ SHOW SYM/GLO/ALL
$ SHOW SYM/LOC/ALL

but the symbols mentioned above did not appear in either list!

After (too much wasted) time trying to figure this out, I noticed the following in the HELP SHOW SYMBOL PARAM text:

"You can search symbol tables of preceding
command levels by symbol name, but not by wildcard."

Does this mean that each cmd level has its own Global Symbol Table?

Is there anyway to accomplish what I'm trying to do (i.e, see all symbols available to the script)?

TIA
3 REPLIES 3
Arch_Muthiah
Honored Contributor

Re: Symbol Table ED

Jack,
The DCL CGI script available for debugging DCL symbols and logical names won't work properily. Especially SHOW SYM/ALL wont display any env variable passed to the CGI by the server.
To view server-created variables, we have pass the variable name explicitly, like $ show symbol sym_name either it is local or global.

There is logical named APACHE$SHOW_CGI_SYMBOL, we can set proper value, go thru this, but I did not try it.


Thanks
Archunan

Regards
Archie
John Gillings
Honored Contributor
Solution

Re: Symbol Table ED

Jack,

> Does this mean that each cmd level
> has its own Global Symbol Table?

General answer:

No, each command level has a local symbol table. SHOW SYMBOL/GLOBAL/ALL and SHOW SYMBOL/ALL will both work from any command level. However, if the symbols you're interested in are in the *local* table of a higher level procedure, you can't access them by wild card. You can access them by name, provided there isn't a local symbol of the same name occluding it.

Thus if:

$ SHOW SYMBOL SOME_SYMBOL

returns a value, but it's not present in

$ SHOW SYMBOL/ALL
$ SHOW SYMBOL/GLOBAL/ALL

then it must be in an intervening procedure level.

You can see how many levels of procedure are active with F$ENVIRONMENT("DEPTH").


>Is there anyway to accomplish what I'm
>trying to do (i.e, see all symbols
>available to the script)?

Not in general, but for your case, APACHE, this may help.

On a system I looked at, it's 3 levels down. The CGI script is called from:

APACHE$COMMON:[000000]APACHE$DCL.COM

which is called from a procedure executing commands read from a mailbox, presumably fed by the server.

I added a command to APACHE$DCL.COM:

$ PIPE SHOW SYMBOL/ALL > SYS$LOGIN:SYMS.LOG

before and after the line:

$ APACHE$DCL_ENV -c

which dumped the local symbols at that procedure level. Comparing the outputs shows this program defines the interesting symbols for your CGI script.

Dumping from the next level up is a bit more of a challenge (note, you can't send the output from upper procedure levels to standard output as it's outside the HTML context headers and footer).

If you can find the source code to APACHE$DCL_ENV, you might be able to change the LIB$SET_SYMBOL calls from local to global.
A crucible of informative mistakes
Jack Trachtman
Super Advisor

Re: Symbol Table ED

Archunan - I went back and reread the rel notes which has the info you gave. Thanks

John - I didn't know that "local" symbols in a procedure were available to lower procs by explicit reference. I've always thought that "local" literally meant that, and that "global" symbols were the only path for procedure level symbol interchange.

Thanks for the insight