Try OpenEdge Now
skip to main content
Programming Interfaces
Input/Output Processes : Alternate I/O Sources : Converting nonstandard input files : Importing and exporting data : Using the EXPORT statement
 
Using the EXPORT statement
The EXPORT statement sends data to a specified output destination, formatting it in a way that can be easily used by another ABL procedure. For example, i-export.p writes customer information to a file.
i-export.p
OUTPUT TO i-datfl6.d.
FOR EACH Customer NO-LOCK:
  EXPORT Customer.CustNum Customer.Name Customer.SalesRep.
END.
OUTPUT CLOSE.
The output from i-export.p is written to i-datfl6.d.
i-datf16.d
1 "Lift Line Skiing" "HXM"
2 "Urpon Frisbee" "DKP"
3 "Hoops Croquet Comp" "HXM"
4 "Go Fishing Ltd" "SLS"
5 "Match Point Tennis" "JAL"
       .
       .
       .
Now this file is ready to be used as an input source by another ABL procedure. There is no need to process it through QUOTER.
By default, the EXPORT statement uses the space character as a delimiter between fields. You can use the DELIMITER option of the EXPORT statement to specify a different delimiter.
For example, i-exprt2.p writes to a file in which field values are separated by commas.
i-exprt2.p
OUTPUT TO i-datfl7.d.
FOR EACH Customer NO-LOCK:
  EXPORT DELIMITER "," Customer.CustNum Customer.Name Customer.SalesRep.
END.
OUTPUT CLOSE.
The output from i-exprt2.p is written to i-datfl7.d.
i-datf17.d
1,"Lift Line Skiing","HXM"
2,"Urpon Frisbee","DKP"
3,"Hoops Croquet Comp","HXM"
4,"Go Fishing Ltd","SLS"
5,"Match Point Tennis","JAL"
       .
       .
       .
You can read this file by using the DELIMITER option of the IMPORT statement. More likely, you would prepare a file like this to be read by another application.
For more information on the EXPORT statement, see OpenEdge Development: ABL Reference.