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.
Preserving part of a token
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: