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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
GETTOK in WebFocus
 Login/Join
 
Member
posted
Hi! I have this code below. What I am trying to do here is separate first, middle init, and lastname.
The scenario here is that when I have a record with more that one spaces between the firstaname and middle
initial, it will not pick up the middle init in the webfocus. If I run this code in focus with two spaces
between the two fields, it will work fine. Thanks.

DEFINE FILE AFILE
LNAMETMP /A32 = GETTOK (INAME, 32, 1, ',', 32, LNAMETMP);
LNAME /A25 = EDIT (LNAMETMP, '9999999999999999999999999');
FNAMETMP1 /A32 = GETTOK (INAME, 32, 2, ',', 32, FNAMETMP1);
FNAMETMP2 /A32 = LJUST(32, FNAMETMP1, FNAMETMP2);
FNAMETMP /A32 = GETTOK (FNAMETMP2, 32, 1, ' ', 32, FNAMETMP);
FNAME /A15 = EDIT (FNAMETMP, '999999999999999');
MIDINITMP /A32 = GETTOK (FNAMETMP2, 32, 2, ' ', 32, MIDINITMP);
MIDINI /A15 = EDIT (MIDINITMP, '999999999999999');
END

TABLE FILE AFILE
PRINT
LNAME FNAME MIDINI
ON TABLE HOLD AS A1
END


WebFocus 7.1.6 Local Platform:Windows XP Pro/W3k Server. Use:Integration (Oracle,VMS), Reporting
 
Posts: 7 | Registered: May 25, 2004Report This Post
Virtuoso
posted Hide Post
We do something similar with our student names but due to system edit don't have the issue of extra spaces in the name between first and middle. Since GETTOK counts tokens, if you have two blanks in a row, thst would be two tokens. Our code:

