OPTIONS block syntax and description
Use the OPTIONS block to specify the default conversions that are with the SELECT statements. This block can be used in the GLOBAL block, the UNLOAD block, and the SELECT block.
The effect of the options that are specified in the OPTIONS block at the GLOBAL level or at the UNLOAD level depends on the value that is specified for the VUU057/OPALLFMT PARMLIB parameter:
- If NO is specified for the VUU057/OPALLFMT parameter, all options that you specify in a GLOBAL block or an UNLOAD block apply only to the USER format except for the LOADOPT, FLOAT, UNLROWSET, LOADINDDN, AUTOTAG, and IFERROR options. The LOADOPT, UNLROWSET, LOADINDDN, AUTOTAG, and IFERROR options apply to all formats. The FLOAT option applies to DSNTIAUL, USER, and VARIABLE formats.
- If YES is specified for the VUU057/OPALLFMT parameter, all options that you specify in an OPTIONS block at the GLOBAL level or the UNLOAD level apply to all formats except for some specific options that have no meaning for some formats and for LENGTHBYTE and LENGTH options that are specific to the USER format.
The following table shows the default values for options that are specified in the OPTIONS block. Each option can have a different default value based on the output format.
| Option name | Applies only to FORMAT USER if OPALLFMT=NO (GLOBAL or UNLOAD levels) | Applies to all formats if OPALLFMT=YES | PARMLIB parameter | Default value for FORMAT DELIMITED¹ | Default value for FORMAT DSNTIAUL¹ | Default value for FORMAT EXTERNAL¹ | Default value for FORMAT USER² | Default value for FORMAT VARIABLE¹ |
|---|---|---|---|---|---|---|---|---|
| NULL | Yes | Except FORMAT DELIMITED | VUU014/ULNULL | OFF | X'6F X'00' or VUU014/ULNULL | X'6F X'00' or VUU014/ULNULL | VUU014/ULNULL | X'FF X'00' or VUU014/ULNULL |
| NULLID | Yes | Yes | None | NO | YES | YES | YES | YES |
| NULLPOS | Yes | Except FORMAT DELIMITED | VUU022/NULLPOS | N/A | AFTER or VUU022/NULLPOS | AFTER or VUU022/NULLPOS | VUU022/NULLPOS | BEFORE or VUU022/NULLPOS |
| DATE | Yes | Yes | VUU015/ULDATE | DATE_C or VUU015/ULDATE | DATE_DB2 or VUU015/ULDATE | DATE_DB2 or VUU015/ULDATE | VUU015/ULDATE | DATE_C or VUU015/ULDATE |
| DATEDELIM | Yes | Yes | VUU055/DATEDEL | '-' or VUU055/DATEDEL | Delimiter of the default Db2 format or VUU055/DATEDEL | Delimiter of the default Db2 format or VUU055/DATEDEL | VUU055/DATEDEL | '-' or VUU055/DATEDEL |
| TIME | Yes | Yes | VUU016/ULTIME | TIME_A or VUU016/ULTIME | TIME_DB2 or VUU016/ULTIME | TIME_DB2 or VUU016/ULTIME | VUU016/ULTIME | TIME_A or VUU016/ULTIME |
| TIMEDELIM | Yes | Yes | VUU056/TIMEDEL | '.' or VUU056/TIMEDEL | Delimiter of the default Db2 format or VUU056/TIMEDEL | Delimiter of the default Db2 format or VUU056/TIMEDEL | VUU056/TIMEDEL | '.' or VUU056/TIMEDEL |
| TIMESTAMP | Yes | Yes | VUU017/ULTMSTP | TIMESTAMP_B or VUU017/ULTMSTP | TIMESTAMP_B or VUU017/ULTMSTP | TIMESTAMP_B or VUU017/ULTMSTP | VUU017/ULTMSTP | TIMESTAMP_B or VUU017/ULTMSTP |
| PIC | Yes | Yes | VUU018/ULPIC | -LEAD. or VUU018/ULPIC | -LEAD. or VUU018/ULPIC | -LEAD. or VUU018/ULPIC | VUU018/ULPIC | -LEAD. or VUU018/ULPIC |
| Mask part of the PIC option | Yes | Yes | VUU032/ULMASK | 0.0 or VUU032/ULMASK | 00.0 or VUU032/ULMASK³ | 0.Z or VUU032/ULMASK | VUU032/ULMASK | 00.0 or VUU032/ULMASK³ |
| LOADOPT | No | N/A | N/A | VUU019/ULOPTLDT and VUU020/ULOPTLDP | VUU019/ULOPTLDT and VUU020/ULOPTLDP | VUU019/ULOPTLDT and VUU020/ULOPTLDP | VUU019/ULOPTLDT and VUU020/ULOPTLDP | VUU019/ULOPTLDT and VUU020/ULOPTLDP |
| LENGTHBYTE | Yes | No | None | NO | YES | YES | YES | YES |
| LENGTH | Yes | No | None | REAL | MAX | MAX | Depends on LENGTHBYTE | REAL |
| LOADINDDN | No | N/A | N/A | NO or contents of VUU030/ULOPTNS | NO or contents of VUU030/ULOPTNS | NO or contents of VUU030/ULOPTNS | NO or contents of VUU030/ULOPTNS | NO or contents of VUU030/ULOPTNS |
| FLOAT | No | N/A | None | S390 | S390 | S390 | S390 | S390 |
| UNLROWSET | No | N/A | N/A | VUU035/ULROWSET | VUU035/ULROWSET | VUU035/ULROWSET | VUU035/ULROWSET | VUU035/ULROWSET |
| NULLPAD | Yes | Yes | None | YES | NO | YES | YES | YES |
| PADDING | Yes | Yes | None | Space | Space for characters or graphic strings or x'00' for other data types | x'00' | Space | Space |
| AUTOTAG | No | N/A | N/A | VUU046/ULAUTAG | VUU046/ULAUTAG | VUU046/ULAUTAG | VUU046/ULAUTAG | VUU046/ULAUTAG |
| IFERROR | No | N/A | None | None | None | None | None | None |
| TRIM | Yes | Yes | VUU059/ULTRIM | NO or VUU059/ULTRIM | NO or VUU059/ULTRIM | NO or VUU059/ULTRIM | VUU059/ULTRIM | NO or VUU059/ULTRIM |
- When a value or a parameter name is specified in the table, you can define a default value for each format in the corresponding PARMLIB parameter. If the default value is not defined in the PARMLIB for the format, the hard-coded default value applies.
- When a variable is specified for the USER format, the default value is the content of the corresponding PARMLIB parameter unless a hard-coded default value is specified in the table.
- The default value applies to the DSNTIAUL and VARIABLE formats when a LIKE keyword that forces conversion to a CHAR data type is used or when an INTO clause or REFORMAT clause is used.
- NULL
- Indicates whether the null indicator is generated in the output data set. You can specify NULL
in the SELECT statement in the FORMAT USER syntax also.
The following values can be specified for NULL. Although value-1 and value-2 can be specified as 1 - 4 bytes or characters, you must specify both value-1 and value-2 as the same number of bytes or characters. You can specify value-1 and value-2 in character ('c') or hexadecimal (X'hh') formats.
- value-1
- The value of the null indicator when the column value is NULL.
- value-2
- The value of the null indicator when the column value is NOT NULL.
- OFF
- A null indicator is not generated.
When FORMAT DELIMITED is specified, the default value is OFF. You cannot change this value in the OPTIONS block even when it is specified at the SELECT level.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
You can override the DATE option at the column level with the TYPE keyword in a SELECT statement for the USER format, an INTO clause, or a REFORMAT clause.
- DATE DATE_x
- Specifies the default output format for the DATE columns, where x is any
uppercase alphabetic character A - R or an integer 0 - 7 or DB2.
When a date column is converted into the CHAR format by specifying FORMAT USER or by using either a REFORMAT clause or an INTO clause, the DATE format that is specified in the OPTIONS block is not used. Instead, the default date format of your environment is used.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
You can override the DATE option at the column level with the TYPE keyword in a SELECT statement for the USER format, an INTO clause, or a REFORMAT clause.
- DATE datefmt
- datefmt is a string that describes how a date value must be formatted. It must be specified according to the rules indicated in section Syntax rules for the user-defined date, time or timestamp formats.
- DATEDELIM value
- Specifies the default delimiter that is used in external date representations, where value must be one character and must be 1 byte long, regardless of the literal CCSID.
- TIME TIME_x
- Specifies the default conversion for time representations, where x is any
uppercase alphabetic character A - E or the integer 0 or DB2.
When a time column is converted into a CHAR data type by specifying FORMAT USER or by using either a REFORMAT clause or an INTO clause, the time format that is specified in the OPTIONS block is not used. Instead, the default time format of your renvironment is used.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
You can override the TIME option at the column level by specifying the TYPE keyword in a SELECT statement for the USER format, an INTO clause, or a REFORMAT clause.
- TIME timefmt
- timeformat is a string that describes how a time value must be formatted. It must be specified according to the rules indicated in section Syntax rules for the user-defined date, time or timestamp formats.
- TIMEDELIM value
- Indicates the default delimiter that is used in external time representations, where value must be one character and must be 1 byte long, regardless of the literal CCSID.
- TIMESTAMP TIMESTAMP_x
- Specifies the default conversion for the TIMESTAMP columns, where x is an uppercase alphabetic character A - G or the integer 0.
When a timestamp column is converted into a CHAR data type by specifying FORMAT USER or by using either a REFORMAT clause or an INTO clause, the timestamp format that is specified in the OPTIONS block is not used. Instead, the Db2 standard timestamp external format is used.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
- TIMESTAMP timestampfmt
- timestampfmt is a string that describes how a timestamp value must be formatted. It must be specified according to the rules indicated in section Syntax rules for the user-defined date, time or timestamp formats.
- Syntax rules for the user-defined date, time or timestamp formats
- A user-defined date format (datefmt), time format (timefmt) or timestamp format (timestampfmt)
must be specified according to the following rules.
- The format string must begin with one of the allowed format elements listed in the table below
- The format string can contain only elements allowed for the related format
- The format string can contain only a subset of the elements allowed for the related format
- Each format element can be specified only once
- Separators can be any character or character string but must not contain any character string used as format elements as well as the ambiguous MM string, regardless of the related format.
- PIC
- Defines the numeric data display format that is used when numeric values are converted for
external representation. The PIC keyword has four parameters. You must specify the first three
parameters. The fourth parameter is optional.
- The first parameter specifies the rules for printing the sign:
- -
- Indicates that the minus character (-) is present if the number is negative. Otherwise, the sign character is a blank.
- +
- Indicates that the sign is always present. Positive values have a plus character (+), and negative values have a minus character (-).
- P
- Indicates that the padding character is used for positive values and the minus character (-) is used for negative values.
- V
- The sign byte used depends on the data type as follows:
- for non-float numeric data:
- no sign byte is written for values greater than or equal to zero.
- the minus sign (-) is written for values less than zero.
- for float data:
- the plus sign (+) is written for values greater than or equal to zero.
- the minus sign (-) is written for values less than zero.
- for non-float numeric data:
- The second parameter specifies the position the sign relative to the column.
- LEAD
- The sign is placed in front of the numeric value. LEAD is ignored for floating point numbers.
- TRAIL
- The sign is placed after the numeric value. TRAIL is ignored for floating point numbers.
- The third parameter specifies the decimal separator.
- .
- Use a period as the decimal separator.
- ,
- Use a comma as the decimal separator.
- The optional fourth parameter indicates the formatting rules that are used to display
non-significant zeros for DECIMAL, SMALLINT, and INTEGER values.The following table lists the valid values and explains their impact:
- The Left padding column indicates whether the number is padded on the left with non-significant zeros to fill the output field. The sign character is added to the left of these zeros.
- The Left zero column indicates whether a zero is displayed on the left of the decimal separator when the integer part of the number is 0.
- The Decimal separator column indicates whether the decimal separator is displayed.
- The Right padding column indicates whether the number is padded on the right with zeros up to the number of digits of the decimal scale.
Notes:- The Decimal separator column applies only to decimal data. The decimal separator is never displayed for SMALLINT or INTEGER values.
- The ULMASK variable has no impact on the formatting of values for FLOAT.
The following table contains examples of the effect of the mask parameter when the following decimal values are converted:Table 3. Nonsignificant zero values for DECIMAL and SMALLINT/INTEGER ULMASK value Left padding Left zero Decimal separator Right padding *.* No Only when the value is 0 Only if the decimal value is not 0 No 0.* No Always Only if the decimal value is not 0 No *.0 No Only when the decimal scale is 0 Only if the decimal scale is not 0 Yes 0.0 No Always Only if the decimal scale is not 0 Yes 00.0 Yes Always Only if the decimal scale is not 0 Yes *.Z No Only when the decimal scale is 0 Always Yes 0.Z No Always Always Yes 00.Z Yes Always Always Yes DEC(5.2) converted to a CHAR(8)The following table contains examples of the effect of the mask parameter when decimal values are converted:Table 4. Mask parameter effects when the decimal values 5,2 are converted Mask/value 001.40 000.40 123.00 -123.45 000.00 *.* 1.4 .4 123 -123.45 0 0.* 1.4 0.4 123 -123.45 0 *.0 1.40 .40 123.00 -123.45 .00 0.0 1.40 0.40 123.00 -123.45 0.00 00.0 0001.40 0000.40 0123.00 -0123.45 0000.00 *.Z 1.40 .40 123.00 -123.45 .00 0.Z 1.40 0.40 123.00 -123.45 0.00 00.Z 0001.40 0000.40 0123.00 -0123.45 0000.00 DEC(5,0) converted to a CHAR(8)The following table contains examples of the effect on the mask parameter when decimal values are converted:Table 5. Mask parameter effects when the decimal values 5,0 are converted Mask/value 12345. 00001. -12345. 00000. *.* 12345 1 -12345 0 0.* 12345 1 -12345 0 *.0 12345 1 -12345 0 0.0 12345 1 -12345 0 00.0 0012345 0000001 -0012345 0000000 *.Z 12345. 1. -12345. 0. 0.Z 12345. 1. -12345. 0. 00.Z 012345. 000001. -012345. 000000. DEC(5,5) converted to a CHAR(9)Table 6. Mask parameter effects when the decimal values 5,5 are converted Mask/value .12345 .10000 -.12345 .00000 *.* .12345 .1 -.12345 0 0.* 0.12345 0.1 -0.12345 0 *.0 .12345 .10000 -.12345 .00000 0.0 0.12345 0.10000 -0.12345 0.00000 00.0 00.12345 00.10000 -00.12345 00.00000 *.Z .12345 .10000 -.12345 .00000 0.Z 0.12345 0.10000 -0.12345 0.00000 00.Z 00.12345 00.10000 -00.12345 00.00000
- The first parameter specifies the rules for printing the sign:
- LOADOPT
- Modifies the options of the Db2 LOAD command. Specify the options that you want Db2 HPU to place in the LOAD SYSIN that is created during the unload process.
The value of the LOADOPT keyword is created by merging values that are specified in the PARMLIB, the GLOBAL block, the UNLOAD block, and the SELECT block. However, if LOADOPT is also specified in the FORMAT specification, the LOADOPT keyword is used as is. It is not merged with previous levels.
- tableoptions
- Options to specify at the table level
- partoptions
- Options to specify at the partition level
- tablespaceoptions
- Options to specify at the table space level
The variables tablespaceptions, partoptions and tableoptions values are positional, and the commas are required even if you do not want to set the value for one subparameter. For example, to specify the value NUMRECS for tableoptions, specify LOADOPT (,,NUMRECS).
The following syntax diagram shows the LOADOPT keywords that are recognized by Db2 HPU:Important: Make sure to specify these keywords at the intended and applicable level (tablespaceoptions, partoptions or tableoptions). Refer to the Db2 publication for details on applicability and meaning of these keywords.The load options in the PARMLIB and any OPTIONS blocks that you specify in the GLOBAL block or the UNLOAD block are merged. If you specify the same option in two or more places, they are merged with the following priority:
- UNLOAD block
- GLOBAL block
- PARMLIB
Any keywords that you specify that are not shown in the LOADOPT syntax diagram are added to the total option sequence. They are not merged with other options.
Important: If a LOADOPT keyword is specified in the FORMAT block, it is used as is, and it is not merged.Note: If the Db2 HPU spanned YES option is specified, do not specify the FORMAT keyword in the LOADOPT option as this can lead to a wrong LOAD statement notified at LOAD time by either a syntax error message or by an error during the load processing. - LENGTHBYTE
- Specifies whether the two length bytes for variable-length columns are written to the output
data set. LENGTHBYTE applies only when FORMAT USER is specified. It is ignored when other output
formats are specified.
- YES
- Writes the two length bytes.
- NO
- Does not write the two length bytes.
The default value is YES when FORMAT USER is specified. You can change the default value by specifying an OPTIONS block at the GLOBAL or SELECT level or by changing LENGTHBYTE for a specific column in the FORMAT USER definition.
The following rules apply when you specify FORMAT USER:- When LENGTHBYTE YES is specified, the default value for the LENGTH keyword is REAL.
- When LENGTHBYTE NO is specified, the default value for the LENGTH keyword is MAX.
- When LENGTHBYTE NO and LENGTH REAL are specified, Db2 HPU cannot generate a LOADDDN and issues the INZU203E error message if a LOADDDN file was requested.
When you specify FORMAT DELIMITED, the default value is NO. You cannot change this value by specifying an OPTIONS block, even when it is specified at the SELECT level.
When you specify FORMAT DSNTIAUL, FORMAT EXTERNAL, or FORMAT VARIABLE, the default value is YES. You cannot change this value by specifying an OPTIONS block, even when it is specified at the SELECT level.
- LENGTH
- Specifies whether to use the real or maximum length for variable-length fields. This keyword
applies only for variable-length fields and for the USER and DSNTIAUL output formats. It is ignored
when other output formats are specified.
- REAL
- The length of the field does not change (value of the two length bytes).
- MAX
- The output field is padded to its maximum length by adding binary zeros.
When you specify FORMAT USER, the default value for the LENGTH keyword depends on the setting of the LENGTHBYTE keyword. You can change the default value for the USER format by specifying an OPTIONS block at the GLOBAL or SELECT level or by changing the LENGTH keyword for a specific column in the FORMAT USER definition.
When you specify FORMAT DSNTIAUL, the default value is MAX. You can change the default value for the DSNTIAUL format by specifying an OPTIONS block at the SELECT level.
When you specify FORMAT VARIABLE or FORMAT DELIMITED, the default value is REAL. You cannot change this value by specifying an OPTIONS block, even when it is specified at the SELECT level.
When you specify FORMAT EXTERNAL, the default value is MAX. You cannot change this value by specifying an OPTIONS block, even when it is specified at the SELECT level.
- NULLID
- Specifies whether a null indicator byte is to be added at the beginning of an output field. You
can also specify NULLID in the SELECT statement in the FORMAT USER syntax.
- YES
- The null indicator is created. If the column is null, the indicator is X'FF. Otherwise, the indicator is X'00'. The Db2 LOAD command uses the indicator to load null values into a table. You can change the values of the null indicator by specifying the NULL keyword.
- NO
- The null indicator is not created.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
- NULLPOS
- Specifies the position of the NULL indicator. You can also specify NULLPOS in the SELECT statement in the FORMAT USER syntax. This parameter does not apply to a LOB column unloaded in a spanned format (SPANNED YES option) in which case the NULL indicator is written before the output field (containing the data) whatever the value of NULLPOS.
- BEFORE
-
The null indicator is placed before the field containing the related data.
- AFTER
-
The null indicator is placed after the field containing the related data.
- FRONT
- The null indicators are gathered at the front of each unloaded record. The sequence of the NULL indicators is the same as the sequence of the related columns.
- LOADINDDN
-
Specifies whether INDDN ddname cards are automatically inserted into the Db2 LOAD command according to the ddnames specified by the UNLOAD command for the data sets containing the unloaded data.
- YES
-
INDDN ddname cards are automatically generated. If a TEMPLATE is used to allocate the output file, Db2 HPU also generates a TEMPLATE statement to allocate the ddname used by the INDDN cards generated by the LOADINDDN(YES) feature. To avoid any invalid duplicate specification of INDDN cards, any INDDN option specified via the tableoptions of a LOADOPT option from the OPTIONS block or via the “Options for global LOAD statement (VUU019/ULOPTLDT)” parmlib parameter is ignored.
- NO
-
No INDDN card is automatically generated. This allows to disable a LOADINDDN(YES) setting made at the parmlib level and, subsequently, to ensure INDDN option specified via the tableoptions of a LOADOPT option from the OPTIONS block or via the “Options for global LOAD statement (VUU019/ULOPTLDT)” parmlib parameter are taken into account.
As the generated LOAD command does not contain any INDDN option, the single SYSREC ddname is assumed as input ddname regardless of the unload being requested at the global or partition level. Accordingly, only the load options specified for the table space level (i.e., the tablespaceoptions suboption of the LOADOPT option) are taken into account and any load options specified at the partition or table option (i.e., the partoptions or tablesoption suboption of the LOADOPT option) are ignored.
The default value is either NO or the value that is specified in the VUU030/ULOPTNS parameter, with parameter LOADINDDN.
- FLOAT
- Specifies the output format of the numeric floating point data. The FLOAT keyword applies only
to the binary output format.
- S390
- Indicates that the binary floating point data is written to the output records in the S/390® internal format (hexadecimal floating point or HFP).
- IEEE
- Indicates that the binary floating point data is written to the output records in the IEEE format (binary floating point or BFP).
The default value is S390.Restriction: The same output format is used for all FLOAT columns in one SELECT statement. You cannot specify the FLOAT keyword at the column level in the USER format. - UNLROWSET
- Specifies the number of rows that a single SQL FETCH statement retrieves. Specifying the number of rows to retrieve improves the performance of SELECT statements that are processed by Db2 when you specify DB2 FORCE or DB2 YES with SELECT statements that are not supported by Db2 HPU. Valid values are 1 - 32767. When you specify 1, a single-row FETCH statement is used instead of a multiple-row FETCH statement. The multiple-row FETCH statement is available only in Db2 Version 8 NFM or later. The UNLROWSET keyword is ignored for earlier Db2 versions.
The default value is the value of the VUU035/ULROWSET parameter.
- NULLPAD
- Specifies whether the padding character is used to fill the output field when a null value is
unloaded.
- NO
- When a null value is unloaded, the output field is filled with binary zeros (x'00').
- YES
- When a null value is unloaded, the output field is filled with the padding character.
The default values for formats are shown in Default values per output format for options that are specified in the OPTIONS block.
When you specify FORMAT DELIMITED, the value of the NULLPAD keyword is always YES, and you cannot change it.
- AUTOTAG size
- Allows you to add a tag, which is an external numeric value, to each record that is
unloaded. The output data for each SELECT statement has its own tag. If you specify AUTOTAG at
the GLOBAL level or at the UNLOAD level, the AUTOTAG keyword applies to all SELECT statements
if they are written in a common file.
If you specify AUTOTAG at the SELECT level, Db2 HPU requires all SELECT statements that write in a common output file to use the same number of digits. File records with an autotag cannot be mixed with file records without an autotag.
The generated tag starts at 1 and is automatically incremented for each SELECT statement (either explicitly coded or generated by a LISTDEF) of the same SYSIN for which AUTOTAG is specified, either explicitly coded or generated by a LISTDEF or LISDEFTBV.
The AUTOTAG keyword applies only to logical unloads, which use SELECT statements to unload Db2 data. It does not apply to physical unloads.
- size
- Specifies the number of digits in the tag. Valid values are 0 - 8. If you specify 0, an
AUTOTAG is not generated for the corresponding SELECT statements.Important: If the value of the tag that is computed for a SELECT statement exceeds the number of digits that you specified for the AUTOTAG keyword, Db2 HPU stops.
- IFERROR
- Defines the value that is assigned to an output field if a conversion error occurs while the output field is formatted or if an error occurs while an expression that is natively processed by Db2 HPU is evaluated. The IFERROR keyword applies only to conversion or formatting that was made during the unload process. The IFERROR keyword does not apply to conversion errors when constants are specified in the SELECT statement and these constants are converted into a different data type by using an INTO clause, a REFORMAT clause, or by specifying FORMAT USER. These constants are converted during the initialization process. If an error occurs during this process, a syntax error is issued, and processing stops.
The value that you specify applies to all output fields for the corresponding SELECT statements.
If an expression error for a SELECT statement that is processed by Db2 occurs, Db2 issues an SQL error message, and the default value does not apply.
- DEFAULT
- The default value is assigned. This value depends on the data type.
- NULL_OR_DEFAULT
- If the output field allows a null value, the NULL value is assigned to the field. Otherwise, the default value is used.
- TRIM
- Allows you to suppress the trailing blank characters when data is unloaded into VARCHAR,
VARGRAPHIC, CLOB, and DBCLOB output fields expect if SPANNED YES is used. The
length of the output field is adjusted to match the effective number of characters that are written.
If you specify FORMAT DELIMITED, the TRIM keyword applies to output fields with CHAR and GRAPHIC data types.
If you specify the TRIM keyword at the GLOBAL level, it applies only to the USER format unless YES is specified for the VUU057/OPALLFMT PARMLIB parameter. If you specified YES for the VUU057/OPALLFMT PARMLIB parameter or if you specify the TRIM keyword at the SELECT level, the TRIM keyword applies to any output format.
The TRIM keyword does not apply when numeric data is converted to numeric external.- NO
- Trailing blank characters are not suppressed.
- YES
- Trailing blank characters are suppressed.
The default value is the value of the VUU059/ULTRIM PARMLIB parameter.
- PADDING
- Specifies the padding character that Db2 HPU uses
at the column level or the record level.
- Column
- The padding character is used to pad the null values when you specify NULLPAD YES to pad the output field when the specified value is shorter than the field or to pad numeric data that is converted to character data.
- Record
- The padding character is used to pad the end of the output record up to the length of the physical record when the format of the DCB (RECFM) is fixed and when the output record is shorter than the LRECL.
- PADDING ( SBCS padding [, DBCS padding [, record padding ] ] )
- Specifies the padding characters for SBCS and DBCS characters when a character string is
converted to a longer character string and when the generated record is padded to its specified length.
- SBCS padding
- The default value is ' ' (an EBCDIC SBCS blank character). You can specify the value in the
following ways:
- 'c'
- Specifies an EBCDIC SBCS character. This character can be converted to match the output CCSID.
- X'hh'
- Specifies an SBCS character in hexadecimal format. This character is used as-is, regardless of the output CCSID.
- DBCS padding
- The default value is the DBCS space character in the output CCSID. To obtain this DBCS space
character, the UTF16 character UX'3000' is converted into the output CCSID. You can specify the
value in the following ways:
- X'hhhh'
- Specifies a DBCS character in a 2-byte hexadecimal format. This character is used as-is, regardless of the output CCSID.
- G'SI_graphic_char_SO'
- Specifies a graphic character as a graphic constant that is expressed in EBCDIC. Shift-out/shift-in bytes are included. This character can be converted to match the output CCSID.
- GX'hhhh'
- Specifies a graphic character as a hexadecimal EBCDIC DBCS constant. This character can be converted to match the output CCSID.
- UX'hhhh'
- Specifies a graphic character as a hexadecimal UTF16 Unicode constant. This character can be converted to match the output CCSID.
- Record padding
- Depending on the output format that is used to unload the data, the default value can be either
of the following values:
- X'00' for the DSNTIAUL format and the EXTERNAL format,
- The SBCS blank character that was converted in the output CCSID for all other formats.
You can specify the value in the following ways:
- 'c'
- Specifies an EBCDIC SBCS character. This character can be converted to match the output CCSID.
- X'hh'
- Specifies an SBCS character in hexadecimal format. This character is used as-is, regardless of the output CCSID.
If you do not specify the PADDING keyword, the following values are default values for padding at the character level and the record level:- SBCS characters
-
- X'00' for variable-length columns in the DSNTIAUL format and the EXTERNAL format,
- The SBCS blank character that was converted to match the output CCSID for all other formats and, if padding at the column level is not specified, for columns that use an INTO clause or a REFORMAT keyword.
- DBCS characters
- UTF16 value UX'3000' that was converted to match the output CCSID
- Record padding character
-
- X'00' for the DSNTIAUL format and the EXTERNAL format,
- The SBCS blank character that was converted to match the output CCSID for all other formats.
Important: When you specify FORMAT DSNTIAUL or FORMAT EXTERNAL, PADDING () does not give the same result as omitting the PADDING keyword because the SBCS padding is x'00' when the PADDING keyword is omitted, and it is the SBCS blank character when the PADDING keyword is specified.
- REFORMAT
- Defines the default reformatting for all columns that correspond to a specific Db2 definition.
- internal-data-type
- Specifies a Db2 data type as it is specified in the CREATE TABLE statement. For columns that allow a length or length and scale specification, such as CHAR or DECIMAL columns, you can specify the data type with or without the length. Specifying the data type without the length defines a default conversion for all columns with this data type. If you specify a data type plus a length, such as CHAR(8), the default conversion applies only to columns that are defined with this precise data type. The following diagram shows the syntax of the internal data type:
- output-data-type
- The following syntax diagram shows the output data type:
- column-format-option
- Use the column format option block in the REFORMAT clause of the OPTIONS block, in the FORMAT USER statement, or in the INTO clause of the SELECT statement. The following diagram shows the syntax of the column format option:
For example, you can use the REFORMAT keyword to specify that you want all CLOB columns that are processed are changed into CLOBF columns by using a specific TEMPLATE statement without having to define it in an INTO clause or in a FORMAT USER statement. You can also use the REFORMAT keyword to convert all DECIMAL(10,0) columns in INTEGER format.
The REFORMAT keyword is especially useful to make format conversions when you use LISTDEF or LISTDEFTBV because the INTO clause is not supported in such a case and using the USER format is either not possible.
The formatting options that are specified in the REFORMAT keyword are overridden by the options that are defined in the INTO clause of the fast select block by the LIKE keyword that is used in the DSNTIAUL format or the VARIABLE format and by the conversion option that is defined in the USER format.
- PADDING padding-character
- Specifies the padding character, where padding-character is the padding character to be used when padding is required for a column.
- DELIM literal
- When this keyword specified in a USER block, it indicates the delimiter to be used in
external DATE or TIME fields. The literal must be a single character and must be one byte
long, regardless of the literal CCSID.
For DATE fields, a hyphen (-) is the default value.
For TIME fields, a period (.) is the default value.
For the TIMESTAMP column, both delimiters are used.
- LENGTHBYTE
- Specifies whether to write the two length bytes for variable-length columns to the
output data set.
- YES
- The two length bytes are written.
- NO
- The two length bytes are not written.
- LENGTH
- Specifies whether the real or maximum length is to be used for variable-length fields.
- REAL
- The length of the field does not change (value of the two length bytes).
- MAX
- The output field is padded to its maximum length with binary zeros.
The LENGTH keyword is useful only for variable-length fields.
The default value is REAL.
- NULLID
- Specifies whether a null indicator byte is added to the beginning of an output field.
You can specify NULLID in the OPTIONS block also.
- YES
- The null indicator is created. If the column is null, this indicator is set to the X'FF' value. Otherwise, the indicator is set to X'00'. The indicator can be used by the Db2 LOAD command to load null values into a table. You can change values of the null indicator by using the NULL keyword.
- NO
- The null indicator is not created.
The default value is YES.
- JUST
- Specifies whether to align the output character string. The JUST keyword specifies right
or left justification for extended numeric values or for character strings when strings are
converted to a greater length.
- RIGHT
- Justify the output character string to the right.
- LEFT
- Justify the output character string to the left.
The default value depends on the type of string. For conversion between character strings, the default value is LEFT. For numeric conversions in strings, the default value is RIGHT.
- PIC block
- For a description of the PIC block, see the PIC keyword.
- NULL
- Indicates whether the null indicator is generated in the output data set. You can
specify NULL in the OPTIONS block also.
- value-1
- Indicates the value of the null indicator when the column value is NULL. It can be specified in character ('C') or hexadecimal (X'hh') format.
- value-2
- Indicates the value of the null indicator when the column value is NOT NULL. It can be specified in character ('c') or hexadecimal (X'hh') format.
- OFF
- No null indicator is generated.
The default is the value that is specified for the VUU014/ULNULL PARMLIB parameter.
- CCSID
- Specifies that a CCSID conversion will be done on the output field. The CCSID conversion
between the CCSID of the unloaded data and the CCSID that was specified in this parameter
must be defined. When a LOB file reference is specified, the specific
CCSID conversion is applied on the LOB data. The LOBFILE DSNAME that is generated in the
output record is kept in the default CCSID of the output file.
- ccsid
- Specify a valid CCSID value for the CCSID of the output field.
- UTF8
- Unicode Transformation Format, 8-bit encoding form is used. UTF8 is equivalent to 1208.
- UTF16
- Unicode Transformation Format, 16-bit encoding form is used. UTF16 is equivalent to 1200.
- BLOBF
- Specifies that the output field will contain the name of the file in which the BLOB is to be unloaded without CCSID conversion.
- CLOBF
- Specifies that the output field will contain the name of the file in which the CLOB will be unloaded with any required CCSID conversion.
- DBCLOBF
- Specifies that the output field will contain the name of the file in which the DBLOB will be unloaded with any required CCSID conversion.
- template-statement-name
- Specifies the name of a TEMPLATE statement that is
used to allocate the file that will contain the LOB data. The DSN of the TEMPLATE statement
that is used must contain either the &UNIQ variable that is explicitly coded or
automatically generated for a PDS or PDS/E, or a user-defined variable that is associated
with a TEMPLATESET to the :RECNUM predefined variable.
BLOBF, CLOBF, and DBCLOBF output types can be used only when converting BLOB, CLOB and DBCLOB columns. The output type that is defined with the TYPE keyword must be either CHAR or VARCHAR, and the corresponding column must be large enough to contain the generated data set name.
To use LOB file reference with a table that comes from a LISTDEF or a LISTDEFTBV, use BLOBF, CLOBF, or DBCLOBF in the REFORMAT keyword of the OPTIONS block. This option specifies that all LOB data will be unloaded by using LOB file reference. The associated TEMPLATE statement must distinguish the generated files to prevent duplicates. When you unload data from a LISTDEF or a LISTDEFTBV with tables that contain potentially more than one LOB column, the TEMPLATE statement that is used in the REFORMAT keyword can contain a user-defined variable that is associated with the :COLNUM or :COLNAME predefined variables. When you specify the &TS or &SN variables in a TEMPLATE statement that is used with BLOBF, CLOBF, or DBCLOBF, Db2 HPU substitutes the name of the table space that stores the LOB column value, not the base table space name. By substituting the name of the table space, Db2 HPU can generate unique data set names for each LOB column.
- IFERROR
- Defines the value that must be assigned to the output field if a conversion error occurs
when the output field is formatted or if an error occurs when an expression is evaluated by
Db2 HPU. IFERROR applies only to conversion
or formatting that was made during the unload process. IFERROR does not apply to conversion
errors when constants are specified in the SELECT statement and these constants are
converted into a different data type by using an INTO clause, a REFORMAT keyword, or a
FORMAT USER specification. These constants are converted during the initialization process.
If an error occurs during this process, a syntax error is issued, and processing
stops.
If an expression error for a SELECT statement that was processed by Db2 occurs, Db2 issues an SQL error message, and a default value does not apply.
- value
- Specifies a value to assign to the output field in a conversion error or an error
that occurs when an expression is evaluated. The following constant values are valid:
- Character or hexadecimal constants
- Character constants or hexadecimal constants are accepted for any type of output
field. In CCSID conversion, character constants are converted from EBCDIC into the
output CCSID, but hexadecimal constants are not converted into the output
CCSID.When you use the following output data types, Db2 HPU uses CCSID conversion for character constants:
- CHAR
- VARCHAR
- CLOB
- GRAPHIC
- GRAPHIC EXTERNAL
- VARGRAPHIC
- DBCLOB
- SMALLINT EXTERNAL
- INTEGER EXTERNAL
- BIGINT EXTERNAL
- FLOAT EXTERNAL
- DECIMAL EXTERNAL
- DECFLOAT EXTERNAL
- DATE_EXTERNAL
- DATE_A to DATE_P
- DATE_DB2
- TIME EXTERNAL
- TIME_A to TIME_E
- TIME_DB2
- TIMESTAMP EXTERNAL
- TIMESTAMP_A to TIMESTAMP_G
When you use the following output data types, Db2 HPU does not use CCSID conversion for character constants:- BINARY
- VARBINARY
- BLOB
- SMALLINT
- INTEGER
- BIGINT
- FLOAT
- DECIMAL PACKED
- DECIMAL ZONED
- DECFLOAT
- DATE
- DATE_Q - DATE_R
- DATE_0 - DATE_7
- TIME
- TIME_0
- TIMESTAMP
- TIMESTAMP_0.
- Numeric constants
- Use numeric constants only if the output field corresponds to numeric data in
internal format. Otherwise, use a character constant.
The following table shows the conversions that are accepted:
Table 7. Accepted conversion types Output data type Type of numeric constant accepted SMALLINT Integer constant INTEGER Integer constant BIGINT Integer or BIGINT constant DECIMAL Integer constant that fits in the DECIMAL output field or a decimal constant with scale and precision that is smaller or equal to the scale and precision of the output field FLOAT Integer, BIGINT, decimal, or float constants DECFLOAT Any numeric type
- DEFAULT
- The default value is assigned to the field. The default value depends on the data type.
- NULL_OR_DEFAULT
- If the output field allows a null value, the NULL value is assigned to the field. Otherwise, the default value is assigned.
- NULL
- The NULL value is assigned to the field. The output field must include a null indicator.
- CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP
- The assigned date, time, or timestamp is identical for each row, and its value is obtained at the beginning of the process. In internal or external format, CURRENT_DATE is allowed only for the DATE field; CURRENT_TIME is allowed only for the TIME field; and CURRENT_TIMESTAMP is allowed only for the TIMESTAMP field.
- TRIM
- Allows you to suppress the trailing blank characters when you unload data into VARCHAR,
VARGRAPHIC, CLOB, and DBCLOB output fields. If you specify FORMAT DELIMITED, the TRIM keyword
applies to output fields with CHAR and GRAPHIC data types. The length of the output field is
adjusted to match the effective number of characters that are written.
The TRIM option does not apply when numeric data is converted to numeric external.
- NO
- Trailing blank characters are not suppressed.
- YES
- Trailing blank characters are suppressed.
The default value is the value of the VUU059/ULTRIM PARMLIB parameter.
- TEMPLATESET
- Use the TEMPLATESET block to assign values to any user-defined variable that is used in a
TEMPLATE definition. Assign values by using string constants or predefined variables that are set by
Db2 HPU at run time. A colon (:) must precede
predefined variable names. The following diagram shows the syntax of the TEMPLATESET
block:
A predefined variable can be one of the following variables:
- :COLNUM
- Specifies the position of the column in the SELECT statement. This variable is a 5-digit numeric value and is generally used when LOB columns are unloaded by using a LOB file reference (CLOBF, BLOBF, or DBLOBF data types).
- :SELNUM
- Specifies a unique number for the SELECT statement regarding:
- the set of SELECT statements from a given UNLOAD statement for explicit SELECT statements
- the set of all the tables involved in a LISTDEF statement for a SELECT FROM LIST statement [HPU 5.1 if the VUU030/ULOPTNS parmlib parameter specifies SELNUM_PER_TS_IF_LISTDEF(NO)]
- the set of tables of a table space involved in a LISTDEF statement for a SELECT FROM LIST statement [in HPU 5.1 only if the VUU030/ULOPTNS parmlib parameter specifies SELNUM_PER_TS_IF_LISTDEF(YES)].
- :UNLNUM
- Designates the sequential number of the UNLOAD statement. This variable is a 5-digit numeric
value determined as follows:
- it takes the reading sequence into account: numbers are incremented along with the reading sequence.
- if the UNLOAD statement does not contain any SELECT statement with a FROM LIST clause, its number is the number of the previous UNLOAD statement (regarding the reading sequence in the SYSIN data set) plus one.
- if the UNLOAD statement contains a SELECT statement with a FROM LIST clause, the single UNLOAD statement is expanded into a sequence of one UNLOAD statement per table space described by the LISTDEF statement. Each table space is associated with a :UNLNUM value, starting with 1 and incremented by one for each table space. Be aware that, as the ULNUM value assigned to a given table space is not predictable, only use the ULNUM variable to distinguish the output datasets related to a given table space) and to associate the output datasets (e.g. OUTDDN and LOADDDN) related to the same tablespace but do not use this variable as a part of an input dataset name (e.g. DDLDDN or COPYDDN) as this could lead Db2 HPU to process the unload of some table spaces with wrong input datasets.
- :RECNUM
- The record number is a 15-digit numeric value and is internally processed. By default, the variable that is associated with :RECNUM is replaced by the last seven digits of the record number. A substring can be applied to this variable to obtain another part of the record number, or to retrieve fewer digits. This variable is generally used when LOB columns are unloaded by using a LOB file reference (CLOBF, BLOBF, or DBLOBF data types).
- :COLNAME
- This predefined variable contains the first characters of the column name. When the associated variable is replaced by its value, it is truncated to make it a valid qualifier in the generated DSNAME. Valid values are 1 - 8 characters. This variable is generally used when LOB columns are unloaded by using a LOB file reference (CLOBF, BLOBF, or DBLOBF data types).
When these variables cannot be evaluated, :COLNUM and :SELNUM are set to 00000; :RECNUM is set to 0000000; and :COLNAME is set to COLn, where n is a sequential number. This sequential number ensures unicity, but it does not have a specific meaning regarding the actual database or the table space that it represents.
:SELNUM, does not apply when the TEMPLATE statement is used with UNLDDN.
:COLNUM, :COLNAME, and :RECNUM, do not apply when the TEMPLATE statement is used outside of a LOB file reference.
You can code the TEMPLATESET block in the OPTIONS or GLOBAL OPTIONS block. When the TEMPLATESET block is used with LOB columns that use a LOB file reference, the TEMPLATESET block can be used in the column format option block. The COLUMN FORMAT OPTIONS block can be used in the REFORMAT keyword, in the INTO clause, or in the FORMAT USER definition.
All TEMPLATESET definitions that are coded in high-level syntax are available at a lower level. For example, if TEMPLATESET is coded to define a user variable in the GLOBAL OPTIONS block, this variable will be available to build data set names in the templates that are used in all UNLOAD commands and for all SELECT statements in these UNLOAD commands. However, if TEMPLATESET is defined only in an OPTIONS statement that is coded in a SELECT statement, the variable definition will be available only for the TEMPLATE statements that are used in this specific SELECT statement. The definition of a user variable with a TEMPLATESET that is made at a lower level overrides the definition of the same user-defined variable that was made at a higher level but only at this lower level. For example, if a user variable is set to :SELNUM in the GLOBAL OPTIONS block and set to ABC in the OPTIONS statement that is coded in one of the SELECT statements, the replaced value will be :SELNUM for all other SELECT statements, and ABC for the SELECT statement that overrides the variable definition.
- HIDDEN
- Specifies whether hidden columns are unloaded when a SELECT * statement is used. You can also
specify this keyword as the third parameter after the UTILID in the PARM field in the EXEC
statement. When the HIDDEN parameter is specified and this keyword is specified in SYSIN, the value
that is specified in SYSIN is used.
- NO
- Specifies that hidden columns are not unloaded when a SELECT * statement is used.
- YES
- Specifies that hidden columns are unloaded when a SELECT * statement is used. For SELECT statements that are processed by Db2, the HIDDEN keyword is ignored.
- SPANNED
- For logical unload statement (using a SELECT clause) which result table has LOB columns and one
of the CLOB, BLOB or DBCLOB format is applied to these columns. This option specifies whether
the output data must be unloaded into a VBS data set in spanned record format compliant with
the Db2 LOAD utility used with the FORMAT SPANNED YES
option.
- NO
- The records of the output data set do not have the spanned format.
- YES
- The records of the output data set have the spanned format. The content of the LOB data is unloaded along with the data from the other columns.
Note:- SPANNED YES only applies to LOB data being unloaded as LOB but not if a conversion to any other type is requested.
- SPANNED YES can only be used when the FORMAT option specifies one of the following:
- VARIABLE
- USER provided the related LOAD statement can be generated
- SPANNED YES cannot be used with DELIMITED, INTERNAL and EXTERNAL format.
- when SPANNED YES is specified, the parameter TRIM YES does not apply for LOB columns.
- SPANNED YES cannot be used if XML data is to be unloaded.
- ENFORCE_COLUMN_ORDER
- If SPANNED YES option is requested, the LOB data will be placed at the end of the result
table (defined by the column list of the SELECT clause and by the optional INTO clause). This
condition might not be fulfilled because of the sequence of the explicit expressions that
define the result table or because of the underlying table definition when a SELECT * is
specified. Db2 HPU can rearrange the columns of
the result table to ensure the LOB columns are gathered at the end of the record. The
ENFORCE_COLUMN_ORDER specifies if the reordering feature is disabled, i.e. if the native
column sequence of the result table is kept.
- YES
- The order of the column in the select statement is kept. If the LOB columns are not the last (rightmost) columns of the result table, the processing stops and an error message is issued.
- NO
- If necessary, Db2 HPU rearranges the columns of the specified result table to ensure the LOB columns are gathered at the end of the record.
- XMLSET
- XMLSET specifies the tags to be used for the XML output. Both columns and records can be tagged. You can specify the way columns (by specifying the COLUMN keyword) and/or records (by specifying the RECORD keyword) are tagged.
- OPTIMIZATION_HINT
- Allows to process an SQL statement: SET CURRENT OPTIMIZATION HINT 'string constant' when processing the unload in SQL mode. This option is only available if DB2 parameter is set to FORCE. For example, in Db2 HPU syntax, OPTIMIZATION_HINT 'NOHYB' generates the SQL statement: SET CURRENT OPTIMIZATION HINT = 'NOHYB'
- QUERY_ACCELERATION value
- Allows to have the following SQL statement run when a logical unload is processed in SQL mode:
- CHARACTER_LOSS
- It specifies the behavior of the product when significant data from character column is lost during unload formatting because of an INTO or REFORMAT clause and an ssss syntax is specified.
Db2 HPU considers a data loss has occurred for a character column if the data truncation removes any character that does not belong to the padded part of the character string, i.e. a sequence of padding characters that ends at the right end of the character string.
The data loss is checked for the following data types:- CHAR
- VARCHAR
- GRAPHIC
- VARGRAPHIC
- BINARY
- VARBINARY
Specify one of the following values:
- IGNORE
- No control is done.
- WARNING
- A warning message is issued for any column affected by a data loss.
- REJECT
- An error message is issued for any column affected by a data loss.
The default value is the value of the VUU071/LOSSCHAR PARMLIB parameter.
- NUMERIC_LOSS
- It specifies the behavior of the product when significant data from numeric column is lost
during unload formatting ( via INTO or REFORMAT clause) and an ssss syntax is specified.
Db2 HPU considers a data loss has occurred for a numeric column if the numeric value has changed.
The data loss is checked for the following data types:- SMALLINT
- INTEGER
- BIGINT
- DECIMAL
Specify one of the following values:
- IGNORE
- No control is done.
- WARNING
- A warning message is issued for any column affected by a data loss.
- REJECT
- An error message is issued for any column affected by a data loss.
The default value is the value of the VUU072/LOSSNUM PARMLIB parameter.
- ZONED_DEC_SIGN
- Specifies the value of the sign bytes used for zoned-decimal numeric values. The first character represents the positive sign, the second one the negative sign.
- UNICODE_EXPANSION_RATIO
- Specifies what expansion ratio (i.e. target data length divided by source data length) to apply to char/varchar data when a conversion from a non-UTF8 CCSID to a UTF8 CCSID is done.
- CONVERSION_TRUNCATION_ALLOWED
- Specifies what policy to apply when data truncation is needed because of a CCSID conversion.
- YES
- Truncation of the output field after a CCSID conversion is allowed.
- NO
- Truncation of the output field after a CCSID conversion is forbidden. Records requiring truncation are discarded and the return code is set to 4.
- HANDLE_RECORD_ID
- Allows to get more detailed information when formatting errors occur so that identifying accurately the record involved in the error is possible.
- INTO_RULES
- This option allows to change the behavior of the INTO clause that applies when the field-name is explicitly specified but its output-data-type is not specified.
- COLTYPE
- The output-data-type is taken from the column type of the resulting table and the column-format-options specified through the INTO clause apply. Any REFORMAT clause is ignored.
- REFORMAT
- If a REFORMAT clause is applicable to the column type of the resulting table, the output-data-type specified through the REFORMAT clause applies as well as the associated column-format-options except for the items that are also specified in the INTO clause that take precedence. If no REFORMAT clause is applicable to the resulting column, the output-data-type is that of the column and the related column-format-options applies.
