How to check the white spaces in a field of Char 40 Bytes

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
nsubbarao
Participant
Posts: 6
Joined: Tue Feb 19, 2008 5:12 pm
Contact:

How to check the white spaces in a field of Char 40 Bytes

Post by nsubbarao »

Hi All,

I have a field named AREA2 ( char 40 bytes). Say it has the following value " JT4VN13G4W36280604 98686" and I need to check whether the first 2 bytes are spaces and replace it with another string say "AB'.

I tried the following in my transformation.
If AREA2 [1,2] = ' '
then (AREA2 [1,1] : "AB" : AREA2 [4,37])
Else AREA2

and also this
If Alpha(AREA2 [1,2]) = 0
then (AREA2 [1,1] : "AB" : AREA2 [4,37])
Else AREA2

But I am not able to replace the spaces with "AB". Please help.
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

try the following:

If left(AREA2,2) = ' '
then ('AB':right(AREA2,len(AREA2)-2) )
Else AREA2
Post Reply