Kbase P11182: OUTPUT TO STREAM is placing a blank line at the end fo the f
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/11/2003 |
|
Status: Unverified
FACT(s) (Environment):
Progress 8.1x
SYMPTOM(s):
OUTPUT TO STREAM is placing a blank line at the end of the file
CAUSE:
There is a SKIP being executed before closing the stream.
FIX:
Do not SKIP if you are writing the last line of the file.
This example demonstrates how to write the customer's number and country fields from the customer table of the sports database to a file, and not have a blank line after the last record:
DEF STREAM exp.
DEF VAR fne AS CHAR FORMAT "x(35)"
NO-UNDO.
fne = "d:\test.txt".
OUTPUT STREAM exp TO VALUE(fne).
FOR EACH customer BREAK BY cust-num:
IF LAST(cust-num) THEN DO:
PUT STREAM exp UNFORMATTED
"1"
cust-num
country.
END.
ELSE DO:
PUT STREAM exp UNFORMATTED
"1"
cust-num
country
SKIP.
END.
END.
OUTPUT STREAM exp CLOSE.