Execute Command

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Execute Command

Post by richdhan »

Hi All,

I have to use the loop functionality based on the number of records in a File.

I used the ExecuteCommand activity with wc -l command.

In the start loop, the loop type is Numeric. Start is 1, Step is 1 and End is #Execute_Command_0.$CommandOutput#

I got the following error

LoopingSeq..JobControl (@StartLoop_Activity_3): Controller problem: Loop final value not numeric (13 /myfolder/filename.txt) - cannot execute

I used the UserVariable activity and gave the following derivation Field(Execute_Command_0.$CommandOutput," ",1). I mapped #UserVariables_Activity_13.New# to the Start loop end value and it worked perfect.

I want to find out how I can do this directly with the ExecuteCommand activity output without using UserVariable activity.

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

Post by chulett »

Don't recall if this is supported, but did you try your new derivation without the UserVariables stage, directly in the Start Loop?

Field(Execute_Command_0.$CommandOutput," ",1)
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't forget that you have to strip the line terminator off.

Code: Select all

Trim(Convert(@FM,"",Execute_Command_0.$CommandOutput))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply