Preserving part of a token

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Preserving part of a token

Post by U »

We are seeking to standardize phone numbers, which sometimes have an international direct dialling prefix (001 or 011) as part of a contiguous string.

Is there some way in PAL that we can extract these digits and keep only the remainder?

For example, assuming a wholly numeric token, 00161299556022, the IDD code is 011, the country code is 61, the area code is 2 and the remainder is the line number, and may have variable length (6-8 digits).

We can extract the first three digits using something like [1](1:3) but how can we keep the remainder, the length of which is variable?

Thank you for your time.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The substring operator is generous in that you can specify an ending position beyond the end of the token and it will return only up to the end of the token. In your case, something like the following should work, assuming a numeric token.

Code: Select all

; Numeric token beginning 001 or 011 - remove IDD code from front
^ [ {}(1:3) = "001" | {}(1:3) = "011" ]
COPY [1](1:3) {IDDCode}
COPY [1](4:99) temp
RETYPE [1] ^ temp temp
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Post by U »

That works well, thank you.

Can something similar be done with other token types (principally &)?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Should be OK. Try it.
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