Page 1 of 1

Scope of environment variables

PostPosted: Tue Nov 16, 2010 3:34 pm
by LotharLochkarte
Hi,

can anybody explain the scope of an environment variable to me?

With the LE callable service CEEENV I was able to set an environment variable within a COBOL program and to read it by the same program.

But my aim was to create something like a "global variable" that is valid even after the termination of my cobol program.

However, if I have a program A that sets an environment variable, I am not able to read this environment variable with a program B. (I tried it with IMS MPPs, if it is relevant)

So my question is: Did I make a mistake somewhere or are "environment variable" the wrong concept for my purpose?

(I have searched the "LE concept guide" before, but I didn't find useful information there)

Best regards!

Re: Scope of environment variables

PostPosted: Tue Nov 16, 2010 3:48 pm
by Robert Sample
Environment variables have the scope of the task. For a batch job, the task ends when the job ends -- and hence the environment variables will not survive the job ending.

Re: Scope of environment variables

PostPosted: Tue Nov 16, 2010 4:00 pm
by LotharLochkarte
Thank you for your quick reply!

The "task" of an IMS MPP is the dependent region where it runs, right?. So the environment variable should be visible even after the termination of MPP A, so my MPP B (running in the same dependent region) should be able to see this variable?