Referencing Environment Variables in Routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

Referencing Environment Variables in Routine

Post by hrthomson »

I apologize if I'm duplicating past posts, but I was not able to find the answer to my question in my searching...

Is it possible to reference an Environment variable in a Routine without passing it as a parameter? Our objective is to reduce the number of parameters being passed to jobs thereby increasing the number of jobs that can fit in each sequencer.

Thanks in advance!

Heather :wink:
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
The question is what or how the environment variable is defined in your design? (dynamic or static)
Will it be visible to the running job when the job runs? (can't run test any time soon here :()

Usualy the strait forward answer is NO, but depending on what you want to achieve or why do you want to reduce the number of parameters in your jobs I think we may manage a way to do what you need.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

In parallel jobs there is a GetEnvironment function but I don't know of an equivelent one in BASIC. You could you DSExecute to run an echo command. It's not a very good programming practice as it stops your routine from operating as a black box. It can lead to misunderstandings from support in production as they expect to be able to override job parameters via director but the routines go directly to the environment.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not direct, but you can use DSExecute. Either go to the operating system and echo the value of the environment variable, or go to UV and use the ENV command. I prefer the former, though you need to make it platform specific, for example echo %TMPDIR% for Windows but echo $TMPDIR for UNIX.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

Post by hrthomson »

Thanks everyone. That's what we pretty much guessed. Too bad. It would make Environment variables quite a bit more useful if you could reference then easily in routines.

Thanks for your help
cheers
Heather
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The UniVerse/DataStage shell (uvsh or dssh) doesn't really support the concept of environment variables, which is why an indirect mechanism is needed to get at the parent shell's environment variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply