fieldSpecification
The field specification options determine the format of the input data.



The field specification options include the following specifications:
- Field name, which is usually a column name in the table that you specify
- Starting position of the field value in the input record
- Data type, data format, and data length of the field
- Other processing options
Requirements
The following table describes requirements that apply to field specifications:
Field specification requirements
Condition | Requirement |
|---|---|
You are running a load job that will cause LOADPLUS to invoke DSNUTILB. | Ensure that the field specification is valid for both LOADPLUS and the IBM Db2 LOAD utility. The only exception is that LOADPLUS translates the TRIM option to the appropriate STRIP specification. |
You are specifying POSITION. | Specify POSITION before the data type. |
You want to load generated default values into system period start and end columns or a transaction start column. | Do not include a field specification for these columns. |
The table contains columns defined as NOT NULL without a DEFAULT defined. | Include either no field specification at all (for any of the columns) or include field specifications for all of the NOT NULL columns that do not have a DEFAULT defined. |
You specify one of the following options:
| Do not include any field specifications. |
You specify FORMAT CSV. |
Alternatively, you can elect to not include any field specifications. If you do not include any field specifications, LOADPLUS loads the data as if you had included a field specification that maps to every column that you are loading. |
The table contains a row change timestamp column that is defined as GENERATED ALWAYS. | You cannot include this field in your field specification. However, you must include a field specification for at least one of the other input fields. |
Not including field specifications
When you do not include any field specifications, note the following information:
- LOADPLUS loads the data as if you had included a field specification that maps to every column that is defined on the table.
- LOADPLUS expects your date, time, and timestamp data to be in external format.
- LOADPLUS expects the format of all other data to be internal.
fieldName
In your field specification, you specify a field name for one of the following purposes:
- To identify the data that you want to load into a column of the table
- As a placeholder in the input record
- To identify a field that you want to use with a predicate of a WHEN, NULLIF, or DEFAULTIF option
If the column corresponding to the named field uses a FIELDPROC, the FIELDPROC must be included in your LINKLIST, JOBLIB, or STEPLIB.
Requirements
The field name specification has the following requirements:
- If you use the named field to specify the data that you want to load into a column and you specify SKIPFIELDS NO, the field name must match the corresponding column name.
- If you use the named field only in the predicate of a WHEN, NULLIF, or DEFAULTIF option (and do not want to load data from that field) or only as a placeholder in the input record, the following requirements apply:
- You must specify SKIPFIELDS YES.
- The field name cannot be the name of a column in the table.
- The data type must be CHAR, VARCHAR, VARGRAPHIC, VARBINARY, or ROWID unless you specify SKIPFIELDS YES ALLTYPES (in which case the field can be any type).
Except for variable-length fields, you must supply the length of the field, either with the POSITION(start:end) option or with the length option. The length must be less than or equal to 255.
If the data type of the field is CHAR, you must explicitly specify a length, even if you use the POSITION option.
If you use this field specification as a placeholder and you specify FORMAT CSV, you do not need to supply the length of the field. LOADPLUS ignores length specifications with FORMAT CSV.
POSITION(start:end) | This option defines the start (and end) position of the named field. Unless LOADPLUS is invoking DSNUTILB, you can abbreviate POSITION to POS. If you specify POSITION, it must appear before the data type on the field specification. The variables start and end designate the locations of the first and last positions of the field. The first position of the record is column one. The start and end positions must be within the bounds of the input record. Field length The end position determines the length of the field, calculated as (end - start + 1). If you specify (start:end) on the POSITION option and you specify the data type, the length that is derived from (start:end) must match the explicit or implicit length of the input data type. When there is a conflict between these lengths, LOADPLUS issues message BMC50124E and the job terminates. If you do not specify POSITION or if you do not specify end on the POSITION option when you specify the data type, LOADPLUS uses the field length to determine the length of the input value. BMC recommends that, when you specify the data type, you always specify the length or implied length from the associated column rather than specify end. To determine the field length from the data type length, see Supported-data-type-conversions-in-LOADPLUS. CSV data When loading CSV data, LOADPLUS currently starts from the first position of each field, ignoring any POSITION (start:end) specification. However, BMC recommends that you specify POSITION(*). In the following descriptions, n and m are integers.
| ||||||||||||||||||||||
VALUE | The VALUE option tells LOADPLUS to load a constant value, CURRENT DATE, CURRENT TIME, or CURRENT TIMESTAMP for the column or field. Restrictions You cannot specify VALUE for a column or field that is defined as any of the following data types:
| ||||||||||||||||||||||
dataType | The data type option specifies the data type and, in most cases, data format and data length of the input value. For details regarding valid data types and information about using these data types, see Data-type-keywords. If you specify options on the data type keywords, you must specify them in the order shown in the syntax diagram. The following table describes how the data type specification operates:
| ||||||||||||||||||||||
NULLIF | NULLIF is a field specification option. It determines whether the value that is assigned to a column is null, based on the condition that you specify. If the condition is satisfied, LOADPLUS assigns null to the column. The column must be nullable. You can specify one of the following values:
Restrictions The following restrictions apply to the NULLIF option:
Additional considerations The following additional considerations apply to the NULLIF option:
| ||||||||||||||||||||||
DEFAULTIF | DEFAULTIF is a field specification option that determines whether the value that is assigned to a column is the default, based on the condition that you specify. If the condition is satisfied, LOADPLUS assigns a default value to the column. The column does not have to be defined NOT NULL WITH DEFAULT. You can specify one of the following values:
Restrictions The following restrictions apply to the DEFAULTIF option:
Additional considerations The following additional considerations apply to DEFAULTIF:
|
Related topic