When you write "Unix" do mean a particular set of Unix implementations, or do 
you mean that certification by The Open Group <http://www.opengroup.org/> 
requires it? If the later, shouldn't there be an APAR on this?

Shmuel (Seymour J.) Metz

From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Thomas David Rivers <riv...@dignus.com>
Sent: Tuesday, March 13, 2018 11:33 AM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: USS assembler program and envars

Frank Chu wrote:

> Hi,
> 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.
> Frank
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
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
functions that can reference the copies (e.g. your own getenv/setenv

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. -

riv...@dignus.com                        Work: (919) 676-0847
Get your mainframe programming tools at 

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to