× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Are there commas in this field? Any rules that you'd like to share, so we
have an idea of what data you're expecting in this field?

This is off the top of my head and untested. Here, name(x) could be first,
middle, last ... depending upon how you use them within the program...

Given that:
incomingName is the name to be parsed
fullName is a varying length character field, local or otherwise unused
name is an array of (optionally varying length) character fields with
more than one (3?) elements.

On exit
i will contain the number of name elements that are populated + 1
name array will have the portions of the name broken out where separated
by
any number of spaces

Names like Julio de Vegas et cetera may give you fits.



fullName = %Trim(incomingName) ;
For I = 1 to %Elem(name) ;
Clear name(I) ;
EndFOR ;
I = 1 ;
DoW I < %Elem(name) and %Len(fullName) > 0 ;
P = %Scan(' ': fullName) ;
If (p > 0) ;
Name(i) = %Trim(%Subst(fullName: 1: p)) ;
fullName = %Trim(%Subst(fullName: p)) ;
I += 1 ;
EndIF ;
EndDO ;
If name(I) = '' ;
name(I) = fullName ;
Else ;
Name(I) += ' ' + fullName ;
EndIF

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"The Yankees, as I told you later, are in a slump."
-- baseball great Dizzy Dean


Does anybody have a link or procedure they are willing to share?

I have a field that contains a name (ie: first mi last or first last or
a
ton of every variation you can think of) But I need it broken out in 3
fields
first mi lastname.

Any help would be appreciated.

Thanks, Tim

This e-mail message, including any attachments, is for the
sole use of the intended recipient(s) and may contain
confidential or privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.

Think Green! Please do not print this e-mail unless you need to. Thank
you.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.