Consultor Eletrônico



Kbase P174835: Under specific conditions the IMPORT statement will import a single record from a file as two record
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/10/2010
Status: Unverified

SYMPTOM(s):

4GL/ABL: Under specific conditions the IMPORT statement will import a single record from a file as two records.

Under specific conditions the IMPORT statement, executed on IBM AIX 64-Bit, will import a single record from a file generated under Windows in the DOS format as two records.

The Windows generated DOS format file contains 1 record with 2 fields. The first field is a character field consisting of 3992 consecutive 'X's. The second field is an integer field value of zero (0). Similar to: "XXX ..3992 Xs total.. XXX" 0. The character field data in the file is double quoted.

Running the following procedure imports two records instead of the existing one record only:
DEFINE VARIABLE cField AS CHARACTER NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
INPUT FROM VALUE("input.txt").
OUTPUT TO VALUE("output.txt").
REPEAT:
IMPORT cField.
iCount = iCount + 1.
EXPORT cField.
END.
INPUT CLOSE.
OUTPUT CLOSE.
MESSAGE "Count:~t" Icount
VIEW-AS ALERT-BOX INFO BUTTONS OK.

Removing any one character from the CHARACTER field in the input.txt file eliminates the problem.

Adding any three characters to the CHARACTER field in the input.txt file eliminates the problem.

FACT(s) (Environment):

The issue does not occur if the file was generated under UNIX or if the code was executed under Windows.
OpenEdge 10.2B
IBM AIX 5.3 64-bit

CAUSE:

Bug# OE00200943

CAUSE:

The issue occurs because the end-of-line on Windows writes out as <CR><LF> while on UNIX, this writes out as <CR> alone.

FIX:

None at this time. As a workaround, use the caret character "^" option with the IMPORT statement. That is change the statement:
IMPORT cField.
to:
IMPORT cField ^.