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.
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.
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:
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.
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, 2004
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.
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, 2007
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
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, 2006
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, 2004