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     GETTOK function issue

Read-Only Read-Only Topic
Go
Search
Notify
Tools
GETTOK function issue
 Login/Join
 
Gold member
posted
Hello,

-SET &SelCol.&COUNTER = GETTOK(&SelCol, 500, &COUNTER, ',',500,A&SelCol.&COUNTER.LENGTH);
This is what I use in my Focprocedure.

Let Selcol be the following,for example,

Selcol before TOK is ACCOUNT REGISTRATION CATEGORY,ACCOUNT MNEMONIC,CASH AVAILABLE,FUND FAMILY,ACTY SECR PRICE,ACTY COMM AMT

SelCol.1 after TOK is ACCOUNT REGISTRAT

The remaining characters(ION CATEGORY) are truncated ..
I could not identify what is the actual problem in the function.
Please suggest me a solution.

Thanks
Suji,

Webfocus 7.1
Windows and Unix O/s
Oracle db


WebFOCUS 7.7.02(Production)
WebFOCUS 7.7.02(Test region)
Oracle backend (10g)and Windows Frontend.
HTML,PDF,EXL2K,FLEX,AHTML
 
Posts: 68 | Registered: June 07, 2007Report This Post
Master
posted Hide Post
If you see the syntax of GETTOK

GETTOK(infield,inlength,token,delim,outfield,outlength)

In your manipulation you are doing like below

-SET &SelCol.&COUNTER = GETTOK(&SelCol, 500, &COUNTER, ',',500,A&SelCol.&COUNTER.LENGTH);

A&SelCol.&COUNTER.LENGTH --> A&Selcol1.length

&Selcol1 is ACCOUNT MNEMONIC-- The length of this is 16.

When you use this length on your token, it gets only 16 characters and truncates the remaining.

Instead of getting the length &selcol.counter value, you can default that with maximum value and trim the spaces.

Hope this helps,


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Expert
posted Hide Post
Suji,

Try this:

-SET &ECHO=ALL;
-SET &SELCOL = 'ACCOUNT REGISTRATION CATEGORY,ACCOUNT MNEMONIC,CASH AVAILABLE,FUND FAMILY,ACTY SECR PRICE,ACTY COMM AMT';
-SET &CNTR = 0;
-SET &LNGTH = &SELCOL.LENGTH;
-BEG_LOOP
-SET &CNTR = &CNTR + 1;
-SET &FLD.&CNTR = GETTOK('&SELCOL.EVAL', &LNGTH, &CNTR, ',', &LNGTH, 'A&LNGTH.EVAL');
-IF &FLD.&CNTR EQ ' ' GOTO END_LOOP;
-SET &OUTFLD.&CNTR = &FLD.&CNTR;
-GOTO BEG_LOOP
-END_LOOP
-SET &CNTR = &CNTR - 1;
-SET &CNTR2 = 1;
-REPEAT DO_TYPE &CNTR TIMES
-TYPE &OUTFLD.&CNTR2
-SET &CNTR2 = &CNTR2 + 1;
-DO_TYPE
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Hello Tom,
There is a parameter conflict in ARG 5..This arg should contain the length of selcol.counter.length...

Hello Kamesh,
Anyhow the first arg is ACCOUNT REGISTRATION CATEGORY and not ACCOUNT MNEMONIC .. Then there will not a problem.. We keep on incrementing the counter value by 1 in the loop..


WebFOCUS 7.7.02(Production)
WebFOCUS 7.7.02(Test region)
Oracle backend (10g)and Windows Frontend.
HTML,PDF,EXL2K,FLEX,AHTML
 
Posts: 68 | Registered: June 07, 2007Report This Post
Expert
posted Hide Post
The A&SelCol.&COUNTER.LENGTH is causing the problem - WebFOCUS doesn't know the length of that yet, so it probably uses a default length of 16. Change it to A500 - the maximum length of the token.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Suji,

Francis, Kamesh and my code example, are correct. Dialogue Manager does not know the length of the anwer set until AFTER the variable is set.

If you are missing an argument, it's probably a comma.

If you copy the code EXACTLY as is, it works fine. Make sure you copy correctly...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
Suji,
Can you pls try to display the value for &Selcol1 ? And see what value you are getting?

My understanding is the first value stores on &SELCOL0.

Simple solution is,

SET &SelCol.&COUNTER = GETTOK(&SelCol, 500, &COUNTER, ',',500,A100);

Try the above and that should work.


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Expert
posted Hide Post
You can use POSIT to find the position of the comma and use that value - 1 to calculate the length. Then you can use it in GETTOK or SUBSTR.

e.g.
-SET &ECHO=ALL;
-SET &SelCol='ACCOUNT REGISTRATION CATEGORY,ACCOUNT MNEMONIC,CASH AVAILABLE,FUND FAMILY,ACTY SECR PRICE,ACTY COMM AMT';
-TYPE &SelCol.LENGTH
-SET &COMMALOC=POSIT(&SelCol,&SelCol.LENGTH,',',1,'I2');
-TYPE &COMMALOC
-SET &STRLEN=&COMMALOC-1;
-SET &OUTPARM=SUBSTR(&SelCol.LENGTH,&SelCol,1,&STRLEN,&STRLEN,'A&STRLEN');
-SET &OUTTOK=GETTOK(&SelCol,&SelCol.LENGTH,1,',',&STRLEN,'A&STRLEN');
-TYPE &OUTPARM
-TYPE &OUTTOK

