Page 1 of 1

How to pass parameter from Datastage Job to shell script

Posted: Tue Aug 22, 2006 1:22 am
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

Posted: Tue Aug 22, 2006 2:48 am
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.

Posted: Tue Aug 22, 2006 3:04 am
by kumar_s
As mentiond, you can also calculate the required date value in the shell script.

Posted: Tue Aug 22, 2006 3:16 am
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

Posted: Tue Aug 22, 2006 3:39 am
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.