Pass valus to UNIX script fromDS control job

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
Das
Participant
Posts: 87
Joined: Tue Oct 24, 2006 9:58 pm
Location: india

Pass valus to UNIX script fromDS control job

Post by Das »

How can i pass some values from a datastage control job to a UNIX script-

Script is used to send mail-i have to pass msg body to the script.


please provide the syntax-in ds side and unix side
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are several ways to do this from DataStage Server, the method you use depends upon where you wish to do this. In sequences you have have a command activity stage, in Server jobs you can call a script from a before/after routine or use ExecSH or the DSExecute function.
Das
Participant
Posts: 87
Joined: Tue Oct 24, 2006 9:58 pm
Location: india

Post by Das »

Hi Thanks for the reply.


I want to call a unix scrpt from a contril job to send a mail notification
please provide a solution.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Das, I thought I had already pointed out the stage to use: the DataStage job sequence "Execute Command Stage" to execute a UNIX script. Did you require an example?
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Das,

You can also use DSExecute function.....



Thanks,
Anupam
Das
Participant
Posts: 87
Joined: Tue Oct 24, 2006 9:58 pm
Location: india

Post by Das »

sb_akarmarkar wrote:Das,

You can also use DSExecute function.....



Thanks,
Anupam

Thanks.please provide me the code
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Das, the documentation is really helpful in cases like this, look at the Ascential DataStage BASIC Guide on pages 6-158 and 6-159
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need to quote it right as well to get the arguments correct. Under the covers these command are calling the execute command in BASIC.

Code: Select all

Cmd = 'SH "ShellScript Arg1 Arg2"'
execute Cmd capturing Output returning ReturnCode
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A small change if I may. Use the -c option for SH to effect a return of control when completed.

Code: Select all

Cmd = 'SH -c "ShellScript Arg1 Arg2"' 
Execute Cmd capturing Output returning ReturnCode 
My personal preference is to use DSExecute().

Code: Select all

Cmd = "ShellScript " : Arg1 : " " : Arg2
Call DSExecute("UNIX", Cmd, Output, ExitStatus)
It achieves the same result as the Execute statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ray is correct. Most of the time I add -c.
Mamu Kim
Post Reply