Execute Command Activity - Trigger Question

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
brock125
Premium Member
Premium Member
Posts: 14
Joined: Wed Dec 14, 2011 9:03 am

Execute Command Activity - Trigger Question

Post by brock125 »

I have a simple job that creates an extract. I want to compare the current extract to the previous extract to see if there are any differences. If there are differences then I want to send an email to notify a group that there are differences. If there are no differences then I don't want to do anything and the job should end.

This is the syntax I'm using to compare the 2 files:

cmp -s /iis_dev_data/outbox/Extract_ABC.csv /iis_dev_data/inbox/Extract_ABC.csv ; echo $?

The Director log shows the following:

Js_test_job..JobControl (@ExCmpFiles): Executed: cmp -s /iis_dev_data/outbox/Extract_ABC.csv /iis_dev_data/inbox/Extract_ABC.csv ; echo $?
Reply=0
Output from command ====>
1

The Trigger tab has the following:

Expression Type is Custom - (Conditional)
The Expression is: ExCmpFiles.$CommandOutput =1

The problem I'm having is it never finds the trigger expression to be true. The files are different (the command returns a value of 1) but it always stops instead of continuing on to the notification activity. I've tested it by changing the Trigger to Unconditional and it works just fine. Does anybody have any idea why the trigger doesn't recognize the Unix command result?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's the dreaded Field Marks (@FM) characters in the output, they need to be stripped from the result before the check. Or you can try array notation since they are returned in a dynamic array:

ExCmpFiles.$CommandOutput<1>=1

One of many deeper discussions here for your dining and dancing pleasure. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
brock125
Premium Member
Premium Member
Posts: 14
Joined: Wed Dec 14, 2011 9:03 am

Post by brock125 »

Thanks Craig!!! I completely forgot about the field marks. That did the trick.
Post Reply