Hitachi

Hitachi Advanced Database Command Reference


17.2.3 Format of column structure information options

This subsection explains the column structure information options that are specified in the column structure information file.

To specify a column structure information option (when a column structure information file is needed), specify a column structure information file name in the -r option of the adbimport command. For details about the -r option, see -r.

Organization of this subsection

(1) Specification format

If the file format of the input data files is CSV:
{{adbcolumninfo
    -n column-name
    [-r {field-data-number|empty_string}]
    [-b {hex|bin}]
}}
If the file format of the input data files is fixed-length:
set adb_import_input_record_size = input-record-length
 
{{adbcolumninfo
    -n column-name
    -p start-position,length
    [-c empty-string-comparison-value]
    [-b {hex|bin}]
}}

The specification rules for the above are the same as for the server definition. For details about the server definition specification rules, see the topic Syntax rules for the server definition in the HADB Setup and Operation Guide.

(2) Relationship between column structure information options and the file format of the input data files

The column structure information options to be specified in the column structure information file vary according to the file format of the input data files. The following table shows the relationship between column structure information options and the file format of the input data files.

For details about the individual options and operands, see (3) Explanation of specification format.

Table 17‒6: Relationship between column structure information option and the file format of the input data files

No.

Option name or operand name

File format of the input data files

CSV

Fixed-length

1

adb_import_input_record_size operand

N

R

2

adbcolumninfo operand

O

R

3

When the adbcolumninfo operand is specified

-n option

R

R

4

-p option

N

R

5

-c option

N

O

6

-r option

O

N

7

-b option

O

O

Legend:

R: Specification of the option or operand is required.

O: Specification of the option or operand is optional.

N: The option or operand cannot be specified.

(3) Explanation of specification format

(a) Set format

adb_import_input_record_size = input-record-length

~<integer>((1 to 536,870,912))(bytes)

You cannot specify this option if the file format of the input data files is CSV.

When the file format of the input data files is fixed-length, this option specifies the record length (data length per row) in the input data files.

If the records contain a line break code, specify the value in bytes including the length of the line break code.

(b) Command format

adbcolumninfo

Specifies how to handle the input data in units of the columns defined in the table to be processed.

You can omit this operand if the file format of the input data files is CSV.

Specify this operand at least once if the file format of the input data files is fixed-length.

Make sure that the number of times this operand is specified does not exceed the number of columns defined for the table to be processed.

There is no need to use this operand to specify all columns defined in the table to be processed. For any columns not specified by this operand, the following data is assumed as the input data:

  • If the file format of the input data files is CSV:

    Data with a field data number that is the same as the column definition order is assumed.

    A field data number is a number that is assigned according to the order in which field data items within a single record are arranged. The first field data item in the input record is assigned number 1, and the remaining field data items are assigned successive numbers. Even if a field data item is an empty string, it is counted as one field data item.

  • If the file format of the input data files is fixed-length:

    An empty string is assumed.

-n column-name

~<character string>((1 to 100 bytes))

Specifies a column name defined for the table to be processed.

