Environment Variables - Runtime $ENV

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The ability to use environment variables was new in version 6.0. Are you running an earlier version than 6.0?
Prior to 6.0, the usual techniques involved
(1) hashed files with "constant" keys that were populated, for example, in a before-job subroutine
(2) use of system variables such as @USER0, @USER1, @USER2 and so on and @USER.RETURN.CODE populated, for example, in a before-stage subroutine
In DataStage BASIC you can access the value of an environment variable by executing the DSExecute subroutine, for example:
Call DSExecute("UNIX", "echo $TARGET_UID", Output, ExitStatus)


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
mharkema
Participant
Posts: 11
Joined: Thu Mar 20, 2003 4:23 am

Post by mharkema »

Hi Ray,

Thanks for your quick reply!

We are using DataStage 6.0r3 on WIN2000
However, I was wondering if environment variables will work at WIN2000 at all or that they only exist on UNIX?
If environment variables cannot be used on WIN2000, how would you set environment specifics (we are using two servers and we want to migrate from development to production using export/import facility and have environment variables to set the specifics for the environment in which the jobs should run). For example: the target database password should be stored in the "environment". When we migrate the jobs from development to production, we should not have to deal with replacing this target database password (the development password is different from the production platform).

I hope you have some smart tips!

Thanks again.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Bonjour Maurice,

you can use environment variables also in DOS/Windows (NT, 2000.....) the syntax is only different.

Setting a Variable in Windows:
SET VAR1=Hello world
Refering a Variable in Windows:
%VAR1%

Wolfgang
Post Reply