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     LCWord and single quote

Read-Only Read-Only Topic
Go
Search
Notify
Tools
LCWord and single quote
 Login/Join
 
Silver Member
posted
My organization is new to WebFOCUS, so please be gentle...

We are trying to use LCWORD on some data to show it in proper case. The problem is we have single quotes in some of the columns.

For example: ST. JOHN'S
When we use LCWORD, we are getting St. John'S

Is there a way around this?

Thanks

Wayne
 
Posts: 35 | Registered: April 20, 2006Report This Post
Virtuoso
posted Hide Post
We faced that with Mc Mac and so on, used over lay and index I bet you haven't run into III coming out Iii.

You could replace the " ' " with say another character and then convert it back. We have names with the ' ` ' character that caused us some issues. This is not pretty and there may be better ways, but here is an example:
AA003 is the name field in our system, this is ancient of days code.

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;


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Silver Member
posted Hide Post
Thanks for the reply...

I guess our problem is that sometimes we will have St. John's and sometimes we will have O'Neil...

So, I guess we will just need to figure that out or handle it in the database... Anyone else have this same issue?

Wayne
 
Posts: 35 | Registered: April 20, 2006Report This Post
Platinum Member
posted Hide Post
Wayne,

Have you tried using CTRAN to change the quote to something else? Something like this:

NEWFIELD/A15 = CTRAN(15,OLDFIELD,39,7,'A15');
MIXFIELD/A15 = LCWORD(15,NEWFIELD,'A15');
NEXTFIELD/A15 = CTRAN(15,MIXFIELD,7,39,'A15');

You can find CTRAN in the Using Functions manual. 39 is the ascii representation for single quote. You'll need the EBCDIC representation if your data is on a mainframe. 7 is the ascii for BELL. I just picked something that isn't going to be in the data.

By the way, I've had trouble using LCWORD on anything more than 17 characters long, so be alert for that.


dwf
 
Posts: 135 | Location: Portland, OR | Registered: March 23, 2005Report This Post
Silver Member
posted Hide Post
Thanks for the advice.. That sounds like something we can definitely try. Also, thanks for the heads up on the possible length issue.

Wayne
 
Posts: 35 | Registered: April 20, 2006Report This Post
Expert
posted Hide Post
-* given that test1 contains
FRED  O'MERTZ
ETHEL O'MERTZ
LUCY  RICARDO
RICKY O'LUCY

with a master FNAME/A5 FILL/A1 LNAME/A7
then...
FILEDEF TEST1 DISK D:\IBI\APPS\TEST1.TXT
DEFINE FILE TEST1
POSIT/I2   = POSIT( LNAME, 7,'''' , 1, POSIT );
INLENGTH/I2= 7 - POSIT  ;
LNAME1/A7  = IF POSIT EQ 0 THEN '' ELSE
             SUBSTR( POSIT , LNAME , 1,        POSIT, POSIT, LNAME1 );
LNAME2/A7  = IF POSIT EQ 0 THEN LNAME ELSE
             SUBSTR( 7,      LNAME , POSIT+1 , 7, INLENGTH , LNAME2); 
LNAME2/A7  = LCWORD( 7, LNAME2, LNAME2); 
FNAME2/A5  = LCWORD( 7, FNAME,FNAME);
LNAME3/A14 =  LNAME1 || LNAME2 ;
LNAME4/A7  = SUBSTR( 14, LNAME3 ,1, 7, 14, LNAME4 ) ;
END

TABLE FILE TEST1 PRINT * POSIT INLENGTH FNAME2 LNAME1 LNAME2 LNAME3 LNAME4
END
-RUN
-* first find the position of the apostrophe, if 0 then no apos
-* then split the last name into 2 parts using Substring function, based on the position
of the apos
-* then LCWORD the 2nd part of the lastname and glue them back together.
LNAME4 will give you back your answer set,
O'Mertz
O'Mertz
Ricardo
O'Lucy
also, i haven't found any char length issues at my site for LCWORD.




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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     LCWord and single quote

Copyright © 1996-2020 Information Builders