How to pass parameter from Datastage Job to shell script

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

Post Reply
vinodpatel
Participant
Posts: 4
Joined: Mon Aug 21, 2006 10:23 pm
Location: Pune

How to pass parameter from Datastage Job to shell script

Post by vinodpatel »

Hi,
My job design is like that
I am calculating a date in one job & want to pass that calcuated parameter in shell script whcih would be called in the workflow with Routine ExSH. Shell script is doing nothing but just copy the file from one location to another. As the file name is having date part thats why i want it to pass the paramenter in the shell script.

Is it possible to pass such parameter.
If yes please give me any pointers.

Thanx,
Vinod
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are various ways that you can do this. How you solve it depends upon exactly where you calculate this date and where you call up the external command.

The easiest solution might be to write this date value to a file (one row, one column) and then you use the contents of this file indirectly in your shell script. This makes things simple and easy.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

As mentiond, you can also calculate the required date value in the shell script.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
vinodpatel
Participant
Posts: 4
Joined: Mon Aug 21, 2006 10:23 pm
Location: Pune

Post by vinodpatel »

Ya I have one separate Job for calulating date which writes into the Hash file.Now I read this file with routine GetParameterFromHash. But how should I pass this value into the shell script. Again I am calling this script through routine ExSH in the workflow.

Flow is like this
1. JobActivity (calling job which calulates date)
2. UserVaraible (retreives value from Hash file:GetParameterFromHash)
3.RoutineActivity(calls shell script : ExSH)

Now how can i pass the value get from GetParameterFromHash to shell scrip?
Also,Please suggest another apporach if its not proper one.

Thank,
Vinod
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you are calling shells through Routine, you can opt for DSExecute.
You can execute the command concatinated witht the required prameter passed to the shell script. Search for DSExecute in BASIC guide or in this forum.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply