15 pts.
 Identifying Series of numbers in a string
Hi, 
I seek your help in designing a RPG /RPGLE program which will identify the series of numbers among the character string (like phone #s, Credit card number, etc..)

Ex: If String A  = 'ABCDSSS123456DDB7BB' My result field should only fetch '123456' and not '7'.  (in this example '7' is not among series). 


Can someone enlighten ?




Software/Hardware used:
RPG/400 , ILE
ASKED: Feb 10, 2012  10:06 PM GMT
UPDATED: March 17, 2012  5:28:39 AM GMT
66,955 pts.

Answer Wiki:
Last Wiki Answer Submitted:  Mar 17, 2012  5:28 AM (GMT)  by  TomLiotta   66,955 pts.
Latest Answer Wiki Contributors:  Rebek4love   3,500 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




 

Phone numbers, credit card numbers and others are often entered with special characters like ‘555-1234′. What controls are in place to limit what your program might run into?

Tom

 66,955 pts.

 

Sounds like you want to:
1. find the position of the first digit in the string
2, Then find the first non-digit
3. Then extract the substing bounded by those positions.
Hope this helps

 36,420 pts.

 

Also, how long can the “strings” be? If these are basic string values 100 or 200 bytes or so long, it might be very different from handling a 16MB XML document or something like that.

Tom

 66,955 pts.

 

Philip,
Thanks for your response. I will work towards your suggestion.

Tom,
In my case, I am limiting the user from entering sensitive data in comments / notes section. Hence we may get any thing !!!. But we are limiting the program to read series of numerals (a.ka credit card - 16 digits / ph number 10 digits) ..

Regards
Kannan

 15 pts.

 

(in this example ‘7′ is not among series)

Does that simply mean that ‘7′ is just a single digit, so it can be ignored?

And again, how long are the strings? A basic estimate to get an idea about efficient techniques is needed.

Tom

 66,955 pts.

 

And, can a string have more than one series?

Tom

 66,955 pts.

 

%CHECK() is your friend. Use it to determine the start of your sequence(s).

From there you can determine what to do.

 4,945 pts.