Consultor Eletrônico



Kbase P115864: How to skip past embedded EOF characters in a file
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   05/05/2006
Status: Unverified

GOAL:

How to skip past embedded EOF characters in a file

FIX:

When a data file that is being processed contains embedded EOF characters (which cause IMPORT to raise the end of file condition and stop reading more data) simply use the SEEK statement combined with the SEEK function to reposition the file pointer beyond the embedded EOF characters. The following code shows a simple sample of doing this where the EOF character (a single byte) is located at position 101 of the file:

DEFINE VARIABLE iLoop AS INTEGER NO-UNDO.
DEFINE VARIABLE cData AS CHARACTER NO-UNDO.

INPUT FROM TEST.XML.

/* Reposition File Pointer To Position 101, Next READKEY Will Start Reading At Position 102 Effectively Bypassing EOF Character */

SEEK INPUT TO 101.

/* Read Rest Of Data As Normal */

REPEAT:
IMPORT UNFORMATTED cData.
END.

INPUT CLOSE.