Reding Unix Output inDS routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Balakrishnan
Participant
Posts: 1
Joined: Tue Feb 13, 2007 8:37 am

Reding Unix Output inDS routine

Post by Balakrishnan »

Hi All,
We are reading environmental parameters from DSRoutine. (Using unix cmd 'echo $ROOT_DIR') The value returned contains a new line character

I have tried using trim functions
as below

var1 = Trim(UnixOutput,'')

var1 = Trim(UnixOutput,'@FM','')

var1 = Trim(UnixOutput,' ','')

can anybody tell me what is @FM

But still I get the same error and the value appended with some spacesand the control goes to the next line

please suggest on this?
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post by boxtoby »

@FM is char(254) and is used by DataStage as a separator on many occasions. I think its the separator for arrays, for example.

I would try using the ereplace function:

ereplace(SourceString, SubString2replace, ReplacementSubString)

Its fairly easy to use and the ReplacementSubString in this case is blank.
Bob Oxtoby
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

UnixOutput, is this the Output from DSExecute() ?
If yes then it is a dynamic array where every element is seperated by @FM which in reality are the line feeds. If you just want the first element you can just request for the same by using

Code: Select all

var1 = UnixOutput<1>
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Reding Unix Output inDS routine

Post by chulett »

Balakrishnan wrote:var1 = Trim(UnixOutput,'@FM','')
The quotes are your problem, they turn the Field Mark system variable into just another string.

Code: Select all

var1 = Trim(UnixOutput,@FM,'')
Will work a little more better. :wink:
-craig

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