Topic Options
#787 - 09/19/03 11:07 AM Environment Variables
Ranxerox Offline
Junior Member

Registered: 09/19/03
Posts: 10
Loc: Bellevue, WA
What is the scope of an environment variable defined in a job?

Let's say I have three jobs: Alpha, Bravo, and Charlie. Each of these uses a WORK_DIR environment variable for general invocation of scripts and so forth. Each of these jobs has a different directory for log files (e.g. %WORK_DIR%\logs\Alpha).

I could write an error handler that was generic if I knew that in the Alpha job I could define LOG_DIR to be the Alpha log directory and the generic error handler would pick this up in the context of the erroneous Alpha job. However, if the environment is shared, the generic error handler would pick up the log file for the latest job to start (the jobs last many hours or days, so overlapping situations are frequent).

So...if I define LOG_DIR within the Alpha job and also within the Bravo and Charlie jobs are these three different contexts and thus three different environment variables? Will a generic error handler correctly pick up the LOG_DIR and so forth? Or are they shared and I have to write three separate, specific error handlers?
_________________________
* Software Mercenary *
* Dilettante * Human *

Top
#788 - 09/27/03 03:46 PM Re: Environment Variables
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
They are global, meaning they are shared across jobs. I do have local (per job) variables though that I use to store certain booking information.

I could certainly 'expose' the private variable interface, maybe like:

-action -set -private keyword=value

The interesting thing would be fetching these variables.

So for instance:

-action -set FOX=BLUE
-action -set -private FOX=RED

#which one will print?
{
-name env_test
-action -print %FOX%
}

I would probably use the same technique used in most programming languages, that is; the local scope is preferred over the global scope.
In other words, the global copy of %FOX% will only be used if there is no local copy.

I'm copying this to the enhancements forum for consideration.
_________________________
Regards,
Luke Tomasello

Top


Moderator:  Luke Tomasello