Focal Point
-READ reads past end of record

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

December 17, 2004, 12:27 PM
secret
-READ reads past end of record
I am trying to read the output of a dos dir command so I can clean up old files. How do you rad a variable length text file in Webfocus ? The _READ reads part of the first record and part of the second record.

The output of the DIR command looks kike this:

Volume in drive E is DV2KDW06_E
Volume Serial Number is 4864-211B

Directory of E:\IBI\APPS\SORTPARM

12/16/2004 01:05p <DIR> .
12/16/2004 01:05p <DIR> ..
11/24/2004 12:25p 38 CB0RHAL_20041124_122520.TXT
11/24/2004 01:36p 0 CB0RHAL_20041124_133630.TXT
11/24/2004 01:55p 374 CB0RHAL_20041124_135523.TXT
11/24/2004 01:59p 374 CB0RHAL_20041124_135916.TXT
11/24/2004 02:14p 362 CB0RHAL_20041124_141429.TXT
11/24/2004 02:27p 362 CB0RHAL_20041124_142742.TXT
11/24/2004 02:32p 362 CB0RHAL_20041124_143221.TXT
11/29/2004 09:52a 362 CB0RHAL_20041129_095253.TXT
11/29/2004 10:05a 362 CB0RHAL_20041129_100519.TXT
11/30/2004 01:12p 362 CB0RHAL_20041130_080211.TXT

Code to read file:

-SET &ECHO='ALL';
-INCLUDE PATH
-SET &CPATH=&PATH | 'SORTPARM' ;
-SET &DPATH=&PATH | 'BOBTEST_HOLD\DIR_LIST.DAT' ;
DOS DIR &CPATH > &DPATH (LRECL 80 RECFM F
-RUN
FILEDEF INPUT DISK &DPATH
-*DEFAULT &DATA=' ';
-RUN
-LOOP

-READ INPUT &DATA.A80
-IF &IORETURN NE 0 GOTO EXIT;
-TYPE &DATA
-GOTO LOOP
-exit
December 17, 2004, 12:39 PM
HÃ¥kan
Instead of reading a fixed length, use the following statement:

-READ INPUT,&DATA

That will allow you to read a varaible length record.
December 17, 2004, 02:02 PM
Lloyd
also be sure to use /-c to omit the comma in the filesize or it will view as an End-Of-Line(end-of-Field?).