Compare Two Values in Sequential File

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

Moderators: chulett, rschirm, roy

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

Post by chulett »

iq_etl wrote:ExecCommand tab
Command: echo <activitystagename>.$CommandOutput<3>
Parameters: <pathtosequentialfile>

Triggers tab
Expression: $CommandOutput<3> = 'Y'
If you go this route... no, that command would not be correct. You echo the contents of the file and then as you correctly noted, use the result in the Trigger Expression. So this if your path is hard-coded:

Code: Select all

Command: echo <pathtosequentialfile>
Parameters: 
Or if your path is derived from parameters at all:

Code: Select all

Command: echo
Parameters: <pathtosequentialfile>
-craig

"You can never have too many knives" -- Logan Nine Fingers
iq_etl
Premium Member
Premium Member
Posts: 105
Joined: Tue Feb 08, 2011 9:26 am

Post by iq_etl »

Ok, this seems like it should be straight forward, but I'm not getting the results I anticipate.

My file has three simple records:
1855
265
"Y"

I have an Execute Command activity in my sequence. The ExecCommand tab has the following on the Command line.
echo /path/path/filename.TXT

The triggers tab of the Execute Command stage has a Custom -(Conditional) expression type with the following as an expression.
stagename.$CommandOutput<3>='Y'

When I view the job log, the Execute Command activity has the correct path and file name, starts, then finishes with reply=0, then the entire sequence finishes.

It does not find the 'Y' and send an email.

Where have I gone astray?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you are on Windows, change the 'echo' to a 'type'. Right now it's probably just echoing the string that is the name of your file rather than the contents. On UNIX you would use 'cat', on Windows the equivalent is 'type'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
iq_etl
Premium Member
Premium Member
Posts: 105
Joined: Tue Feb 08, 2011 9:26 am

Post by iq_etl »

Ok, 'type' looks to be correct, but now it's not finding the file. I'm sure it never was. I'm getting:
Output from command ====>
sh: line 0: type: /path/path/filename.TXT: not found
The structure '/path/path/filename.TXT' is what I use in my DS jobs and they write the files to the correct location. Being a sequence and not a job, I wonder if I need an additional path level in the ExecCommand? I suppose I'll have to play with this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You may need to include the drive letter if the files are on a different drive from where the DataStage jobs are executing. Otherwise a path is a path is a path and the Execute Command stage doesn't treat them as anything different from what the Sequential File stage would in a job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply