Exporting Data
Both the OAAPI routine oaexport and the SQL command EXPORT, retrieve
data from rows and writes them to a specified file. These commands can
also transfer row identifiers (row IDs, unique key values, and so on)
to a file.
The file created to hold the transferred rows has a fixed row length
equal to the collective length, in bytes, of the columns established by
oaselect or a SELECT statement.
oaexport retrieves rows selected in the most recent oaselect for the
cursor, or row identifiers of rows qualified in the most recent oaqualify
for the cursor, and transfers them to the file named in the filename parameter.
EXPORT can retrieve rows qualified in the most recent QUALIFY using the
'ODXID' WITH option:
qualify customers where state in ('co','ca')
qualify customers where city in ('and boulder','denver','los angeles')
export to myfile with 'ODXID'
The EXPORT command can also replace the SELECT command.
export * from customers where state='co' to myfile
Entire rows are transferred as specified by the preceding oaselect. That
is, the rows transferred are determined by the criteria passed in the
most recent oaselect. The columns transferred for each row are determined
by the columns passed in the most recent oaselect.
When the DATA option is used, an oaselect call must precede an oaexport,
but not immediately. You can call oaexport after an oafetch to transfer
rows or OMNIDEX IDs. You can also call oaexport several times in succession
to transfer data from the same set of rows to several different files,
as long as there was a preceding call to oaselect.
If any of the ODXID, ODXSI or ROWID options are used, an oaqualify must
precede an oaexport, but not immediately. As long as the qualified subset
of rows still exists, you can call oaexport to transfer row identifiers
to a specified file.
The Transfer File
oaexport and EXPORT automatically create a file to hold the transferred
rows or OMNIDEX IDs, and assigns it the name passed through the filename
parameter. Therefore, you should not specify an existing file through
filename. Instead, let the routines create the file with the correct size
and row length.
You can use the FILELIMIT=n option, where n represents the number of
rows written to the file, to increase this if you need to transfer more
than a million rows. If the file limit is less than the number of rows
qualified or selected, Omnidex transfers as many rows as it can before
issuing an error.
When you use the ODXID option, the transfer file contains only internal
OMNIDEX IDs. Each qualified OMNIDEX ID occupies one line of the transfer
file. You can use transfer files created using the ODXID option as keyword
arguments in oaqualify and QUALIFY.
The BUFFSIZE=n Option
oaexport and EXPORT use a buffer to transfer rows to the specified file.
The default size of this buffer, 8192 bytes, is sufficient to transfer
rows efficiently for most selections. However, if each qualified row,
based on the combined lengths of the selected columns, is longer than
1000 bytes, and there is adequate memory, you should increase the BUFFSIZE
to ten times the combined length of the columns selected, up to 65536
bytes.
Conversely, if the rows you are transferring are relatively short, and
you want to conserve memory, you could specify a BUFFSIZE that is shorter
than the default.
Do not specify a BUFFSIZE that is less than the combined length of the
selected columns.
Top
|