Passing Env variables through dsjob

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Passing Env variables through dsjob

Post by pravin1581 »

Hi All,

The job designed has certain environmental variables that have been defined in DS Administrator and its default value is passed as $ENV in the job properties . How can we pass those parameters when we run the job through dsjob command.

Thanks in advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't need to. The only time you need to 'pass' any parameters is when you need to override their default value.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

Thanks for the reply. The scenario is suppose for the file path we declare it as an env variable, in the job the parameter is called and the default value is defined as $ENV and then in the sequential file stage file property we call that parameter.As the parameter is used we need to pass this parameter in the dsjob command , but what value should be passed, without the parameter definition the job gets aborted.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why does it abort? How does it abort? The whole point behind setting up Environment Variables and using $ENV in your jobs is because the project specific value has been defined in Administrator. Have you not done that? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

Thanks for the reply. The value has been defined in the DS Administrator and in the job properties $ENV is passed in the default value tab.
The job aborts with the following message :-

Code: Select all


     Missing Parameters $path [$ENV]

where path is the env parameter.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That... doesn't make much sense to me at first blush. I'd need to build a test case to see how it behaved here but I don't have time for that right now. Perhaps someone else has some thoughts on the matter in the meantime?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

Any suggestions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Suggest... patience.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mikegohl
Premium Member
Premium Member
Posts: 97
Joined: Fri Jun 13, 2003 12:50 pm
Location: Chicago
Contact:

Post by mikegohl »

Michael Gohl
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Nice article but it doesn't address the specific 'dsjob' question that I noticed. However, it does make me realize that the OP doesn't really seem to have things setup correctly.

The value of the variable should either already be defined in the 'environment' (in dsenv, for example) and then set in the Adminitrator to $ENV or 'hard-coded' there instead to a value appropriate to the Project. Then what the job should use is $PROJDEF.

If you switch things around like that, do they work more better? Still without passing anything from the command line.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

Thanks for the reply, but the requirement is that I declare $ENV in the parameter default value, then how do i define that through dsjob command.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? We're going around in circles here. If "the requirement" is to set the job's default value to $ENV then the proper value must exist in the environment before the job is started. You don't pass anything to it on the command line.

So why not try setting the environment variable to the proper value in the script before 'dsjob' is envoked, don't mention the parameter in the invocation, and see what happens.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

Thanks for the reply. So when we intend to use $ENV as the default value then the parameter value has to be defined in the shell script earlier and its not needed to define it in the DS Administrator. No need of passing the parameter as dsjob argument and the dsjob command will be the same as used in the case of $PROJDEF command. Do we need to use -local option as well in the dsjob command.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The special tokens $PROJDEF, $ENV and $UNSET are only ever used in the job parameter definition grid in a job design. They are never mentioned in the Administrator client.
Does that help clarify your question?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What? $PROJDEF is 'job only' but $UNSET and $ENV are perfectly valid for use in the Administrator. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply