WHEN
The WHEN keyword is valid with INTO TABLE options.
To see where the WHEN syntax fits in the INTO TABLE option, see the diagram in INTO-TABLE.
You can combine the WHEN keyword with a condition that allows you to specify the condition that must be true for LOADPLUS to select a row. You can also use the WHEN keyword with a TABLE=obid option for translating the input table OBID in the input record. This section describes the TABLE=obid specification first and follows with a complete discussion of conditions and predicates.
The value of the RULES installation option designated at installation affects the ways in which WHEN and data conversion, including NULLIF and DEFAULTIF processing, work:
- With RULES=STANDARD, LOADPLUS first compares the values in the input file to the WHEN condition. LOADPLUS then completes, on the resulting records, any data conversion and conversion due to NULLIF and DEFAULTIF processing.
- With RULES=BMC, LOADPLUS first completes any data conversion and conversion due to NULLIF and DEFAULTIF processing. LOADPLUS then compares values to the WHEN condition based on the type of comparison:
- For predicates with column names on the left side, LOADPLUS compares the WHEN condition to the converted data.
- For predicates with (start:end) or field names on the left side, LOADPLUS compares the WHEN condition to the original input data.
Therefore, the same LOAD command can produce different results, depending on which option was specified at LOADPLUS installation. For details and examples, see RULES-installation-option.
TABLE=obid
If you load data by using the FORMAT UNLOAD, FORMAT BMC, or FORMAT BMCUNLOAD option, you can specify the TABLE=obid option. LOADPLUS loads only those records that match the specified table OBID.
The following table describes considerations for using this option with each FORMAT option:
FORMAT option | Considerations |
---|---|
FORMAT UNLOAD | Specify TABLE=obid to translate the input table OBID in the input record when you are loading data from REORG UNLOAD ONLY output, or from a REORG PLUS SYSARC data set when ARCHFORMAT is Db2. Specify the OBID as a decimal number. |
FORMAT BMC | Specify TABLE=obid to translate the input table OBID in the input record when you are loading data from a REORG PLUS SYSARC data set. Specify the OBID as a decimal number. |
FORMAT BMCUNLOAD | You must include TABLE=obid when you specify FORMAT BMCUNLOAD (which enables you to load data from UNLOAD PLUS). Specify the OBID as a decimal number. In this case, the OBID is the object identifier that UNLOAD PLUS assigned when unloading the data, not the table’s Db2 object identifier. The LOAD control cards that UNLOAD PLUS generated contain this OBID. For an example, see Example 14 — LOAD REPLACE from UNLOAD PLUS data in internal format. |
condition block
A condition is an expression that combines predicates. Predicates (see predicates) are comparisons of a field name, column name, or (start:end) field to a constant. You can use conditions and predicates with the WHEN option. (You can also use predicates with the NULLIF and DEFAULTIF options.)
A condition uses the parenthetical operators ( ) and the operators AND, OR, and NOT. The following table shows the results of the WHEN condition when you use the AND, OR, or NOT operator:
p | q | p AND q | p OR q | NOT p |
---|---|---|---|---|
True | True | True | True | False |
True | False | False | True | False |
False | True | False | True | True |
False | False | False | False | True |
LOADPLUS evaluates conditions and predicates left to right, with the following operator precedence:
- ( )
- NOT
- AND
- OR
As soon as LOADPLUS determines the resulting value of the overall condition, evaluation of any further predicates stops. If the result is true, the row is selected. If the result is false, the row is not selected.
Related topic