Note the following:

  • If a column name contains a space, enclose the column name between double-quotation marks (").

    Example: "CΔ1"

    Legend: Δ: Space

  • If a column name contains any lowercase letters, enclose the column name between sets of a backslash and a double-quotation mark (\"column-name\"). If the column name is not enclosed in sets of \", all characters in the column name will be treated as uppercase letters.

    Example: \"c1\"

    If a column name contains both lowercase letters and spaces, enclose the column name between sets of a backslash and a double-quotation mark and then between double-quotation marks (").

    Example: "\"cΔ1\""

    Legend: Δ: Space

-p start-position,length

You cannot specify this option if the file format of the input data files is CSV.

Specification of this option is required if the file format of the input data files is fixed-length.

  • start-position

    ~<integer>((1 to 536,870,912))(bytes)

    Specifies the start position of the data that is to be stored in the column specified in the -n option. Specify the position relative to the beginning of the input record (where the beginning of the input record is 1).

  • length

    ~<integer>((1 to 536,870,912))(bytes)

    Specifies the length in the input record of the data that is to be stored in the column specified in the -n option.

    The following cannot be specified for length in the -p option:

    • Any value that is greater than the maximum number of characters in the column with the column name specified in the -n option in character format

    • An odd value if the column with the column name specified in the -n option contains binary data

    • A value of 7 or smaller if bin is specified for the -b option

Important
  • No error occurs if the range specified in this option overlaps the range of values specified in the -p option in any other adbcolumninfo operand.

  • When input data is enclosed in enclosing characters, the enclosing characters are also stored as part of the data. If you do not want the enclosing characters to be treated as data to be stored, specify this option so that ranges do not include enclosing characters.

-c empty-string-comparison-value

~<character string>((1 to 255 bytes))

You cannot specify this option if the file format of the input data files is CSV.

When the file format of the input data files is fixed-length, this option specifies data that is to be treated as an empty string. Any input data that matches this option value is treated as an empty string.

Make sure that the length of this option's value in characters matches the length specified in the -p option. If the length specified in the -p option is greater than 255 bytes and the first 255 bytes of data from the start position specified in the -p option matches the value specified in this option, the data is treated as an empty string.

If the specified value contains any spaces, enclose the value between double-quotation marks (").

-r {field-data-number|empty_string}
  • field-data-number

    ~<integer>((1 to 536,870,912))

    Specifies the field data number of the input data when the format of input data files is CSV.

    You cannot specify this option if the file format of the input data files is fixed-length.

    A field data number is a number that is assigned according to the order in which field data items within a single record are arranged. The first field data item in the input record is assigned number 1, and the remaining field data items are assigned successive numbers. Even if a field data item is an empty string, it is counted as one field data item.

  • empty_string

    Specify this option to assume an empty string for the input data.

If this option is omitted, data with a field data number that is the same as the definition order of the column corresponding to the column name specified in the -n option is assumed as the input data.

Important
  • Even if the field data number specified in this option matches the field data number of the -r option of another adbcolumninfo operand, no error occurs. The same field data is stored in multiple columns of the table to be processed.

  • If you specify a field data number in this option and no applicable field data exists in the input record, an error occurs. If you omit this option and no data that corresponds to the assumed field number exists in the input record, an error occurs.

-b {hex|bin}

Specifies the format of the binary data in the input record when a binary type is defined for the column name specified in the -n option of the adbcolumninfo operand.

  • hex

    Specifies that binary data in the input record is to be treated as binary data in hexadecimal format.

  • bin

    Specifies that binary data in the input record is to be treated as binary data in binary format.

If this option is omitted, hex is assumed.

The following table shows the relationship between the value to be specified in this option and the data type defined for a column with a column name specified in the -n option of the adbcolumninfo operand.

Table 17‒7: Relationship between the data type defined for a column and the value to be specified in the -b option

No.

Data type defined for a column with a column name specified in the -n option

Value specified in the -b option

Data format of the input data

1

Binary

--

Treated as binary data in hexadecimal format

2

hex

Treated as binary data in hexadecimal format

3

bin

Treated as binary data in binary format

4

Data type other than binary

--

Treated as the data type defined for the column

5

hex

An error occurs (the KFAA50265-E message is issued).

6

bin

Legend:

--: Specification of the -b option is omitted.

(4) Error resulting from an invalid value in a column structure information option

The following are two possible scenarios in which the adbimport command will result in an error caused by a column structure information option value:

In both cases, correct the column structure information option value and then re-execute the adbimport command.

(a) When an invalid value is specified for a column structure information option

The table below lists and describes the message IDs that are displayed when an invalid value is specified for a column structure information option and the possible errors. Correct the error and then re-execute the adbimport command.

Table 17‒8: Message IDs that are displayed when an invalid value is specified for a column structure information option and the possible errors

No.

Message ID

File format of the input data files

Possible errors

1

KFAA50265-E

CSV

  • The column name specified in the -n option of the adbcolumninfo operand is duplicated.

  • The -b option is specified for the adbcolumninfo operand in which empty_string is specified for the -r option.

2

Fixed-length

  • The value for start-position + length - 1 specified in the -p option of the adbcolumninfo operand is greater than the input record length specified in the adb_import_input_record_size operand.

  • The length specified in the -p option of the adbcolumninfo operand does not match the length specified in the -c option of the adbcolumninfo operand.

  • The column name specified in the -n option of the adbcolumninfo operand is duplicated.

3

KFAA50266-E

  • CSV

  • Fixed-length

More adbcolumninfo operands are specified than the maximum number of columns in the table.

For details about the maximum number of columns in a table, see the topic Maximum and minimum values related to database in Maximum and Minimum Values in HADB in the HADB Setup and Operation Guide.

(b) When there is a problem with consistency between a column structure information option value and the table to be processed

The table below lists and describes the message IDs that are displayed when there is a problem with consistency between a column structure information option value and the table to be processed, and the possible errors. Correct the error and then re-execute the adbimport command.

Table 17‒9: Message IDs that are displayed when there is a problem with consistency between a column structure information option value and the table to be processed, and the possible errors

No.

Message ID

File format of the input data files

Possible errors

1

KFAA50265-E

CSV

  • The column name specified in the -n option of the adbcolumninfo operand does not exist in the table to be processed.

  • The data type defined for the column specified in the -b option of the adbcolumninfo operand is not binary.

  • The NOT NULL constraint is defined for a column for which empty_string is specified for the -r option of the adbcolumninfo operand, and for which the DEFAULT clause is not specified.

  • If multiple adbcolumninfo operands with the same value are specified for the -r option, the values specified in the individual -b options do not match (if the -r and -b options are omitted, whether there is a match is judged based on the value that is assumed).

2

Fixed-length

  • The column name specified in the -n option of the adbcolumninfo operand does not exist in the table to be processed.

  • The length specified in the -p option of the adbcolumninfo operand is greater than the maximum number of characters that can be expressed in character format for the column specified in the -n option of the adbcolumninfo operand.

  • The length specified in the -p option of the adbcolumninfo operand is less than the number of characters that can be expressed in character format for the column specified in the -n option of the adbcolumninfo operand.

  • The data type defined for the column specified in the -b option of the adbcolumninfo operand is not binary.

  • If there are multiple adbcolumninfo operands with the same value specified for the -p option, the values specified in the individual -b options do not match (if the-b options is omitted, whether there is a match is judged based on the value that is assumed).

3

KFAA50267-E

Fixed-length

In the case of a column that is not specified in the -n option of the adbcolumninfo operand (column in which the input data is to be treated as an empty string), the NOT NULL constraint is defined and the DEFAULT clause is not specified.