Consultor Eletrônico



Kbase P82129: Import into array does not clear last element
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/22/2004
Status: Unverified

SYMPTOM(s):

Import into array does not clear last element

Importing a delimited text string into an array variable does not clear the last array element if there isn't a character to import.

Last array element is left with a previous value when importing data into an array variable.

CAUSE:

The import file is using a delimiter without the UNFORMATTED option, but the character fields are not formatted correctly. i.e. the import data looks like:

a;b;c;d;e;f;g;h;i;j;k;l;m
a;b;c;d;e;f;g;h;i;j;k;l;
a;b;c;d;e;f;g;h;i;j;k;;
a;b;c;d;e;f;g;h;i;j;;;
a;b;c;d;e;f;g;h;i;;;;
a;b;c;d;e;f;g;h;;;;;
a;b;c;d;e;f;g;;;;;;

FIX:

With text delimited data character fields must be enclosed in quotes. For example:

With the import code as follows:

def var word# as char extent 15.
input from import.dat.
repeat :
word# = "".
import delimiter ";" word#.
disp word#.
end.

The import text file should look like:

"a";"b";"c";"d";"e";"f";"g";"h";"i";"j";"k";"l";"m"
"a";"b";"c";"d";"e";"f";"g";"h";"i";"j";"k";"l";""
"a";"b";"c";"d";"e";"f";"g";"h";"i";"j";"k";"";""
"a";"b";"c";"d";"e";"f";"g";"h";"i";"j";"";"";""
"a";"b";"c";"d";"e";"f";"g";"h";"i";"";"";"";""
"a";"b";"c";"d";"e";"f";"g";"h";"";"";"";"";""
"a";"b";"c";"d";"e";"f";"g";"";"";"";"";"";""

This is also the format of output when using the export statement. i.e.

EXPORT DELIMITER ";" word#.