select substring with field function

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
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

select substring with field function

Post 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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
zbethem
Charter Member
Charter Member
Posts: 19
Joined: Tue Mar 14, 2006 2:12 pm
Contact:

Post 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.
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Thanks all, It's very easy ! and it resolve my problem

Cool !
Post Reply