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.
In the past we've coded our own user written subroutine, HDRTOK, to work around the defects in GETTOK but we're wondering if there is an IBI supported alternative at this time.
-James
WF 7.1.6 moving to WF 7.7, Solaris 10, HTML,PDF,XL
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003
you can use POSIT and SUBSTR if you're looking to search a string, and you're not sure exactly what to expect. GETTOK has a specific purpose, for which it works just fine. You're trying to read nulls, not blanks. GETTOK is returning exactly what it is supposed to. If you use POSIT and search for commas, you'll have explicit control.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
This MAY be a bug with gettok as I havle also used it for a long time. The same problem occurs with blanks too. See the table request using the car file below where I define another string with blanks instead of commas STR2. The same thing happens. This behavior seems to occur only when the token (blank or comma) happens to the first character in the string being parsed. As per RichH , inserting a blank before the commas at the beginning, and it works. The only thing I can say is that (kind of agreeing with Susannah) if I was to use it with blank as the token and I encountered a string where the first byte(S) were blank, the DESIRED RESULT in my opinion would be exactly what actually happens (F1 is "HELLO"). I also have to agree that this is not technically correct(F3 s/b "HELLO" as per jbmuir). This is most likely the reason I have never noticed this. Changing the "defective" routine would cause problems where in the past it was never noticed or was noticed and a code around was done. Maybe Art or Noreen would care to comment on this.
DEFINE FILE CAR STR1/A24 WITH CAR =',,HELLO,CRAZY,WORLD'; STR2/A24 WITH CAR =' HELLO CRAZY WORLD'; F1/A10 = GETTOK(STR1,24,1,',',10,'A10'); F2/A10 = GETTOK(STR1,24,2,',',10,'A10'); F3/A10 = GETTOK(STR1,24,3,',',10,'A10'); F4/A10 = GETTOK(STR1,24,4,',',10,'A10'); F5/A10 = GETTOK(STR1,24,5,',',10,'A10'); F1A/A10 = GETTOK(STR2,24,1,' ',10,'A10'); F2A/A10 = GETTOK(STR2,24,2,' ',10,'A10'); F3A/A10 = GETTOK(STR2,24,3,' ',10,'A10'); F4A/A10 = GETTOK(STR2,24,4,' ',10,'A10'); F5A/A10 = GETTOK(STR2,24,5,' ',10,'A10'); END TABLEF FILE CAR PRINT F1 F1A OVER F2 F2A OVER F3 F3A OVER F4 F4A OVER F5 F5A IF RECORDLIMIT EQ 1 END PAGE 1
F1 HELLO F1A HELLO F2 CRAZY F2A CRAZY F3 WORLD F3A WORLD F4 F4A F5 F5A
FOCUS 7.6 MVS PDF,HTML,EXCEL
Posts: 115 | Location: Chicago, IL | Registered: May 28, 2004
GETOK exhibits the same defect in a TABLE request. See this example:
DEFINE FILE CAR LINE/A100 = ',,' || COUNTRY || ',' || CAR || ',' || MODEL; END TABLE FILE CAR PRINT LINE NOPRINT COMPUTE F1/A30 = GETTOK(LINE,30,1,',',30,'A30'); F2/A30 = GETTOK(LINE,30,2,',',30,'A30'); F3/A30 = GETTOK(LINE,30,3,',',30,'A30'); F4/A30 = GETTOK(LINE,30,4,',',30,'A30'); F5/A30 = GETTOK(LINE,30,5,',',30,'A30'); END -RUN
Susannah,
I am trying to read tokens. If I specify token 3 I expect to get token 3 even if the first two tokens are null. GETTOK is the way it is because there are programs that have been written that depend on it's strange behaviour and nobody wants to fix GETTOK for fear of breaking lots of production code. That's fine. According to the documentation "GETTOK returns the token specified by the token_number". GETTOK is not returning exactly what it is supposed to. I'm not asking anyone to fix GETTOK, I'm just wondering if IBI has produced an alternative function that works.
RichH,
Thanks for the idea. It works, but I'm looking for a solution that doesn't require me to prefix my data with a blank.
-James
WF 7.1.6 moving to WF 7.7, Solaris 10, HTML,PDF,XL
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003
This helps overcome the "defect" of ignoring tokens that are nulls by forcing a space into the position. Might need a little more work but it's a start .....
TThis message has been edited. Last edited by: Tony A,
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
We had a similar problem. the length of 'HELLO,CRAZY,WORLD' is not 20 character but 17. The easiest way to get this is use the dialogue manager length property. in this case &STR.LENGTH. the code below
Precisely, but the point was the two commas preceding the HELLO token. These get interpretted (correctly) as NULLS and therefore are not counted in the GETTOK token count. The only way to circumvent this is to fool the function by expanding the NULL to a space.
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