Kbase 19898: How to Print Line Skip After Using the IMPORT Statement.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
GOAL:
How to Print Line Skip After Using the IMPORT Statement
FIX:
When you use the instruction IMPORT to input data from another file then send the data to print and you want the line skip to be respected, you must specify the use of line skip after you use the IMPORT statement.
The following is an example and a description of how to print line skip after using the IMPORT statement:
The example:
If the following program is used (1):
OUTPUT TO "export.txt".
FOR EACH customer where cust-num < 5 BREAK BY state:
DISPLAY cust-num name city state SKIP (1).
END.
the result is:
Cust-Num--Name-------------------City------------State------
1 Lift Line Skiing Boston MA
3 Hoops Croquet Co. Hingham MA
4 Go Fishing Ltd Harrow Middlesex
2 Urpon Frisbee Valkeala Uusimaa
When the IMPORT statement is executed with the following program:
DO:
DEFINE VAR Linea AS CHAR.
INPUT FROM "export.TXT".
OUTPUT TO Printer.
REPEAT:
IMPORT UNFORMATTED Linea.
PUT UNFORMATTED Linea SKIP.
END.
INPUT CLOSE.
OUTPUT CLOSE.
END.
the result is:
Cust-Num- Name---------------City----------State-----
1 Lift Line Skiing Boston MA
3 Hoops Croquet Co. Hingham MA
4 Go Fishing Ltd Harrow Middlesex
2 Urpon Frisbee Valkeala Uusimaa
But, if you want to add the line skip and see it reflected
in the program, it should be (program 2):
output to "export.txt".
FOR EACH customer where cust-num < 5 BREAK BY state:
display cust-num name city state CHR(10) CHR(13).
END.
When the IMPORT statement is executed in program (2),
the output is as follows:
Cust-Num-----Name----------------City-------State------
1 Lift Line Skiing Boston MA
3 Hoops Croquet Co. Hingham MA
4 Go Fishing Ltd Harrow Middlesex
2 Urpon Frisbee Valkeala Uusimaa
The CHR (10) in program 2 indicates a carriage return, and the CHR (13) indicates line feed. If neither is specified, the instruction IMPORT will not recognize the line skip.