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     Converting LASTNAME,FIRSTNAME to Firstname Lastname

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Converting LASTNAME,FIRSTNAME to Firstname Lastname
 Login/Join
 
Guru
posted
What steps are required to:

1.) Remove the comma
2.) Swap around last name and first name
3.) Once I'm there I'll use LCWORD

Focal Point Rocks!


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 238 | Location: Atlanta, GA/Rehovot, Israel | Registered: May 06, 2003Report This Post
Expert
posted Hide Post
don't remove the comma
use it as a marker to separate last from first
take the POSIT of the comma (use the POSIT function)
then the SUBSTR function to edit your string into 2 bits, last name = position 1 to the POSIT of the comma, firstname=position posit of the comma + 1 to end or arglen of the inbound string.
now you have two fields, last and first
reverse them
glue them back together
and go to lunch.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
1) FNAME=GETTOK(&NAME,&NAME.LENGTH,1,',',25,'A25')
LNAME=GETTOK(&NAME,&NAME.LENGTH,2,','25,'A25');

2) NAME=LNAME | FNAME


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
We use gettok and substring: Here's what we go through to change our name to a lower case name and handle the Mc.. Mac... Hope the code comes through.
I_IDXA/I2 = IF AA003 CONTAINS '`' THEN
POSIT(AA003,32,'`',1,I_IDXA) ELSE 0;
AA003XYZ/A32 = IF I_IDXA EQ 0 THEN AA003 ELSE
OVRLAY(AA003,32,' ',1,I_IDXA,AA003XYZ);
TMP_NAME/A32 = GETTOK(AA003XYZ,32,2,',',32,TMP_NAME);
SFX_NAME/A5 = GETTOK(AA003XYZ,32,3,',',5,SFX_NAME);
FMN_NAME/A32 = LJUST(32,TMP_NAME,FMN_NAME);
FST_NAME/A32 = GETTOK(FMN_NAME,32,1,' ',32,FST_NAME);
-*MDL_NAME/A32 = GETTOK(FMN_NAME,32,2,' ',32,MDL_NAME);
LST_NAME/A32 = GETTOK(AA003,32,1,',',32,LST_NAME);
-*EXPNDNME/A72 = FMN_NAME || (' ' | LST_NAME | ' ') || SFX_NAME || '*';
EXPNDNME/A72 = FST_NAME || (' ' | LST_NAME | ' ') || SFX_NAME || '*';
CMPRSNME/A32 = GETTOK(EXPNDNME,66,1,'*',32,CMPRSNME);
SALX/A4 = LCWORD(4,AA008,SALX);
SAL/A5 = IF SALX EQ ' ' THEN ' ' ELSE SALX || '.';
FUL_NAME/A32 = LJUST(32,CMPRSNME,FUL_NAME);
FULXNAMA/A32 = LCWORD(32,FUL_NAME,FULXNAMA);
I_IDX/I2 = IF FULXNAMA CONTAINS ' Mc' THEN
POSIT(FULXNAMA,32,' Mc',3,I_IDX) ELSE 0;
I_IDX2/I2 = I_IDX + 3;
I_IDX3/I2 = I_IDX + 4;
GETCHAR/A1 = IF I_IDX EQ 0 THEN ' ' ELSE
SUBSTR (32,FULXNAMA,I_IDX2,I_IDX3,1,GETCHAR);
NEWCHAR/A1 = UPCASE(1,GETCHAR,NEWCHAR);
FULXNAMT/A32 = IF GETCHAR EQ ' ' THEN FULXNAMA ELSE
OVRLAY(FULXNAMA,32,NEWCHAR,1,I_IDX2,FULXNAMT);
I_IDXA/I2 = IF FULXNAMT CONTAINS ' Mac' THEN
POSIT(FULXNAMT,32,' Mac',4,I_IDX) ELSE 0;
I_IDXB/I2 = I_IDXA + 4;
I_IDXC/I2 = I_IDXA + 5;
GETCHARA/A1 = IF I_IDXA EQ 0 THEN ' ' ELSE
SUBSTR (32,FULXNAMT,I_IDXB,I_IDXC,1,GETCHARA);
NEWCHARA/A1 = UPCASE(1,GETCHARA,NEWCHARA);
FULXNAMZ/A32 = IF GETCHARA EQ ' ' THEN FULXNAMT ELSE
OVRLAY(FULXNAMT,32,NEWCHARA,1,I_IDXB,FULXNAMZ);
I_IDX4/I2 = IF FULXNAMZ CONTAINS ' Iii' THEN
POSIT(FULXNAMZ,32,' Iii',4,I_IDX4) ELSE 0;
I_IDX5/I2 = I_IDX4 + 1;
GETCHAR6/A3 = IF I_IDX4 EQ 0 THEN ' ' ELSE 'III';
FULXNAMW/A32 = IF GETCHAR6 EQ ' ' THEN FULXNAMZ ELSE
OVRLAY(FULXNAMZ,32,GETCHAR6,3,I_IDX5,FULXNAMW);
I_IDX6/I2 = IF FULXNAMW CONTAINS ' Ii' THEN
POSIT(FULXNAMW,32,' Ii',3,I_IDX6) ELSE 0;
I_IDX7/I2 = I_IDX6 + 1;
GETCHAR7/A3 = IF I_IDX6 EQ 0 THEN ' ' ELSE 'II';
FULXNAME/A40 = IF GETCHAR7 EQ ' ' THEN FULXNAMW ELSE
OVRLAY(FULXNAMW,32,GETCHAR7,2,I_IDX7,FULXNAME);
FRSTNAMX/A32 = LCWORD(32,FST_NAME,FRSTNAMX);
NAME_LEN/I2 = ARGLEN(32,FRSTNAMX,NAME_LEN);
PER_POS/I2 = IF NAME_LEN LE 2 THEN POSIT(FRSTNAMX,32,'.',1,PER_POS)
ELSE 0;
PERNAM/A34 = '. ' | LST_NAME;
FRSTNAMT/A38 = IF NAME_LEN GT 2 THEN FRSTNAMX
ELSE IF (PER_POS EQ 0) AND (NAME_LEN EQ 2) THEN FRSTNAMX ELSE
IF SALX EQ ' ' THEN 'M' || PERNAM ELSE
SALX || PERNAM;
FRSTNAME/A40 = LCWORD (38,FRSTNAMT,FRSTNAME);


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Guru
posted Hide Post
Thanks for all the help. Susannah's suggestion worked the best.


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 238 | Location: Atlanta, GA/Rehovot, Israel | Registered: May 06, 2003Report This Post
Virtuoso
posted Hide Post
Just be on the lookout for additional fields in the input - e.g.
"King, Martin L., Jr"

The GETTOK approach will discard the third token, while Susannah's will combine it with the 2nd, comma and all, yielding
"Martin L., Jr., King"


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report 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     Converting LASTNAME,FIRSTNAME to Firstname Lastname

Copyright © 1996-2020 Information Builders