Identifying Series of numbers in a string

15 pts.
Tags:
AS400 RPGLE
RPG/400
RPGLE
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

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • philpl1jb
    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
    51,235 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • kaperuma
    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 pointsBadges:
    report
  • TomLiotta
    (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
    125,585 pointsBadges:
    report
  • TomLiotta
    And, can a string have more than one series? Tom
    125,585 pointsBadges:
    report
  • Splat
    %CHECK() is your friend. Use it to determine the start of your sequence(s). From there you can determine what to do.
    7,625 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following