Kbase P100947: Reading raw data from a file that contains a SUB character can corrupt the data.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  14/07/2006 |
|
Status: Unverified
SYMPTOM(s):
Reading raw data from a file that contains a SUB character can corrupt the data.
Loading data from a file that has a SUB character will cause data to become corrupted.
Using get-byte to load in data that contains chr(26) causes the data to become corrupt.
CAUSE:
This is a known issue being investigated by Development
FIX:
Workaround:
Use the seek function to reposition to each byte instead of relying on the loop to automatically place you at the next byte. The code example below will show you how to do this. Notice the use of the SEEK function at the end of the block to position the cursor to the next byte within the file:
define stream ls_file.
define variable li_count as integer no-undo.
define variable lraw_detail as raw no-undo.
define variable lc_character as character no-undo.
input stream ls_file from infile.txt.
output to outfile.txt.
assign length(lraw_detail) = 1.
repeat:
assign li_count = seek(ls_file).
import stream ls_file unformatted lraw_detail.
assign lc_character = chr(get-byte(lraw_detail,1)).
if lc_character eq chr(10) THEN
PUT unformatted skip.
else
put unformatted lc_character.
SEEK STREAM ls_file TO li_count + 1.
end.