Execute command activity warning for file check

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
neena
Participant
Posts: 90
Joined: Mon Mar 31, 2003 4:32 pm

Execute command activity warning for file check

Post by neena »

Hi, I am using execute command activity to check a file existence in unix and then trigger the next job. My command is like this
ls *.*
and in the triggers I am saying if the return value = 0 then trigger the next job otherwise exit.

When the file is found job sequencer is running fine. But when the file is not found execute command activity is throwing a warning and the reply is 2 which is correct. But can anyone please let me know how can I make the job sequencer not throw the warning if the command return code <> 0 ?

I tried few different ways one of them worked but I cannot get the command out put and return value at the same time. I need the output of the ls *.* command to capture the file name.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Show us the warning. I'm assuming it's because you have the "Automatically handle" option enabled in your Sequence job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create an explicit Failure trigger, even if it only goes into a Sequencer. This will override the default handling of "errors" (non-zero exit status values). You might also disable "log warnings after activities that finish with a status other than OK" in the sequence's job properties.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
neena
Participant
Posts: 90
Joined: Mon Mar 31, 2003 4:32 pm

Post by neena »

Thanks so much for all the replies.

Automatically handle activities that fail is not checked.

Please see the warning message below.
(@ec_chk_file_exists): Executed: ls /home/../*.*
Reply=2
Output from command ====>
ls: cannot access /home/../*.*: No such file or directory

Execute command activity warning: (@ec_chk_file_exists): Command ls did not finish OK, reply = '2'
I have tried to create an explicit failure trigger by this command and then used the command output as the trigger condition.
ls #$SourceDir##pSubDir#*.* >/dev/null; echo $?
But the problem is I need the command output as the file names because I am also trying to capture the file names and then pass it as parameters to the rest of the process.

All I figured is create one more Execute command activity after the file check and then grab the file name as command output. Just trying to see if there is more nicer way of doing this.
neena
Participant
Posts: 90
Joined: Mon Mar 31, 2003 4:32 pm

Post by neena »

I am going to mark this topic as resolved but if anyone have information regarding how to make non zero exit status not to show up as warning in director. please let me know. Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Start by specifying which Sequence job compilations you have enabled. Also your previous attempt at redirection was incorrect as it redirected everything to /dev/null... try just redirecting stderr:

Code: Select all

ls #$SourceDir##pSubDir#*.* 2>/dev/null
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Two techniques are easy; there are others.
  • 1. Create an explicit Failure trigger. This takes precedence over other forms of error handling, even if it only runs into a Sequencer.

    2. Follow your command with a command that does return a zero exit status. This technique assumes that you can get the output of the first command from its output rather than from its exit status.
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