I didn't do the counter thing but have done loops where I lop off the front of the string that I've already extracted.

Unfortunately, I think the spaces in the value may be messing you up. I can't get this to work in either 533 or 762.

How about PARAG?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
Hello Francis,
What you said is correct.My code is working.
Yet there is another problem.
This is my procedure.

-SET &SelCol='ACCOUNT REGISTRATION CATEGORY,ACCOUNT MNEMONIC,CASH AVAILABLE,FUND FAMILY,ACTY SECR PRICE,ACTY COMM AMT';
-DEF_SEL
-SET &SelCol=CTRAN(500,&SelCol,32,95,A&SelCol.LENGTH);
-SET &SelCol.&COUNTER = GETTOK(&SelCol, 500, &COUNTER, ',',30,'A30');
-SET &SelCol.&COUNTER = TRUNCATE(&SelCol.&COUNTER) ;
-SET &COUNTER = &COUNTER + 1 ;
-IF &COUNTER LE 4 THEN DEF_SEL;
-ENDS2

THe output is as follows:
There are junk chars in the last value:
SelCol.1 after TOK is ACCOUNT_CLOSE_DATE
SelCol.2 after TOK is ACCOUNT_TYPE
SelCol.3 after TOK is CUSIP
SelCol.4 after TOK is ACTY_AMT 5ýp

Please someone suggest me a solution to remove this junk chars from the final counter value.

Thanks,
Suji.

Webfocus 7.1
Oracle DB
Windows and Unix O/s.


WebFOCUS 7.7.02(Production)
WebFOCUS 7.7.02(Test region)
Oracle backend (10g)and Windows Frontend.
HTML,PDF,EXL2K,FLEX,AHTML
 
Posts: 68 | Registered: June 07, 2007Report This Post
Gold member
posted Hide Post
Hello Tom,
Your code is working fine.

Thanks Suji.


WebFOCUS 7.7.02(Production)
WebFOCUS 7.7.02(Test region)
Oracle backend (10g)and Windows Frontend.
HTML,PDF,EXL2K,FLEX,AHTML
 
Posts: 68 | Registered: June 07, 2007Report This Post
Gold member
posted Hide Post
Hello Tom,
I have one doubt..What does EVAL function do in a variable like SELCOL? Please clarify my doubt.
I have implemented your code in my procedure.It is working fine.

Thanks
Suji.


WebFOCUS 7.7.02(Production)
WebFOCUS 7.7.02(Test region)
Oracle backend (10g)and Windows Frontend.
HTML,PDF,EXL2K,FLEX,AHTML
 
Posts: 68 | Registered: June 07, 2007Report This Post
Expert
posted Hide Post
Hi Suji,

Glad it is working for you. Here is some documentation from IBI website. I probably use it when not needed, so, you can take it off and see the difference.

That will give you a better understanding...




The .EVAL operator enables you to evaluate a variable's value immediately, making it possible to change a procedure dynamically.
The .EVAL operator is particularly useful in modifying code at run time.


--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


Syntax: How to Evaluate a Variable Immediately
[&]&variable.EVAL
where:

variable
Is a local or global variable.

When the command procedure is executed, the expression is replaced with the value of the specified variable before any other action is performed.
Without the .EVAL operator, a variable cannot be used in place of some commands.


--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


Example: Using .EVAL to Allow WebFOCUS to Interpret a Variable
The code

-SET &A='-TYPE';
&A HELLO
produces an error message which shows that WebFOCUS does not recognize the value of &A:



Appending the .EVAL operator to the &A variable makes it possible for WebFOCUS to interpret the variable correctly.
Adding the .EVAL operator as follows

-SET &A='-TYPE';
&A.EVAL HELLO
produces the following output:

HELLO

--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


Example: Evaluating a Variable Immediately
The following example illustrates how to use the .EVAL operator in a record selection expression.
The numbers to the left apply to the notes that follow the procedure:

1. -SET &R='IF SALARY GT 60000';
2. -IF &Y EQ 'YES' THEN GOTO START;
3. -SET &R = '-*';
-START
4. TABLE FILE CENTHR
PRINT SALARY
BY PLANT BY LNAME
5. &R.EVAL
END
The procedure executes as follows:

1. The procedure sets the value of &R to 'IF SALARY GT 60000'.
2. If &Y is YES, the procedure branches to the START label, bypassing the second -SET command.
3. If &Y is NO, the procedure continues to the second -SET command, which sets &R to '-*', which is a comment.
The report request is stacked.

4. The procedure evaluates the value of &R. If the end user wanted a record selection test, the value of &R is
'IF SALARY GT 60000' and this line is stacked.

5. If the end user did not want a record selection test, the value of &R is '-*' and this line is ignored.


Edit: Typo

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
The .EVAL evaluates a variable when it is encountered. In Tom's example 'A&LNGTH.EVAL' if &LNGTH is 30 then this evaluates &LNGTH as 30 making the value within the quotes 'A30' rather than literally 'A&LNGTH'


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report 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     GETTOK function issue

Copyright © 1996-2020 Information Builders