Progress
Language Reference


EXPORT Statement

Interfaces
OS
SpeedScript
All
All
Yes

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 Progress procedures.

SYNTAX

EXPORT [ STREAM stream ] [ DELIMITER character ]
  {    expression ...
     | record [ EXCEPT field ... ]
  } 

EXPORT [ STREAM stream ] memptr 

STREAM stream

The name of a stream. If you do not name a stream, Progress uses the unnamed stream. See the DEFINE STREAM Statement reference entry in this book and the chapter on alternate I/O sources in the Progress Programming Handbook for more information on streams.

DELIMITER character

The character to use as a delimiter between field values. The character parameter must be a quoted single character. The default is a space character.

expression . . .

One or more expressions that you want to convert into standard character format for display to an output destination.

record

The name of the record buffer with fields that you want to convert into the standard character format to display to an output destination.

To use EXPORT with a record in a table name used in multiple databases, you must qualify the record’s table name with the database name. See the Record Phrase reference entry for more information.

EXCEPT field . . .

Progress exports all fields except those fields listed in the EXCEPT phrase.

memptr

A variable of data type MEMPTR that contains the exported text. The EXPORT statement may contain a MEMPTR in its field list as long as it is the only field in the list.

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:
  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:
  EXPORT cust-num name credit-limit.
END.

OUTPUT CLOSE. 

That procedure creates an 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:
  EXPORT DELIMITER ";" cust-num name credit-limit.
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.

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

DEFINE STREAM Statement, DISPLAY Statement, IMPORT Statement, OUTPUT CLOSE Statement, OUTPUT TO Statement, PUT Statement, STRING Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095