Page 1 of 1

select substring with field function

Posted: Thu May 18, 2006 2:25 pm
by kjaouhari
Hi all !

I try to use the field function but I don't realy understand, So this is that I want to do (from a sequential file to an other sequential file) :

EPF1.10.58op.20060514
KK.4444.5.98

I want just to return the first and fourth substring, dot . is the delimiter

result :

EPF120060514
KK98

I think I have to use the field function, may be, but I'm not familiar with could you help me

Thanks

Posted: Thu May 18, 2006 2:36 pm
by DSguru2B
You are correct.
The field function will achieve your task.
Use this

Code: Select all

FIELD(In.Link,".",1):FIELD(In.Link,".",4)
where In.Link will be your input

And how the field function works, look in your DataStage help. It has a clear description of the function.
Regards,

Posted: Thu May 18, 2006 2:44 pm
by zbethem
If your job is defined as follows:

Code: Select all

seq file --> transformer --> seq file2
Why don't you just define the first sequential file stage with a '.' as a delimeter, pick the 1st and 4th columns in the transformer, then feed it to the second sequential file.

Ofcourse, you can only do this if the source sequential file will always have 4 columns.

Posted: Thu May 18, 2006 2:59 pm
by kjaouhari
Thanks all, It's very easy ! and it resolve my problem

Cool !