Invoke batch file

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
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Invoke batch file

Post by dsrules »

Hi,
I need to invoke a batch file and read the status code. I read the manual , it says about
DSExecute(ShellType, Command, Output, SystemReturnCode)
Also there is an option for creating a Batch Job in Director or in Sequencer. I want to know how do we specify the file name and path of the batch file and read the status code and depending on the status code we run the next job or abort by writing into log file.
Also how we invoke a utility exe file from Ascential.
Thanks
Mack
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DSExecute is what you need - it is a subroutine that you must call from your own DataStage routines. The fourth argument captures the exit status of the BAT file.

The "Batch" that you create in Director is NOT a Windows BAT file; instead it is a batch of DataStage jobs to be executed one after another; it ends up as a job control routine.

You can invoke a utility exe file from DataStage using DSExecute. You can also invoke them using the ExecDOS before/after subroutine. Beware, however, that in the latter case an exit status of other than zero will cause your job to abort.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

Hi Ray,
I wanted to know how do we specify the path name for the batch file , I know the shell value would be 'NT', what would be the command value if I have a XXX.bat file to run. Can you please elaborate.
Thanks
Mack
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The command is the same as you would use in a CMD shell - the full pathname if the BAT file's parent directory is not in your PATH, or just the BAT file name if it is.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply