Page 2 of 2

Posted: Tue Dec 10, 2013 2:25 pm
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>

Posted: Fri Dec 13, 2013 11:10 am
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?

Posted: Fri Dec 13, 2013 11:20 am
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'.

Posted: Fri Dec 13, 2013 11:56 am
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.

Posted: Fri Dec 13, 2013 3:29 pm
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.