TMP_NAME/A32 = GETTOK(STU_NAME,32,2,',',32,TMP_NAME);
SFX_NAME/A5 = GETTOK(STU_NAME,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(STU_NAME,32,1,',',32,LST_NAME);

I suppose you could check for blank middle name and do one more gettok for the next token in line.

MIDINIX/A15 = IF MIDINITMP EQ ' ' THEN GETTOK (FNAMETMP2,32,3,' ',32,MIDINIX) ELSE MIDINITMP.

MIDINI/A15 = EDIT (MININIX,'999999999999999');

Of course there are some people in the world who don't have middle names.
Wink


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Patino,

Not knowing how your data is structured (even from your description) I knocked up the following with four names repeated in four different (slightly) formats giving sixteen lines.

Please identify which one resembles your data or use the names to show how your data is structured.
APP FI AFILE DISK AFILE.MAS (LRECL 80
-RUN
-WRITE AFILE
-WRITE AFILE FILE=AFILE,SUFFIX=FOC
-WRITE AFILE SEGNAME=SEG1
-WRITE AFILE FIELD=SEQ,     ,I2    ,I2    , $
-WRITE AFILE FIELD=INAME,   ,A32   ,A32   , $
-RUN

CREATE FILE AFILE
MODIFY FILE AFILE
FIXFORM SEQ/A2 INAME/A32
DATA
 1Smith, John 
 2Johnson, Lyndon B 
 3Bush, George W 
 4Lincoln, Abraham 
 5Smith, John 
 6Johnson, Lyndon  B 
 7Bush, George  W 
 8Lincoln, Abraham 
 9Smith,John 
10Johnson,Lyndon B 
11Bush,George W 
12Lincoln,Abraham 
13Smith,John  
14Johnson,Lyndon  B 
15Bush,George  W 
16Lincoln,Abraham  
END
-RUN

DEFINE FILE AFILE
LNAME /A25 = GETTOK (INAME, 32, 1, ',', 25, LNAME);
FNAMETMP1 /A32 = GETTOK (INAME, 32, 2, ',', 32, FNAMETMP1);
FNAMETMP2 /A32 = LJUST(32, FNAMETMP1, FNAMETMP2);
FNAME /A15 = GETTOK (FNAMETMP2, 32, 1, ' ', 15, FNAME);
MIDINI /A15 = GETTOK (FNAMETMP2, 32, 2, ' ', 15, MIDINI);
END

TABLE FILE AFILE
PRINT LNAME FNAME MIDINI
BY SEQ
END
-RUN

You will notice that the first and third formats give no problems in deriving the middle initial, and that is because these are the ones without the double space. However, if you add this line as the first within your DEFINE, all four work OK and it might provide your solution.
INAME/A32 = STRREP(32, INAME, 2, '  ', 1, ' ', 32, INAME);

Also note that I have removed some superfluous code (the EDITs) from your example as you can achieve what you want without them.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Patino

please upgrade your signatue so we know your version number of WF.

Tony suggest the use of STRREP, but this won't work in the 5.x.x versions or earlier as far as I know.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Frank,

STRREP is in 5.3.2 but is not documented until 7.1.n. It does work in release 5.3.2 as that is the release that I was on when I first started using it.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
The SQUEEZ function is available in 5.3.3 (I am not sure about earlier version) this changes any numbe of spaces to a single space. Here is a sample with the EMPLOYEE file. I used a define field EMP_KEY to parse it peices at the spaces.

DEFINE FILE EMPLOYEE
EMP_KEY/A60 = EMP_ID || ' ' | LAST_NAME || ' ' | FIRST_NAME;
EMP_KEY_WK/A60 = SQUEEZ(60,EMP_KEY,'A60');
PART_1/A20 = GETTOK(EMP_KEY_WK,60,1,' ',20,'A20');
PART_2/A20 = GETTOK(EMP_KEY_WK,60,2,' ',20,'A20');
PART_3/A20 = GETTOK(EMP_KEY_WK,60,3,' ',20,'A20');
END

TABLE FILE EMPLOYEE
PRINT
PART_1
PART_2
PART_3
EMP_KEY
END


Jim Morrow
Web Focus 7.6.10 under Windows 2003
MVS 7.3.3



 
Posts: 129 | Registered: June 01, 2005Report This Post
Platinum Member
posted Hide Post
The HTML goto me, The
EMP_KEY/A60 = EMP_ID || ' ' | LAST_NAME || ' ' | FIRST_NAME;

should have three spaces between the quotes

EMP_KEY/A60 = EMP_ID || '   ' | LAST_NAME || '   ' | FIRST_NAME;


Jim Morrow
Web Focus 7.6.10 under Windows 2003
MVS 7.3.3



 
Posts: 129 | Registered: June 01, 2005Report This Post
Virtuoso
posted Hide Post
Jim's probably hit on the best solution. Run your name string through the SQUEEZ function first - this would eliminate any double spaces. Then use the GETTOK function from there.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Member
posted Hide Post
Thanks guys for your feedback. Tony, that is exactly the record format. I also noticed that some of the records have three or four spaces between the first and middle name. Fortunately, out of thirty thousand records there were only 19 with this problem so my boss just told me to tell the user to have them fix it. But in the future I will definately try the SQUEEZ. Thanks again guys for the information.

Joli


WebFocus 7.1.6 Local Platform:Windows XP Pro/W3k Server. Use:Integration (Oracle,VMS), Reporting
 
Posts: 7 | Registered: May 25, 2004Report This Post
Master
posted Hide Post
As someone that deals with name issues all the time, I would suggest that you use something different other than blank as your token and use something that is less likly to be part of a name, i.e. '^' or '%'. The reason is some people have a blank in their name. For example, even if you have a suffix field, some people will still enter SMITH JR in the last name. In that case, you would get JR as the PART_3. Just a suggestion.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Virtuoso
posted Hide Post
quote:
As someone that deals with name issues all the time, I would suggest that you use something different other than blank as your token and use something that is less likly to be part of a name, i.e. '^' or '%'. The reason is some people have a blank


Wonderful thought, but some of us have no choice as that's the way the name is stored in the system we support.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders