Focal Point
Error in Tokenizing.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8711005082

April 15, 2008, 01:23 AM
<Navin>
Error in Tokenizing.
Hi

In the following code i am trying to break the whole &addl_alc in to &F array using "," as the delimiter.

The problem i face here is , if the total length exceeds 137 then i am getting "Session LOST" error.Else everything goes fine.

---CODE SNIPPET---

-DEFAULT &addl_alc = 'a,ABCNUMBER OF DEPENDENTS,PRIOR INV EXP MUTUAL FUNDS,PRIOR INV EXP STOCKS,PRIOR INV EXP VL/ANNUITIES,PROPOSAL REFERENCE ID,RISK TOLERANCE';

-SET &CNTR = 1;
-SET &CNTRR = 15;

-SET &TL = &addl_alc.LENGTH;

-TYPE --ASSIGNED VALUES START--
-TYPE &TL;
-TYPE &addl_alc;
-TYPE --ASSIGNED VALUES END--

-SET &F = '';

-ADDL_STRT

-IF (&CNTR LT &CNTRR) THEN ADDL_TRUN ELSE FINADDL_T;

-ADDL_TRUN

-SET &F.&CNTR = GETTOK('&addl_alc.EVAL',&TL,&CNTR,',',&TL,'A&TL.EVAL');

-TYPE --ARRAYINDEX AND ARRAYVALUE--
-TYPE **&CNTR**
-TYPE &F.&CNTR;
-TYPE --END--

-IF 'A' || &F.&CNTR EQ 'A' THEN FINADDL_T;
-SET &CNTR = &CNTR + 1;

-GOTO ADDL_STRT

-FINADDL_T



-----------

The above code is good. But if i add a single character to the &addl_alc variable (if the total length exceeds 137) then i am getting an error "SESSION LOST" . . Can anyone help me in figuring out this issue.
April 15, 2008, 02:26 AM
Tony A
Naveen,

Firstly there is no requirement to terminate a DEFAULT with a semi colon. Remove the semi colon at the end of your DEFAULT and all will work comfortably upto 145 chars - should work with more but that's all I tested.

I would also use a -REPEAT loop in preference over the collection of GOTOs that you have but each to their own.

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 
April 15, 2008, 02:34 AM
<Navin>
TONY

Thanks for your reply .

But the semicolon removal doesnot help at all . .

for example , If you run this code in the webfocus console and test , i am sure that it will throw you the "SESSION LOST" error.


-DEFAULT &addl_alc = 'a,ABCaNUMBER OF DEPENDENTS,PRIOR INV EXP MUTUAL FUNDS,PRIOR INV EXP STOCKS,PRIOR INV EXP VL/ANNUITIES,PROPOSAL REFERENCE ID,RISK TOLERANCE'

-SET &CNTR = 1;
-SET &CNTRR = 15;

-SET &TL = &addl_alc.LENGTH;

-SET &F.&CNTR = GETTOK('&addl_alc.EVAL',&TL,&CNTR,',',&TL,'A&TL.EVAL');
April 15, 2008, 03:07 AM
Alan B
Navin

Replace:
-SET &F.&CNTR = GETTOK('&addl_alc.EVAL',&TL,&CNTR,',',&TL,'A&TL.EVAL');

with
-SET &F.&CNTR = GETTOK(&addl_alc,&TL,&CNTR,',',&TL,'A&TL.EVAL');

removing the quotes and .EVAL from the input string.


Alan.
WF 7.705/8.007
April 15, 2008, 03:11 AM
<Navin>
Thanks Alan

That works fine.

Any Idea why that fails with in that 137 length of the input string.

That will be of great help in understanding.
April 15, 2008, 03:19 AM
Alan B
Must be something to do with supplying a string in quotes, as opposed to supplying a variable to the function. Not sure why.

Also change
-IF 'A' || &F.&CNTR EQ 'A' THEN FINADDL_T;
and
-IF (&CNTR LT &CNTRR) THEN ADDL_TRUN ELSE FINADDL_T;
to
-IF 'A' || &F.&CNTR EQ 'A' THEN GOTO FINADDL_T;
and
-IF (&CNTR LT &CNTRR) THEN GOTO ADDL_TRUN ELSE GOTO FINADDL_T;
otherwise the code will not branch as you expect.


Alan.
WF 7.705/8.007
April 21, 2008, 07:43 AM
<Navin>
Thanks
Alan.