Command Activity

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
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Command Activity

Post by prasad v »

Hi

I am trying to retrieve data from file using commmand Activity stage in datastage

Actually i have created file with 1 value.
And used cat <filename>
Displayed Output: 1 and showing extraline(Eg: 1
)

I tried checking with Len(that commandactivity_output). It is giving 2.

How can we extract only the value 1 using Command Activity stage as i am passing this value to parameter.

And This file is being created in Command Activity stage later this stage.

Thanks
Prasad
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Extract the first element from the field-mark-delimited string returned via the Execute Command activity's output activity variable.

Use Field() function or dynamic array notation (ExecCmd.Output$<1>).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

Thanks Ray.

There is no delimiter in the file. so what can be used in Field() function. length of this value will vary everytime such as 1234 or 1 or 1234565 or 1223333333.

Can you please advise me how to write the Field() function in this situation.

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

Post by chulett »

He already stated the returned value was "field mark delimited". A Field Mark is one of the many System Variables you should be familiar with.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Its @FM
Arun
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

Thanks to All.

I have done this using the below code in command activity stage in sequence.

Code: Select all

value=$(cat FileName);printf "$value"
Post Reply