Focal Point
[CLOSED] Strange -READ result casued by -RUN within a -REPEAT loop

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

November 25, 2015, 02:27 PM
bug
[CLOSED] Strange -READ result casued by -RUN within a -REPEAT loop
I just found that if I use a loop to read data from a multi-row file, I can't use -RUN in it. Otherwise the value of the -READ always stay the same.

Example 1:

quote:


TABLE FILE CAR
PRINT MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS TEMP_CAR FORMAT ALPHA
END


-SET &TIMES=&LINES;

-REPEAT :END_LOOP &TIMES TIMES

-READ TEMP_CAR &MODEL.A20.;
-TYPE &MODEL

-:END_LOOP



The result is correct as

quote:

V12XKE AUTO
XJ12L AUTO
INTERCEPTOR III
TR7


Example 2:

quote:


TABLE FILE CAR
PRINT MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS TEMP_CAR FORMAT ALPHA
END


-SET &TIMES=&LINES;

-REPEAT :END_LOOP &TIMES TIMES

-READ TEMP_CAR &MODEL.A20.;
-TYPE &MODEL
-RUN
-:END_LOOP




The loop still runs but the -READ result is always V12XKE AUTO

quote:

V12XKE AUTO
V12XKE AUTO
V12XKE AUTO
V12XKE AUTO


Why is that?

This message has been edited. Last edited by: bug,


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
November 25, 2015, 02:36 PM
Tom Flynn
As the manual states, to read a multi-row file, either use -READFILE(available in 7.x.x release, don't know which one)
or
-READ FILENAME NOCLOSE &VAR1.A/In.

EDIT:
And, there is no ; at the end of the -READ line

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


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
November 25, 2015, 02:42 PM
bug
quote:
Originally posted by Tom Flynn:
As the manual states, to read a multi-row file, either use -READFILE(available in 7.x.x release, don't know which one)
or
-READ FILENAME NOCLOSE &VAR1.A/I/n.


Yes it works.

Good to know that. I did not use NOCLOSE but it still works, until I got this problem.

Thanks Tom!


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
November 25, 2015, 04:18 PM
Waz
FYI

-RUN will close open files, unless you have the NOCLOSE option


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!