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 am getting the (FOC339) error. Below is the code what i tried. I am trying read from a FTM file few values and put these values into a variable. Need some help on this as am new to webFOCUS. Thanks in advance
-SET &ECHO = ALL;
TABLE FILE DRIVERFILEL3
PRINT
L3NAME/A16
IF L3 EQ 'Cyr D'
ON TABLE HOLD AS MYSAVE
END
-RUN
-REPEAT ENDLOOP 6 TIMES
-READ DriverFileL3 HOLD &DriverFileVal.A16.
-TYPE &DriverFileVal
-ENDLOOP
-EXIT
This message has been edited. Last edited by: Kerry,
If you want to read the file first use SAVE or HOLD FORMAT ALPHA otherwise you get a binary file. (in this case not so important as you only have an alpha column but if you had numerics it would be)
Second what you are trying to do will overwrite the variable every time as it's assigning to the same variable. If you want 6 variables assign then to an indexed variable using a counter.
Third again not so important because you are not flushing the stack with a -RUN in the loop consider using the NOCLOSE option on the read, if the stack is flushed the file will be closed and you will read the first record everytime.
Ok. I tried your solution but still am getting the following error (FOC003) THE FIELDNAME IS NOT RECOGNIZED: TABLE BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT 0 ERROR AT OR NEAR LINE 95 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC339) DIALOGUE MANAGER -READ FAILED: CHECK FILEDEF OR ALLOCATION FOR: -READ DriverFileL3 &DriverFileVal1.A16.
TABLE FILE DRIVERFILEL3
PRINT
L3NAME/A16
ON TABLE HOLD AS DriverFileL3 FORMAT ALPHA
END
-RUN
-SET &CNTR=0;
-REPEAT ENDLOOP 6 TIMES
-SET &CNTR=&CNTR+1;
-READ DriverFileL3 &DriverFileVal&CNTR.EVAL.A16.
-TYPE &DriverFileVal&CNTR.EVAL
-ENDLOOP
-EXIT
but still am getting the FOC339 error. Where have I gone wrong?
Firstly I would suggest using SAVE instead of HOLD FORMAT ALPHA. The reason being is that, unless you reuse the held data in a TABLE request then you do not require the .mas file that is created as a result of using HOLD. SAVE doesn't create a .mas file and has a default format of ALPHA. If you ever need FOCUS internal format you can use SAVB instead.
Secondly, are you sure that you have 6 lines in your output file?
Try this code as an example -
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE AS DriverFileL3
END
-RUN
-REPEAT ENDLOOP FOR &CNTR FROM 1 TO &LINES;
-READ DriverFileL3 &DriverFileVal&CNTR.EVAL.A10.
-TYPE &DriverFileVal&CNTR.EVAL
-ENDLOOP
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
That suggests that the code you've posted is not the code you are running.
The FOC309 is caused because you have and error in your code possibly a missing END in the previous step.
Also Add ON TABLE SET HOLDLIST PRINTONLY to your hold step
Because otherwise the hold file will contain L3NAME twice, first with it's real length and then 16 characters long It could be an issue if L3NAME is less than 16.
Thanks Tony and JG.I tried both your options but non worked. I guess there is someother problem. Is it possible that i can store few names in a FTM file n then try to read from it? Any examples or links that might help me out in doing this?
TABLE FILE DRIVERFILEL3
PRINT
L3NAME/A16
ON TABLE HOLD AS DriverFileL3 FORMAT ALPHA
END
-RUN
-SET &CNTR=0;
-REPEAT ENDLOOP 6 TIMES
-SET &CNTR=&CNTR+1;
-READ DriverFileL3 &DriverFileVal&CNTR.EVAL.A16.
-TYPE &DriverFileVal&CNTR.EVAL
-ENDLOOP
-EXIT
Some comments: 1. When you change the format of a field in a TABLE command and then HOLD, you will have 2 fields in the HOLD file, because, under the covers, WebFocus will use COMPUTE. So, either you use a DEFINE before the TABLE to change the format or a SET HOLDLIST=PRINTONLY in order not to save the original field. 2. Unless you are sure that you will have no less than 6 records, you should use Tony's syntax:
FOR &CNTR FROM 1 TO &LINES
3. Do not forget the ; at the end of the -REPEAT command 4. Your use of EVAL is superfluous. You should use the indexing capabilities of &variables:
-REPEAT ENDLOOP FOR &CNTR FROM 1 TO &LINES;
-READ DriverFileL3 &DriverFileVal.&CNTR.A10.
-TYPE &DriverFileVal.&CNTR
-ENDLOOP
It should work.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
Thanks Danny for your comments, I shall keep them in mind while I write the code next time. I am still getting the same error. Yes Tony something like that. But i am looking for an example where we are trying to read few names from an FTM file and these names are stored into a variable and which is in turn used in a condition like WHERE?
read few names from an FTM file and these names are stored into a variable
That is what the example is doing.
quote:
which is in turn used in a condition like WHERE?
There are many examples on the forum, one being quite recent and using OR to separate the variables in the WHERE clause.
As a pointer, build a separate variable within your loop and then use that. Searching (top right link) on "where statement", "where or variable", "where multi variable" and combinations of similar such phrases might list some of the more helpful ones.
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