🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

6 total messages Started by Bored33600 Tue, 24 Mar 1998 00:00
Title "Mr & Mrs" etc extraction from a string - Routine wanted
#11
Author: Bored33600
Date: Tue, 24 Mar 1998 00:00
23 lines
949 bytes

I have a string which contains the title (eg Mr, Mr & Mrs etc) together with
initials
and a surname.

I need a routine/section to split these up into Title & Initials in one field
and surname in another.

E.g.  

Original field = Mr & Mrs A B Smith
to be split into

Field 1 = Mr & Mrs A B
Field 2 = Smith

it needs to be able to handle things like 'A B Smith' aswell as all (most)
other permutations you can imagine.

Someone somewhere nust have done this.

Any help appreciated - Thanx.
Re: Title "Mr & Mrs" etc extraction from a string - Routine wanted
#17
Author: The Programmer
Date: Sat, 11 Apr 1998 00:00
36 lines
1545 bytes
Received any responses to this request??

--
The Programmer Has Spoken -- SO THERE!

Bored33600 wrote in message
<1998032408050901.DAA25504@ladder03.news.aol.com>...
>
>I have a string which contains the title (eg Mr, Mr & Mrs etc) together
with
>initials
>and a surname.
>
>I need a routine/section to split these up into Title & Initials in one
field
>and surname in another.
>
>E.g.
>
>Original field = Mr & Mrs A B Smith
>to be split into
>
>Field 1 = Mr & Mrs A B
>Field 2 = Smith
>
>it needs to be able to handle things like 'A B Smith' aswell as all (most)
>other permutations you can imagine.
>
>Someone somewhere nust have done this.
>
>Any help appreciated - Thanx.
>
>
>
>
Re: Title "Mr & Mrs" etc extraction from a string - Routine wanted
#18
Author: Rick Smith
Date: Sun, 12 Apr 1998 00:00
18 lines
1137 bytes

The Programmer wrote in message <352fdafc.0@news1.ibm.net>...
>Received any responses to this request??
>
>--
>The Programmer Has Spoken -- SO THERE!
>
>Bored33600 wrote in message
><1998032408050901.DAA25504@ladder03.news.aol.com>...
>>
>

Several responses were posted. I found the responses
in DejaNews.

Rick Smith
----------------------------------------------------
Re: Title "Mr & Mrs" etc extraction from a string - Routine wanted
#19
Author: ARN B
Date: Sun, 12 Apr 1998 00:00
91 lines
4282 bytes
I did something like this for a client about 10 years ago and it was a
nightmare. My client had unstructured names in both first-last and last-first
format. I can't post the code but I can give you some suggestions..

Establish an array as follows
01 Word-array occurs 15 times indexed by i-array.
     03  WA-word               pic x(20).
     03  WA-delimiter         pic x.
     03  WA-Length           pic s9(4) comp.

Initialize word-array, then unstring the name data into Wa-Word (1)...(15)
delimiting by all space, comma, period and any other punctuation character the
user may toss in and be sure to save delimters, word length and the total
number of words in the string.  If the users always enter the name as: prefix,
first, middle,  last, suffix,  you can make some inferences up front. However
if you have a mixed mode with First-last and Last-first name formats it's more
complex. Usually a comma in the name string indicates a last first format.

After the unstring and assuming you always have first-last format:

Toss away any words that are just the & sign

You will need a prefix table
Things like MR MRS MS SGT DR Reverend ....check words one and two for these
when you find one move it to your prefix field(s)

You will need a suffix table for things like
II III MD DDS PA PHD... check the last few words for these,  multiples are
common. When one of these are found move it to your Suffix field(s)

You will need some logic to handle names like O Brien where the quote is not
included. Don't forget other multiple word last name prefixes like DE DI LE,
LA, TEN, VAN, DER...etc Be real careful with this, I encountered last names of
LE, LI and VAN and first names of VAN.  The letters D and  O presented a real
problem, since they could be a first name initial,  middle initial or part of
the last name. The telephone directory proved an ideal source for these names
and eventually they were added to surname tables for verification. For example
O Smith would not  be combined as a two word last name unless it was keyed with
a quote after the O.  There are some names with two word prefixes and no
quotes: Van Der for example.

Obviously it's  more complex than this, but this is a start and I hope it helps
a bit.
Arn

|***********************************************************
SPAM killer in use, please remove NOJUNK from return
address or click here to mailto:ARNB@myself.com
"It isn't pollution that's harming the environment. It's the impurities
 in our air and water that are doing it."  Vice President Dan Quayle
******************************************************************************


The Programmer wrote:

> Received any responses to this request??
>
> --
> The Programmer Has Spoken -- SO THERE!
>
> Bored33600 wrote in message
> <1998032408050901.DAA25504@ladder03.news.aol.com>...
> >
> >I have a string which contains the title (eg Mr, Mr & Mrs etc) together
> with
> >initials
> >and a surname.
> >
> >I need a routine/section to split these up into Title & Initials in one
> field
> >and surname in another.
> >
> >E.g.
> >
> >Original field = Mr & Mrs A B Smith
> >to be split into
> >
> >Field 1 = Mr & Mrs A B
> >Field 2 = Smith
> >
> >it needs to be able to handle things like 'A B Smith' aswell as all (most)
> >other permutations you can imagine.
> >
> >Someone somewhere nust have done this.
> >
> >Any help appreciated - Thanx.
> >
> >
> >
> >
Re: Title "Mr & Mrs" etc extraction from a string - Routine wanted
#20
Author: Judson McClendon
Date: Sun, 12 Apr 1998 00:00
33 lines
2074 bytes
ARN B wrote:
> I did something like this for a client about 10 years ago and it was
> a nightmare. My client had unstructured names in both first-last and
> last-first format. I can't post the code but I can give you some
> suggestions..
>
> Establish an array as follows
> 01 Word-array occurs 15 times indexed by i-array.
>     03  WA-word               pic x(20).
>     03  WA-delimiter         pic x.
>     03  WA-Length           pic s9(4) comp.


Naughty, naughty!  Using OCCURS with an 01 violates the concept of the
01 being a single 'record'.  What would you expect this construct to
do, if placed under an FD, for example?

ANSI X3.23-1985, ISO 1989-1985, page VI-26:

5.8  THE OCCURS CLAUSE
  ...
5.8.3  Syntax Rules

  (1) The OCCURS clause must not be specified for a data description
      entry that:

      a. Has a level-number of 01, 66, 77, or 88, or ...
-- 
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the
judmc123@mindspring.com   world to save sinners  (1 Timothy 1:15)
(please remove numbers from email id to respond)
Re: Title "Mr & Mrs" etc extraction from a string - Routine wanted
#22
Author: ARN B
Date: Tue, 14 Apr 1998 00:00
58 lines
2900 bytes
  Ok you are correct. Obviously an 01 with an occurs wont work. Change it
to
01 word-extract-table.
 02    Word-array occurs 15 times indexed by i-array.
     03  WA-word               pic x(20).
     03  WA-delimiter         pic x.
     03  WA-Length           pic s9(4) comp.

Next time I will attempt to "compile" my messages to eliminate any "E" or
"S"  level errors and promise not to respond at 2AM.

Arn



Judson McClendon wrote:

> ARN B wrote:
> > I did something like this for a client about 10 years ago and it was
> > a nightmare. My client had unstructured names in both first-last and
> > last-first format. I can't post the code but I can give you some
> > suggestions..
> >
> > Establish an array as follows
> > 01 Word-array occurs 15 times indexed by i-array.
> >     03  WA-word               pic x(20).
> >     03  WA-delimiter         pic x.
> >     03  WA-Length           pic s9(4) comp.
>
> Naughty, naughty!  Using OCCURS with an 01 violates the concept of the
> 01 being a single 'record'.  What would you expect this construct to
> do, if placed under an FD, for example?
>
> ANSI X3.23-1985, ISO 1989-1985, page VI-26:
>
> 5.8  THE OCCURS CLAUSE
>   ...
> 5.8.3  Syntax Rules
>
>   (1) The OCCURS clause must not be specified for a data description
>       entry that:
>
>       a. Has a level-number of 01, 66, 77, or 88, or ...
> --
> Judson McClendon          This is a faithful saying and worthy of all
> Sun Valley Systems        acceptance, that Christ Jesus came into the
> judmc123@mindspring.com   world to save sinners  (1 Timothy 1:15)
> (please remove numbers from email id to respond)



--
|***********************************************************
SPAM killer in use, please remove NOJUNK from return
address or click here to mailto:ARNB@myself.com
"It isn't pollution that's harming the environment. It's the impurities
 in our air and water that are doing it."  Vice President Dan Quayle
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads