find PO BOX in a string

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rl
Participant
Posts: 14
Joined: Sun Sep 21, 2008 2:37 am

find PO BOX in a string

Post by rl »

Hi,

Could anyone help me find a datastage function equivalent to like operator in sql '%PO BOX%'.

requirement:

the address column may have PO BOX in the string (length=80) and may be populated in any place (position in the string). all i need to do is to find if the string has PO BOX poplutaed or not.

example 1: "PMB 245 PO BOX 2020"
example 2: "404 WESTERN AVENUE"
example 3: "HI PO BOX 123 XYZ123"

DS function should say 1 for example 1
DS function should say 0 for example 2
DS function should say 1 for example 3

Thanks and Regards,
rl
VIJAYRL
ETLJOB
Participant
Posts: 87
Joined: Thu May 01, 2008 1:15 pm
Location: INDIA

Post by ETLJOB »

Just try this...I haven't try my hands on this.

Code: Select all

If Count(Column_name,'PO BOX') > 0 Then 1 Else 0
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Index() function is the one you want.

Code: Select all

(Index(InLink.TheString, "PO BOX", 1) > 0)
or you might add other variations

Code: Select all

(Index(InLink.TheString, "PO BOX", 1) > 0) Or (Index(InLink.TheString, "POBOX", 1) > 0)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply