Kbase P176632: IMPORT statement does not process form feed character
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/2/2010 |
|
Status: Unverified
SYMPTOM(s):
IMPORT statement does not process form feed character
IMPORT statement does not process line in text file containing only a form feed character (hex 0x0c, CHR(12).
Character variable imported into contains value from previous line in text file.
IMPORT does not treat form feed as an end of file character, so value from previous line is processed twice.
Cannot trap CHR(12) with the SUBSTR() function.
Problem occurs with or without BINARY option on INPUT FROM statement.
FACT(s) (Environment):
Using IMPORT UNFORMATTED.
Processing input lines from a text file in a REPEAT loop.
Line containing the form feed is the last line in the text file.
All Supported Operating Systems
Progress/OpenEdge Product Family
OpenEdge Category: Language (4GL/ABL)
CAUSE:
The form feed character (hex 0x0c, CHR(12)) is neither an end of file character or a valid CHARACTER value. Therefore, while IMPORT cannot read the character into a CHARACTER variable for further processing, it does not recognize end of file either and so will not stop processing. Any variable into which data is IMPORTed will still contain the values from the last line IMPORTed.
FIX:
If it necessary to preserve form feeds, IMPORT the entire file into a MEMPTR variable rather than line by line into a CHARACTER variable. Each line must then be parsed from the MEMPTR by the application code.
If it is necessary to process the file as lines of text, but it is not necessary to recognize the form feed as such, it may be possible to avoid double processing of the previous line by testing for duplication of values that were in the previous line. If the values are duplicates, processing can be skipped. This workaround is not appropriate if consecutive lines may legitimately contain exactly the same data.