return code from DSU.ExecSH

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
altruist
Participant
Posts: 73
Joined: Thu May 11, 2006 6:50 am

return code from DSU.ExecSH

Post by altruist »

Hi,


If we used the following code in routine

Code: Select all

    
EARLIER Statements
....
Call DSU.ExecSH(UnixCmd, ErrCode)
     If ErrCode <> 0
        Then Call DSLogFatal("failed.", rtnName)
.......
NEXT Statements

Will the ErrCode check wait for the unix command to be completely executed i.e for example if i have issued a copy command, which may say take 10 secs. Then will the code come to the ErrCode check and wait there until the UnixCmd is successfully executed or checks only for immediate failure of the UnixCmd.

I need to know this because in the NEXT Statements I want to immediately use one of the files which was obtained as a result of UnixCmd
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you execute a UNIX "cp" command from within a ExecSH() call the control will not return to DataStage until the command completes. The ErroCode that is returned is the UNIX error code. Are you planning on executing the "cp" command(s) as background process in your shell? That would be a different matter entirely.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Source code for ExecSH is in the Routines branch of your repository. Take a look at it. This will ease your concerns and prove what Arnd advised is correct.
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