Below is a code I am working on and this is a base for a different project of mine. I got it to work but only 1 value (ENGLAND) is being repeated in all 5 sets of data.
TABLE FILE CAR
PRINT
DST.COUNTRY
ON TABLE HOLD AS C2
END
-RUN
-SET &LOOPCNT = &LINES;
-READ C2 &COUNTRY.A10.
-RUN
ThanksThis message has been edited. Last edited by: Enigma006,
8.1.05 HTML,PDF,EXL2K, Active, All
January 28, 2015, 10:34 AM
Tom Flynn
Just like the manual states, use NOCLOSE to continue reading a file...
Or convert to -READFILE, which leaves the file open across -RUNs
- Jack Gross WF through 8.1.05
January 28, 2015, 02:17 PM
MartinY
Or remove the -RUN after the -READ
TABLE FILE CAR
PRINT DST.COUNTRY
ON TABLE HOLD AS C2
END
-RUN
-SET &LOOPCNT = &LINES;
-SET &I = 1;
-NXTREAD
-READ C2 &COUNTRY.&I.A10.
-*-RUN
-TYPE &COUNTRY.&I
-SET &I = &I + 1;
-IF &I LT &LOOPCNT THEN GOTO NXTREAD;
And have a loop...
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
January 28, 2015, 03:30 PM
Waz
I guess this is a code snippet, as I do't see any loop.
You can also use -REPEAT for the loop.
e.g.
TABLE FILE CAR
PRINT DST.COUNTRY
ON TABLE HOLD AS C2
END
-RUN
-SET &LOOPCNT = &LINES;
-REPEAT NXTREAD FOR &I FROM 1 TO &LOOPCNT ;
-READ C2 &COUNTRY.&I.A10.
-TYPE &COUNTRY.&I
-NXTREAD