Page 1 of 1

Getting ExecuteCommand CommandOutput value in a sequencer

Posted: Wed Dec 13, 2006 7:10 pm
by abc123
I have a sequencer loop where I have an ExecCommand followed by a JobActivity stage. In the ExecCommand, I am calling an UNIX command, cat filename, which has a value. I would like to do ExecCommand.CommandOutput to get this value, add 1 to it and use that value as one of the paramters of the job in the following JobAcitivity's job. This doesn't work. Any ideas would be appreciated.

Posted: Wed Dec 13, 2006 7:30 pm
by kumar_s
Why it doesn't work? Are you getting any error or it doesnt give the expected value? Explain how are you passing the value.
You can use the ReturnValue of the ExecuteCommand Acitivity to pass the value of the output. And you can manipulate the same in the Job.

Posted: Wed Dec 13, 2006 7:53 pm
by abc123
It doesn't give the expected value. In the parameters of the JobActivity stage, I am doing ExecCommand.CommandOutput + 1.
This value should be the parameter value in the job of the JobActivity stage. I always get a 1. I tried ReturnValue as well. If I change the 1 to a 3, I get a 3.

Posted: Wed Dec 13, 2006 8:04 pm
by ray.wurlod
You are missing a dollar sign.

Code: Select all

ExecCommand.$CommandOutput 
In version 7.1 and later you can select this from the "Add Job Parameter" dialog.

Posted: Wed Dec 13, 2006 8:19 pm
by abc123
ray thank you for your response.

Actually I have the $ and I am picking from the Acitivity Variable pop-up. I am not typing it in.

Posted: Wed Dec 13, 2006 8:23 pm
by abc123
What's interesting is, in the log it says "Output from command ====>
2" for the ExecCommand activity which means it is returning the right value. It is just during the addition or in the Job Activity stage that the value is getting lost.

Posted: Wed Dec 13, 2006 8:33 pm
by kumar_s
Try just passing CommandOutput to the Job Activity and add the value 1 inside job.

Posted: Wed Dec 13, 2006 8:38 pm
by chulett
I would try:

Code: Select all

ExecCommand.$CommandOutput<1> + 1

Posted: Wed Dec 13, 2006 8:42 pm
by abc123
I tried ExecutCommand.$CommandOutput without the addition. This completely errors the job out.

Posted: Wed Dec 13, 2006 8:43 pm
by chulett
What 7.x version of DataStage are you running? :?

Posted: Wed Dec 13, 2006 8:50 pm
by abc123
craig that did it. ExecCommand.$CommandOutput<1> + 1 worked. I am using version 7.5.1A. Can anyone explain why it worked? What does the <> work? It seems like an array element.

Thanks.

Posted: Wed Dec 13, 2006 8:53 pm
by ray.wurlod
The command output includes line terminators. These are translated by DataStage into field marks (@FM) so that what you get is a dynamic array containing one field per line of output. The angle brackets notation with embedded "1" returns field #1. You could also have specified

Code: Select all

Field(ExecCommand.$CommandOutput, @FM, 1, 1)

Posted: Thu Dec 14, 2006 1:29 pm
by abc123
Thanks ray. Can you tell me where I can read up more about @FM? I looked in to PX Jobs Developers Guide and Advanced Guide but couldn't find any details.

Posted: Thu Dec 14, 2006 1:48 pm
by DSguru2B
Look into the Basic.pdf. Its a Field Marker, system variable.

Posted: Thu Dec 14, 2006 2:50 pm
by ray.wurlod
You would also find it in the Server Job Developer's Guide because a job sequence is just a special case of a server job (and that's the main reason that server jobs aren't going away any time soon).