Frank Chu wrote:


Does anybody know if there is a control block chain that I can walk to find all of the envars that are define? I know there is a LE C function that can query for a specified envar but I can't use LE C. And there are circumstances where I do not have access to the parm list pointer that is passed to the executing program, so I can't rely on that guy to find the envars. I've also gone through the USS Callable Assembler Services Guide and it doesn't look like there is a service for this either.

Thanks in advance.

Just FYI - in a UNIX environment the address of the incoming environment variable array
is stuffed away in an external variable named "environ":

 extern char **environ;

The Dignus C runtime (also non-LE) makes that available... basically at the start-up of an
exec'd program you have to copy the incoming variables into a blob of memory
and point 'environ' to the blob... (because the format from IBM doesn't match
the UNIXy way of doing it.)

Then, your program can merrily reference 'environ' (getenv/setenv, etc... also
just reference 'environ'.)

If you are a non-LE program that has been exec'd; you probably want to take
the same approach and make those copies when you start execution; then provide functions that can reference the copies (e.g. your own getenv/setenv functions.)

There is no "magic" to these environment variables - they are simply passed
on the exec() call... that's how they pass from parent-to-child in the UNIX environmnt. No need for a defined location beyond the per-program copy (and that copy is up to
the program.)

  - Dave R. -

--                        Work: (919) 676-0847
Get your mainframe programming tools at

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to with the message: INFO IBM-MAIN

Reply via email to