Hi
we have a situation where we need to validate the identification number we are getting from the source.The number is 17 characters in length and may contain alphanumeric characters.Now the number can have alphabets A-Z and 0-9 excluding I,O,Q.It should not contain any special characters like *,/.etc etc.
Can anyone provide me insight how this can be acheived via a routine or other means.The source is a flatfile.
Any help in this regard would be appreciated.
Thanks
Data Validation
Moderators: chulett, rschirm, roy
Shiva,
the built-in functions cannot handle this request directly, you would need to a short function yourself to do this.
If you look at the ASCII chart you will see that your legal character set does begin with the 0 and ends with a capital Z so it makes your job much easier. If you have trouble writing a function from this rough pseudocode outline then don't hesitate to post your code and you'll get assistance in this thread.
the built-in functions cannot handle this request directly, you would need to a short function yourself to do this.
Code: Select all
CleanIdentificationNumber(InString)
{for each character in the string}
{if < '0' or > 'Z' then remove}
{if I, O or Q then remove}
{next character}
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Try the following
Code: Select all
Convert(IConv(IConv(InpString, "MC/N"), "MC/A"): "IOQ", "", InpString)
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
How about the following, which returns 0 for a valid string and a non-zero value otherwise?
Code: Select all
Len(TheString) <> 17 Or Len(Convert("ABCDEFGHJKLMNPRSTUVWXYZ0123456789","",TheString))
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.