(Contents)(Previous)

Extracting LONG Columns with DATAEXTRACT

As for DATALOAD, two methods are supported for DATAEXTRACT. In the simplest case, each extracted LONG value is written to a separate file.

Each line of the usual OUTFILE contains a reference to the corresponding LONG value in the form of a filename. The LONGFILE specification predefines the filename used. ###... denote a sufficient number of positions for the numbering of the LONG values. DATAEXTRACT implicitly names the LONG value file belonging to line 1 ...001, the LONG value file belonging to line 2 ...002, etc.

Example:

DATAEXTRACT * FROM hotel WHERE hno < 100 ;

hno 1-2 ' | ' 3-5

name 6-18 '| ' 19-20

zip 21-25 ' | ' 26-28

address 29-47 ' | ' 48-50

info 51-63

OUTFILE * NULL '-?-'

LONGFILE info HOTEL##0.INF

Result:

10 | Congress | 20005 | 155 Beechwood Str. | 'HOTEL010.INF'

20 | Long Island | 11788 | 1499 Grove Street | -?-

30 | Regency | 20037 | 477 17th Avenue | 'HOTEL030.INF'

40 | Eight Avenue | 10019 | 112 8th Avenue | -?-

50 | Lake Michigan| 60601 | Oak Terrace | -?-

60 | Airport | 60018 | 650 C Parkway | 'HOTEL060.INF'

70 | Empire State | 12203 | 65 Yellowstone Dr. | -?-

80 | Midtown | 10019 | 12 Barnard Str. | -?-

90 | Sunshine | 33575 | 200 Yellowstone Dr. | 'HOTEL090.INF'

ADABAS supports more than one LONG column per table. For DATAEXTRACT, a separate LONGFILE specification with the column name is therefore required for each selected LONG column.

The procedure to extract each LONG value into a separate file can only be used for a table with a relatively small number of entries. For this reason, an option has been provided for DATAEXTRACT which allows all values belonging to one LONG column to be extracted to a single file.

The corresponding LONGFILE specification only contains the filename for the LONG column without the ###... marks denoting the number positions. In addition to the filename, the OUTFILE contains the starting and end positions for each LONG value at the corresponding place.

Example:

DATAEXTRACT * FROM hotel WHERE info IS NOT NULL ;

hno 1-2 '|' 3

name 4-11 '|' 12

zip 13-17 '|' 18

address 19-37 '|' 38

info 39-60

OUTFILE *

LONGFILE info HOTEL.LNG

Result:

10|Congress|20005|155 Beechwood Str. |'HOTEL.LNG' 1-866

30|Regency |20037|477 17th Avenue |'HOTEL.LNG' 867-1026

60|Airport |60018|650 C Parkway |'HOTEL.LNG' 1027-1313

90|Sunshine|33575|200 Yellowstone Dr.|'HOTEL.LNG' 1314-1888

LONG columns with the value NULL are treated according to the usual conventions. The OUTFILE does not contain a filename but the defined representation of the NULL value.

Empty LONG columns are represented by an empty file or by a position specification with an end position less than the starting position.


(Contents)(Previous)