Page 1 of 1

Reding Unix Output inDS routine

Posted: Tue Feb 20, 2007 7:04 am
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?

Posted: Tue Feb 20, 2007 7:24 am
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.

Posted: Tue Feb 20, 2007 7:27 am
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>

Re: Reding Unix Output inDS routine

Posted: Tue Feb 20, 2007 8:27 am
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: