Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Separating variable-length text within a field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Separating variable-length text within a field
 Login/Join
 
<fudd>
posted
Can't get my non-programmer's mind around this one:

How do I parse out the first and last names from a 32-character field formatted as [last_name, first_name] so that they can be re-assembled for a mail-merge?

Thanks!
 
Report This Post
<Vipul>
posted
Try this
LAST_NAME/A30 = GETTOK(NAME, 30, -1, ',', 30, LAST_NAME);

This will extract the last name. This assumes ',' as the delimiter.

Vipul
 
Report This Post
<fudd>
posted
Ok. So I ran it as,

FIRST_NAME/A30 = GETTOK(STU_NAME, 30, -1, ',', 30, FIRST_NAME);

which works fine to get most of the first names. But it turns out that there are some other variations in the field:

Smith, John (ok)
Smith, John J. (ok)
Smith, John James (ok)
Smith, John James, JR. (not ok)
Smith, John James, II (not ok)

I hadn't realized that there were two commas in some of the names. Any suggestions?
 
Report This Post
<Vipul>
posted
Just quickly-
Use only first two tokens and discard the others. i will give you the code later...have to go.
 
Report This Post
Master
posted Hide Post
Fudd, you might try this. It puts everything before the first comma in LASTNAME and put everything after the first comma in RESTOFNAME. NAME is the REALFIELD in the Database. Eeker

DEFINE FILE xxxxx
SPACEPOS/I2 = POSIT(NAME, 32, ',' , 1, SPACEPOS);
LASTNAME/A32 = SUBSTR(32, NAME, 1, SPACEPOS -1, SPACEPOS -1, LASTNAME);
RESTOFNAME/A32 = SUBSTR(32, NAME, SPACEPOS +1, 32, 32 - SPACEPOS -1, RESTOFNAME);
END

TABLE FILE xxxxx
PRINT
SPACEPOS
LASTNAME
RESTOFNAME
END
 
Posts: 865 | Registered: May 24, 2004Report This Post
<fudd>
posted
Thanks. I tried your suggestion and it yielded some odd results with the last name. It appends portions of the previous record's last name to the current record. I haven't tried to tinker with it yet.

I might be asking for too much from a single approach. So far, the code below works relatively well. It separates out the the first name from the middle name or middle initial and then, when present, hangs the 'JR.' or 'III' suffix on the end. Hyphenated names, either first or last, come out ok. It falls apart though when there are compound last names without the hyphen like 'Smith Jones, John Edward'. Might have to separate those out first and bring them back in later.


DEFINE FILE HOLD1
SUFF/A4 = GETTOK(STU_NAME, 32, +3, ',', 32, SUFF) ;
F_NAME/A18 = GETTOK(STU_NAME, 30, +2, ' ', 30, F_NAME) ;
L_NAME/A30 = GETTOK(STU_NAME, 30, +1, ',', 30, L_NAME) ;
END
-*
TABLE FILE HOLD1
PRINT F_NAME L_NAME SUFF
END
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Separating variable-length text within a field

Copyright © 1996-2020 Information Builders