PreviousNextIndex

EXPORT statement

Converts data to a standard character format and displays it to the current output destination (except when the current output destination is the screen) or to a named output stream. You can use data exported to a file in standard format as input to other ABL procedures.

Syntax

EXPORT [ STREAM stream | STREAM-HANDLE handle ] [ DELIMITER character ]
  {    expression ...
     | record [ EXCEPT field ... ]
  }
  [ NO-LOBS ] 

EXPORT [ STREAM stream | STREAM-HANDLE handle ] { memptr | longchar } 

STREAM stream
STREAM-HANDLE handle
DELIMITER character
expression . . .
record
EXCEPT field . . .
memptr
longchar
NO-LOBS
Examples

This procedure converts the data in the Customer table into standard character format and sends that data to the customer.d file:

r-exprt.p
OUTPUT TO customer.d. 
FOR EACH Customer NO-LOCK: 
  EXPORT Customer. 
END. 
OUTPUT CLOSE. 

The next procedure shows how each EXPORT statement creates one line of data (that is, fields are not wrapped onto several lines):

r-exprt2.p
OUTPUT TO custdump. 
FOR EACH Customer NO-LOCK: 
  EXPORT Customer.CustNum Customer.Name Customer.CreditLimit. 
END. 
OUTPUT CLOSE. 

That procedure creates a text file, custdump, with one line for each Customer. This is a typical line of output:

1 "Lift Line Skiing" 58400 

Use the DELIMITER option to specify a character other than a space to separate fields in the output file. For example, the following procedure uses a semicolon:

r-cstout.p
OUTPUT TO custdump2. 
FOR EACH Customer NO-LOCK: 
  EXPORT DELIMITER ";" Customer.CustNum Customer.Name Customer.CreditLimit. 
END. 
OUTPUT CLOSE. 

This is a typical line of output from this code:

1;"Lift Line Skiing";58400 

The following example displays using a MEMPTR to EXPORT mixed character and binary data:

r-expmem.p
/* Character and binary data mixed */ 
DEFINE VARIABLE z AS MEMPTR NO-UNDO. 
ASSIGN 
  SET-SIZE(z)      = 100 
  PUT-STRING(z,1)  = "hi there" 
  PUT-LONG(z,10)   = 235 
  PUT-STRING(z,14) = "afterint" 
  PUT-LONG(z,22)   = 76. 
OUTPUT TO abc BINARY NO-CONVERT. 
EXPORT z. 
OUTPUT CLOSE. 

Notes
See also

COPY-LOB statement, DEFINE STREAM statement, DISPLAY statement, IMPORT statement, OUTPUT CLOSE statement, OUTPUT TO statement, PUT statement, Stream object handle, STRING function


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex