Export and import data dynamically using buffers
- Last Updated: October 15, 2024
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
BUFFER-EXPORT() methodBUFFER-IMPORT() methodBUFFER-EXPORT-FIELDS() methodBUFFER-IMPORT-FIELDS() method
These methods provide the same functionality as the IMPORT and EXPORT statements. They support the same use cases of exporting/importing data, while allowing you to supply a dynamic buffer handle rather than a hard-coded table name.
BUFFER-EXPORT() and BUFFER-IMPORT() support a primary
use case of exporting all of the fields from a dynamic buffer. The other two methods,
BUFFER-EXPORT-FIELDS() and BUFFER-IMPORT-FIELDS(),
support a separate use case which is to export/import only a select set of fields, in a
specified order, from a dynamic buffer.
BUFFER-EXPORT() method
The BUFFER-EXPORT() method converts data from the buffer object to a standard
character format and writes it to the current output destination or to a named
output stream. You can optionally specify a delimiter (the default is a space), a
list of fields to exclude, and a parameter indicating that BLOB and CLOB fields
should be excluded.
|
You can use data exported to a file in standard format as input to other ABL procedures. For more information, see the BUFFER-EXPORT() method in the ABL Reference.
BUFFER-IMPORT() method
The BUFFER-IMPORT() method reads a line from an input stream that might have
been created by the EXPORT statement or
BUFFER-EXPORT() method. You can optionally specify a delimiter
(the default is a space), a list of fields to exclude, and a parameter indicating
that BLOB and CLOB fields should be excluded.
|
For more information, see the BUFFER-IMPORT() method in the ABL Reference.
BUFFER-EXPORT-FIELDS() method
The BUFFER-EXPORT-FIELDS() method converts data from the buffer object to a
standard character format and writes it to the current output destination or to a
named output stream. Only fields specified in the field list are included and they
are written in the order specified. The default delimiter is a space, but you can
specify a different delimiter if desired.
|
You can use the data exported as input to other ABL procedures.
For more information, see the BUFFER-EXPORT-FIELDS() method in the ABL Reference.
BUFFER-IMPORT-FIELDS() method
The BUFFER-IMPORT-FIELDS() method reads a line from an input stream that
might have been created by the EXPORT statement or the
BUFFER-EXPORT-FIELDS() method. Only fields specified in the
field list are included and they are read in the order specified. The default
delimiter is a space, but you can specify a different delimiter if desired.
|
For more information, see the BUFFER-IMPORT-FIELDS() method in the ABL Reference.
Examples
Customer
table and exports the records to the file opened by the OUTPUT TO
statement:
|
|
Customer table
dynamically:
|
BUFFER-EXPORT-FIELDS() to export four
fields from the Customer table.
|
BUFFER-IMPORT-FIELDS() to import the four
fields from the previous example into the Customer
table:
|