Focal Point
[SOLVED] (FOC339) DIALOGUE MANAGER -READ FAILED

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

October 22, 2009, 02:47 AM
Arun Philip R
[SOLVED] (FOC339) DIALOGUE MANAGER -READ FAILED
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,


WebFOCUS 764
Windows XP
PDF
October 22, 2009, 03:04 AM
<JG>
quote:
MYSAVE

You are trying to read the wrong file.

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.

-SET &CNTR=0;
-REPEAT ENDLOOP 6 TIMES
-SET &CNTR=&CNTR+1;
-READ MYSAVE &DriverFileVal&CNTR.EVAL.A16.
-TYPE &DriverFileVal&CNTR.EVAL
-ENDLOOP
October 22, 2009, 04:45 AM
Arun Philip R
Thanks JG for the help. I might sound a lil dumb here but i feel it'll b a learning for me...should i use the FILEDEF to specify the path of my file?


WebFOCUS 764
Windows XP
PDF
October 22, 2009, 04:47 AM
<JG>
No need for a filedef as the file is filedef'd automatically by the HOLD.

You only need a filedef if you want to hold it somewhere other than the temp work directory in this case.
October 22, 2009, 04:56 AM
Arun Philip R
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.


WebFOCUS 764
Windows XP
PDF
October 22, 2009, 05:32 AM
Arun Philip R
I have changed the code as follows,
 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?


WebFOCUS 764
Windows XP
PDF
October 22, 2009, 06:17 AM
Tony A
Arun,

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 
October 22, 2009, 06:42 AM
<JG>
quote:
ERROR AT OR NEAR LINE 95

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.
October 22, 2009, 08:52 AM
Arun Philip R
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?


WebFOCUS 764
Windows XP
PDF
October 22, 2009, 10:42 AM
Tony A
quote:
Any examples or links that might help me out

Like the example I gave above using the sample database CAR?

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 
October 22, 2009, 11:02 AM
Francis Mariani
quote:
Like the example I gave above using the sample database CAR?


I like the example you gave above using the sample database CAR!


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
October 23, 2009, 05:16 AM
Tony A
Thanks Francis, it's nice to know Wink

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 
October 26, 2009, 07:03 AM
Danny-SRL
Arun,

This is what you wrote:
  
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

October 27, 2009, 02:42 AM
Arun Philip R
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?


WebFOCUS 764
Windows XP
PDF
October 27, 2009, 04:06 AM
Tony A
quote:
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 
October 27, 2009, 10:41 AM
Arun Philip R
Thanks Tony for the help.


WebFOCUS 764
Windows XP
PDF