Consultor Eletrônico



Kbase P18092: Cannot import fields which are spanning more than one line
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

SYMPTOM(s):

Cannot import fields spanning more than one line.

Importing a data file where the fields are '*' delimited.

CAUSE:

The IMPORT statement reads only one line at a time.

FIX:

Use READKEY to read character by character.
EXAMPLE when the delimiter character is "*":


/* example.p */
DEF VAR cField AS CHAR NO-UNDO.
DEF VAR cRecordField AS CHAR NO-UNDO.

INPUT FROM "IMPORT.d" UNBUFFERED.
REPEAT:    
   READKEY.
   IF CHR(LASTKEY) <> "*" THEN
       cField = cField + CHR(LASTKEY).
   ELSE do:
       cRecordField = cField.
       cField = "".
       MESSAGE cRecordField VIEW-AS ALERT-BOX.
   END.
END.

INPUT CLOSE.