$PROJDEF vs $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
radamaitis
Participant
Posts: 3
Joined: Fri Nov 11, 2005 4:38 pm

$PROJDEF vs $ENV

Post by radamaitis »

Can someone please tell me the difference between $ENV and $PROJDEF when setting the default value of a job parameter? It seems like they are the same....
Thanks!
Robin Adamaitis
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
Welcome Aboard :D
$PROJDEF picks the value up from what was set in the Administrator client.
$ENV picks the value up from the executing user's environment.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

Just an additional note.

I found the same thing when I started, because we do everthing from inside DataStage - we don't set up any aspect of the environment externally before launching DS. $ENV and $PROJDEF both got their values from Administrator.

If you set your environment variables from within Administrator and they are the same in every job every day (eg. userids, passwords, directories), then $PROJDEF is the go.

If you have have a variable that is used in many/all jobs, but needs a different value for each run (eg. Batch Number, Effective Date) then $ENV works pretty well.

This is my reasoning:
Consider the problem of environemnt variable $BATCHNUM, it is used in every job. It must be set in the very top level Job Sequence (or in the Environment before you start), and then you can pass the value down to subordinate Job Seqs and Jobs.

And here's the key: so long as you create all your jobs and seqs with the parameter and set the Default to $ENV, then you do not have to populate the value in the Job/Seq Activity when you drag it into a Job Sequence. You just drag the Job into the Sequence, link it up, and Compile.

$PROJDEF is unsuitable for this type of functionality, because you cannot pass a newly defined value down from Seq to Seq. If the Default is set to $PROJDEF and is not overridden in the Job Activity settings, then it will grab the value straight from Administrator.

Be warned though. If you have JS1 calling JS2 calling JS3 calling JOB4. BOB4 needs $BATCHNUM, and $BATCHNUM is initially set in JS1. For JOB4 to get the value set in JS1, then $BATCHNUM must be a parameter in JS2 and JS3 as well - the value must be passed down through every Job Sequence.
Ross Leishman
Post Reply