DATAEXTRACT Command 

Syntax

<dataextract_ statement> ::=
DATAEXTRACT
<select_expression> [OUTFIELDS] [<output_column_list>] <extract_files_spec>
| DATAEXTRACT
<restore_spec> TABLE <table_name> [<order_clause>] <extract_files_spec>

Use

This command for unloading data unloads data from database tables into external files (target files). You can also define the format of the target file (data file formats).

You can use the DATALOAD or FASTLOAD commands to reload data that has been unloaded into external data files back into the database.

The Replication Manager has two variants of the DATAEXTRACT command.

Prerequisite

You must have access authorization for the tables from which you want to unload data.

You must be owner of the table to use the second variant of the command.

DATAEXTRACT Command: Variant 1

You can do the following with this variant:

DATAEXTRACT cno, surname, zip, location from customer

  OUTFILE customer.data'

DATAEXTRACT * from article
  OUTFIELDS  foa         01-08
             des         09-39
             stock       40-43 INTEGER
             min_ord     44-45 INTEGER
             ordered     46-49 INTEGER
             del_date    50-57
             price       58-65 DECIMAL (2)
             weight      66-69 REAL
  OUTFILE 'article.data' FORMATTED

DATAEXTRACT Command: Variant 2

Unlike the first variant, you can only use variant 2 to completely unload individual tables. You unload all data from a table into a target file, at the same time generating a command file, which you can use to recover the unloaded table completely.

This command file contains:

If the unloaded table is a Basis table (see also Reference Manual 7.2, section Concepts, Table) and the user is the owner of the table, the command file also contains a

DATAEXTRACT FOR DATALOAD TABLE article
OUTFILE 'article.command'
OUTFILE 'article.data'

Process Flow

The Replication Manager uses the information from the DATAEXTRACT command to generate an internal SELECT command and constructs a results table. The data in this results table is then unloaded into the target file, as instructed by the command.

All tables from which data is being unloaded are write-protected while the DATAEXTRACT command is being executed. This means that other users cannot make changes to this table while it is being unloaded.

Result

The data is unloaded from the tables into the target file.

Errors

If the unload command could not be completed successfully, the Replication Manager logs the number of successfully unloaded data records (Replication Manager log file).