Execute command not triggering the proper trigger

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
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Execute command not triggering the proper trigger

Post by RAJARP »

Hi,
I have job sequence

Based on the the output from the execute command activity(command_activity1), two different instances needs to be triggered.
This is what i put in the command

Code: Select all

wc -l /filepath/file1.txt | awk '{ print $1 }' 
The execute command activity has two links(triggers).Both are conditional triggers.
Trigger1:command_activity1.$CommandOutput > 1
Trigger2:command_activity1.$CommandOutput = 1
Test..JobControl (@Execute_Command_0): Executed:
wc -l /filepath/file1.txt | awk '{ print $1 }'
Reply=0
Output from command ====>
1
whatever the output is , only Trigger1 is getting triggered.


So to narrow down the issue, i have connected two execute command activties to both the triggers

and in execute command which is connected to Trigger1, I put

command:echo
paramter:#Execute_Command_0.$CommandOutput#

and this is the director log
Test..JobControl (@Great_1): Executed: echo 1
Reply=
Output from command ====>
-1
The thing is , though the output returned by the command in execute command activity
ir)

Code: Select all

wc -l /filepath/file1.txt | awk '{ print $1 }' 
is 1, the Trigger 2 is not getting triggered.

I am not sure, what is ahppening the issue.Any ssolutions would be highly appreciated.

Regards,
Raja R P
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's the old 'command output has field marks in it' issue since it returns the values in a dynamic array. Try using array notation:

Trigger1:command_activity1.$CommandOutput<1> > 1
Trigger2:command_activity1.$CommandOutput<1> = 1

Or use Convert() in the trigger expression to convert @FM to ''.
-craig

"You can never have too many knives" -- Logan Nine Fingers
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

Thanks Craig!!!!

I was able to make it working by

Code: Select all

Trigger1: Trim(command_activity1.$CommandOutput ,@FM)> 1
Trigger2: Trim(command_activity1.$CommandOutput ,@FM)= 1

(or)

Code: Select all

Trigger1: convert(@FM,"", command_activity1.$CommandOutput)>1
Trigger2: convert(@FM,"", command_activity1.$CommandOutput)=1
Thanks once again,

Regards,
Raja R P
Post Reply