Read three charecters after decimal

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
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Read three charecters after decimal

Post by adams06 »

Hi,

I have to read the last three charecters after the decimal, how can i do this.

ex: 111-222.xyz
222-333-s2.abc
111-444_c_1.asd

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

Post by chulett »

Is there always just one decimal point? Is is alright to take everything after it or just literally the first three characters?

Use the FIELD function to take the second field based on the dot as the delimiter. Substring afterwards to 3 if that's all you need.
-craig

"You can never have too many knives" -- Logan Nine Fingers
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Read three charecters after decimal

Post by adams06 »

Hi,

I need to read the extensions of file.

i am using this code:

if Trim(Field(DSLink.field,'.',2))[1,3] = 'xyz' Then 'X' else ''

Thanks


chulett wrote:Is there always just one decimal point? Is is alright to take everything after it or just literally the first three characters?

Use the FIELD function to take the second field based on the dot as the delimiter. Substring afterwards to 3 if that's all you need.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

You can try
Right (DSLink.field, 3)
if you are sure of every file having an extension 3 character long.
Success consists of getting up just one more time than you fall.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Re: Read three charecters after decimal

Post by meena »

Hi adams06
Can you try something like this:

Code: Select all

 
If Field(Trim(DSLink.field),'.',2)=xyz then X else ''
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,
you can try this too..

Code: Select all

 if DsLink['.',1,1] = 'xyz' then 'X' else '' 
Thanks,
Anupam
Post Reply