Page 1 of 1

Re: Environment Variables

Posted: Tue Apr 08, 2003 7:11 pm
by kavo
I had the same problem. I decided to go back to using standard job parameters instead.


Damien :?

Re: Environment Variables - Runtime $ENV

Posted: Fri Aug 08, 2003 10:50 am
by Teej
mharkema wrote: However, when I try to use $ENV as a value for my environment variable $TARGET_UID, DataStage replies with the following message:

Missing Parameters $TARGET_UID [$ENV]

How can I use a "dynamic" environment variable that is being looked up during runtime?
GetEnvironment() function does what you want if you are using the Transform stage within Parallel Extender. The advice by the previous poster is also good (and more flexible than this solution).

-T.J.

Posted: Sat Aug 09, 2003 5:01 pm
by ray.wurlod
You need version 6.0 or later for the following.
When you create job parameters, there is a command button labelled "Add Environment Variable" on the Parameters page in the job properties window.
This opens a dialog in which all currently available environment variables are displayed. This is particularly useful for parallel jobs, since the operation of each of the APT... environment variables is documented in that window. You also (at the top of the tree view) have the opportunity to create a new environment variable.

$ENV

Posted: Wed Dec 17, 2003 2:19 am
by gh_amitava
Hi,

Set your environment variables in dsenv file. Execute the dsenv file and restart your datastage server. in dsjob command prompt define your environment variables like this..

-param '$ENVRNAME=$ENV'

Regards
Amitava ghosh

Posted: Thu Apr 22, 2004 9:55 am
by rhettbutlernc
I am trying to generate unique Sequence numbers using the Enviroment variables APT_PARTITION_COUNT and APT_PARTITION_NUMBER for my Parallel Jobs.

I added 'New Environment Varible' by specifying the 'Name' and 'Prompt' for these variables. ( eg: APT_PARTITION_COUNT and Partition Count).

I am using a Tranformer with 'GetEnvironment($APT_PARTITION_COUNT)'
and specified $ENV when I run the job...

When I run the get the following error message..

TestSurrKey: Missing Parameters $APT_PARTITION_COUNT [$ENV].

How should these 'APT_....' variables be treated. Should these be set in the dsenv file or anywhere else as well.

Thanks for all your help!!

Posted: Thu Apr 22, 2004 10:15 am
by trobinson
My understanding is that the environment variables can be set ONLY in dsenv. Fairly useless when multiple jobs within the same server need different values.
We are finding $environment variables useful as global parameters. By global I mean by project. These variables are set in the DSParams and can save time and effort when the same named parameters are used by different jobs in the same project.
One extremely frustrating aspect of this is that the dang things cannot be easily defined within a shared container. The shared container does edit checks on all parameters and WILL NOT ALLOW a $ in the parameter. The Shared Container parameter department at Ascential must have been on vacation when environment variables were discussed by the Job parameter department. There are two workarounds; either define the shared container functionality from within a job and then construct the shared container or hack the exported shared container .dsx and manually put the $ environment variables into the shared container.

Posted: Thu Apr 22, 2004 10:59 am
by Eric
My understanding is that the environment variables can be set ONLY in dsenv
As I understand, you can set them at a Project level using the Administrator, and thus you are not required to set them in the dsenv.
There are two workarounds; either define the shared container functionality from within a job and then construct the shared container or hack the exported shared container .dsx and manually put the $ environment variables into the shared container.
what about ...
You could create a normal named parameter in the shared container.
Then add the $EnvVariable to the job that contains the shared container. Then pass the $Variable into the Shared container parameter. (stage properties tab on shared container)

Posted: Thu Apr 22, 2004 11:17 am
by trobinson
You can't set them in the environment at job runtime and have them available to the job is what I meant.
Also I meant if you want the job parameter to be named the same as the env variable, you cannot do this in the shared container. Naturally, you can equate a $<name> to <name> if you want. I would prefer to limit the confusion caused by having multiple name parameters with different names actually mean the same thing.

Posted: Thu Apr 22, 2004 3:15 pm
by rhettbutlernc
I am trying to create the sequence numbers as per the discussion
viewtopic.php?t=60

When I give $ENV at runtime I am expecting the total number of nodes(4 in my case)

Here is the sequence I implemented:

1) Add a new Env variable APT_PARTITION_COUNT in the Administrator at the project level using 'Add New Environment variable'.

2) Design a job db2 --> xfm --> db2

3) Include the defined Parameter, in the job ( Edit --> Job properties --> Paramater --> Add Env Variable ( $APT_PARTITION_COUNT)

4) In the Tranformer stage derivaton: GetEnvironment($APT_PARTITION_COUNT)

I also tried the derivations $APT_PARTITION_COUNT and GetEnvironment($APT_PARTITION_COUNT) and the expression stays red. When it is compiled the job doesn't compile saying:

Error preprocessing Tranform Derivation.

5 ) But when I include the variable in quotes, 'GetEnvironment($APT_PARTITION_COUNT)', the job compiles but aborts saying "Missing Parameters $APT_PARTITION_COUNT [$ENV]"

Please let me know if I am missing something.... I guess it has something to do with the syntax

Posted: Fri Oct 01, 2004 6:10 am
by DSAlex
Hi guys,

I've been running into the same problem with DS V7.1 and discovered that the $ENV clause can only be used when calling sequences:

If you have a job that has one (or more) parameters wich are defined as enviroment variables (in Administrator Module), assigning them the $ENV value will give you an error at runtime.
You have to call that job from a sequence from where you assign the value $ENV to the (environment) parameters, that way is fine and the dynamic value is retrieved all right.

I think this is due to fact that when a sequence calls a job, it first assigns values to the parameters by calling DSSetParam() routine wich works fine.
Probably this could work by calling your job from another job (from BASIC) using DSSetParam() to set params.

Enjoy. :lol:

Alessandro Cagnetti
NCR Italy, Teradata Division