Kbase P66810: Quoter does not quote the leading null character in a .CSV f
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/9/2004 |
|
Status: Unverified
SYMPTOM(s):
Quoter does not quote the null at the beginning of a record in a .CSV file.
CAUSE:
This is a known issue. Several bug reports 19940527-077, 19960118-052, 19960202-037, 19960202-038 have been logged on this issue. Progress does not have any current plans to alter this behavior.
FIX:
Modify the input file by placing an extra comma in front of the effected records. The following code loops through a SourceFile.txt and changes all leading commas to two commas and output the original file into a new file named DestinationFile.txt.
DEFINE VARIABLE cCurrentLine AS CHARACTER NO-UNDO.
INPUT FROM SourceFile.txt.
OUTPUT TO DestinationFile.txt.
REPEAT WHILE TRUE:
IMPORT UNFORMATTED cCurrentLine.
IF SUBSTRING (cCurrentLine, 1, 1) = ',' THEN
SUBSTRING (cCurrentLine, 1, 1) = ',,'.
PUT UNFORMATTED cCurrentLine SKIP.
END.
INPUT CLOSE.
OUTPUT CLOSE.