FORMAT
You can specify different output formats for Optim™ High Performance Unload in the FORMAT clause.
- FORMAT
- Use the FORMAT option to specify the format of the output to be
generated. If this option is not specified, the DEL format is used.
- Syntax
FORMAT DEL|IXF|DELIMITED|ASC|DSNTIAUL|XML|MIGRATION|JSON|ORC|PARQUET|EXTERNAL- Variable
- No variable value
- Default
DEL
- Among all these supported formats, there are ones supported as an input for the Db2® Load utility (DEL, IXF, DELIMITED, ASC). When specifying one of these formats, a MODIFIED BY option can be used too with a list of keywords corresponding to modifiers of the Db2 Load utility. When generating a Db2 Load command, the specification of any of the modifiers supported behaves on the content of this command. Some of these modifiers might also behave on the way the data is extracted in the output file.
- DEL
- The DEL format is delimited ASCII format that uses the same delimiter and column separator as Db2 Export. See the Db2 publications for further information regarding the output of the Db2 Export command. If you use the DEL format for data migration, you can use the following option:
- INTO tablename or qualifier.tablename
- When you migrate or load a specific table and specify an explicit SELECT request for this table, you can use the INTO option to supply the table name. If the target table qualifier and name are different from the source table qualifier and name, you can specify the qualifier and name with the INTO option. Optim High Performance Unload uses the table name and qualifier from the INTO clause in the corresponding LOAD command instead of the ones in the source table. Important: If you do not specify a name by using the INTO clause, the name of the source table will be used in the load file.
- MODIFIED BY modifiers
- With the MODIFIED BY option of a FORMAT DEL clause, you can
specify Db2 Load modifiers that behave on
the way an associated Db2 Load command is
generated. The MODIFIED BY must contain at least one of the modifiers shown at the
beginning of the FORMAT clause description. You can set more than one modifier by
specifying the MODIFIED BY option followed by a space-separated list of the wanted
modifiers. For example:
MODIFIED BY IDENTITYIGNORE GENERATEDMISSING ROWCHANGETIMESTAMPOVERRIDE- DELPRIORITYCHAR
- Use the DELPRIORITYCHAR modifier to change the delimiter priority that is used by the Db2 Load command to character delimiter, record delimiter, column delimiter. The default delimiter priority is record delimiter, character delimiter, column delimiter. This modifier has no impact on the unloaded data; it is reported only in the generated LOAD command.
- FASTPARSE
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the FASTPARSE modifier in its MODIFIED BY option.
- DUMPFILE “filename”
- This modifier has no impact on the data unloaded. The value specified to it must be an absolute path. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILE modifier in its MODIFIED BY option.
- DUMPFILEACCESSALL
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILEACCESSALL modifier in its MODIFIED BY option.
- IXF
- The Integration Exchange Format (IXF) is a generic relational database exchange
format. Optim High Performance Unload generates end-of-record
delimiters that are supported by the IXF standards. If you use the IXF format for data
migration, you can use the following option:
- INTO tablename or qualifier.tablename
- When you migrate or load a specific table and specify an explicit SELECT request for this table, you can use the INTO option to supply the table name. If the target table qualifier and name are different from the source table qualifier and name, you can specify the qualifier and name with the INTO option. Optim High Performance Unload uses the table name and qualifier from the INTO clause in the corresponding LOAD command instead of the ones in the source table. Important: If you do not specify a name by using the INTO clause, the name of the source table will be used in the load file.Restriction: You cannot use the IXF output format when migrating data to a target Db2 instance with several database partitions. The Db2 Load utility cannot be used to load data from an IXF file into a multi-partitioned environment. For more information, see the Db2 Load utility documentation.
- MODIFIED BY modifiers
- With the MODIFIED BY option of a FORMAT IXF clause, you can
specify Db2 Load modifiers that behave on
the way an associated Db2 Load command is
generated. The MODIFIED BY must contain at least one of the modifiers shown at the
beginning of the FORMAT clause description, or one of the modifiers shown in the
following list. You can set more than one modifier by specifying the MODIFIED BY
option followed by a space-separated list of the wanted modifiers. For example:
MODIFIED BY IDENTITYIGNORE GENERATEDMISSING ROWCHANGETIMESTAMPOVERRIDE- FORCEIN
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the FORCEIN modifier in its MODIFIED BY option.
- NOCHECKLENGTHS
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the NOCHECKLENGTHS modifier in its MODIFIED BY option.
- DELIMITED
- The DELIMITED format operates the same way as the DEL format except with the DELIMITED
format you can specify the column separator, column value delimiter, or the null column
delimitation options. If you do not specify a value for any of the delimited format
options, the DELIMITED format operates the same way as the DEL format. When you specify
DELIMITED format options, the separator must be different from the delimiter and must
not exceed 1 byte in length. The selected separator and delimiter characters must be
placed in single quotation marks. You can specify one or more of the three options
together by using a space between each option. To specify values for
delimited_block, use the following syntax:
Or:DELIMITED INTO tablename|qualifier.tablename MODIFIED BY modifiers NULL DELIM NULLVAL "value"DELIMITED INTO tablename|qualifier.tablename SEP|COLDEL 'char' DELIM|CHARDEL 'char' NULL DELIM NULLVAL "value"where:- INTO tablename or qualifier.tablename
- When you use the LOADFILE option, you can use the INTO statement to supply the
target table name and qualifier, which is useful when the target table name and
qualifier are different from the source table name and qualifier. Optim High Performance Unload will use the table name and
qualifier from the INTO clause in the corresponding LOAD command instead of the
table name and qualifier in the source table. Important: If you do not specify a name by using the INTO clause, the name of the source table will be used in the load file.
- MODIFIED BY delimited_modifiers
- With the MODIFIED BY option of a FORMAT DELIMITED clause, you
can specify Db2 Load modifiers that behave
on the way an associated Db2 Load command
is generated. You can also specify modifiers from the ones listed below that
describe the way that data is unloaded. The MODIFIED BY must contain at least
one of the modifiers shown at the beginning of the FORMAT clause description, or
one of the modifiers shown in the following list. You can set more than one
modifier by specifying the MODIFIED BY option followed by a space-separated list
of modifiers. For example:
MODIFIED BY CHARDEL '%' DECPLUSBLANKTip: You can use the MODIFIED BY option without generating a load file to modify the unloaded data format (except for the DELPRIORITYCHAR modifier, which has no impact on the unloaded data).You can select from the following list of modifiers:- COLDEL 'char'|x'XX'
- Use the COLDEL modifier to specify the separator character that is used for separating columns. The default value is the comma character (,).
- CHARDEL 'char'|x'XX'
- Use the CHARDEL modifier to specify the delimiter that is used to enclose the column values. The default value is the double quotation mark character (“).
- DECPT 'char'|x'XX'
- Use the DECPT modifier to specify the decimal point character that is used for decimal data. The default value is the period character (.). This modifier is incompatible with the IMPLIEDDECIMAL modifier.
- DECPLUSBLANK
- Use the DECPLUSBLANK modifier to specify if positive decimal data is to be unloaded with a blank space as the leading sign instead of a plus sign (+). By default, the plus sign (+) is used.
- NOCHARDEL
- Use the NOCHARDEL modifier if you do not want column values to be enclosed within delimiters. When you specify the NOCHARDEL modifier, the options DOUBLE DELIM and DELPRIORITYCHAR are ignored.
- DELPRIORITYCHAR
- Use the DELPRIORITYCHAR modifier to change the delimiter priority that is used by the Db2 Load command to character delimiter, record delimiter, column delimiter. The default delimiter priority is record delimiter, character delimiter, column delimiter. This modifier has no impact on the unloaded data; it is reported only in the generated LOAD command.
- STRIPLZEROS
- Use the STRIPLZEROS modifier to unload decimal data without leading
zeros. Use this option to save disk space and improve performance when
unloading data with leading zeros.For example, if you use the following control file, Optim High Performance Unload creates an output file that contains the value
+0001000.00:
If you add the STRIPLZEROS modifier to the FORMAT clause, the value in the output file will beGLOBAL CONNECT TO SAMPLE ; UNLOAD TABLESPACE DB2 NO SELECT BONUS FROM EMPLOYEE WHERE BONUS=1000; OUTFILE("Out") FORMAT DELIMITED;+1000.00:FORMAT DELIMITED MODIFIED BY STRIPLZEROS; - KEEPBLANKS
- Use the KEEPBLANKS modifier if you want it to be taken into account when generating a Db2 Load command, in order that leading and trailing blanks of strings not enclosed within delimiters be preserved when the Db2 Load command will be executed. When the NOCHARDEL modifier is not specified, the KEEPBLANKS modifier is ignored.
- IMPLIEDDECIMAL
- Use the IMPLIEDDECIMAL modifier if you want to unload the decimal type data without a character denoting the decimal separator. If the LOADFILE clause is also specified, the Db2 Load command generated will include the IMPLIEDDECIMAL modifier in its MODIFIED BY option. This modifier is incompatible with the DECPT modifier.
- USEGRAPHICCODEPAGE
- Use the USEGRAPHICCODEPAGE modifier if you want to unload the double-byte types data in DBCS code page into the output file. If the LOADFILE clause is also specified, the Db2 Load command generated will include the USEGRAPHICCODEPAGE modifier in its MODIFIED BY option.
- FASTPARSE
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the FASTPARSE modifier in its MODIFIED BY option.
- DUMPFILE “filename”
- This modifier has no impact on the data unloaded. The value specified to it must be an absolute path. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILE modifier in its MODIFIED BY option.
- DUMPFILEACCESSALL
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILEACCESSALL modifier in its MODIFIED BY option.
- Note
- Through the COLDEL, CHARDEL, DECPT options, the characters to be used as delimiters can be specified between quotes. But, this is not suitable for non-printable characters. If one wants to use a non-printable character as a delimiter, one can do so by specifying a 'x' character followed by its hexadecimal value expressed with two hexadecimal digits between quotes.
- SEP 'char'|x'XX' or COLDEL 'char'|x'XX'
- Use the SEP and COLDEL keywords to specify a separator character (delimiter)
for separating columns. A space between the SEP or COLDEL keywords and the
variable ‘char' is optional. In DEL format, this
character is a comma ( , ). A non-printable character can be used with an
hexadecimal specification.Important: The SEP and COLDEL keywords are supported for compatibility with earlier versions only. For new FORMAT clauses, use the MODIFIED BY clause instead. For example, use
MODIFIED BY COLDEL '%'instead ofCOLDEL '%' - DELIM 'char'|x'XX' or CHARDEL 'char'|x'XX'
- Use the DELIM keyword to specify the delimiter that is used to enclose the
column values. A space between the DELIM keyword and the variable ‘char' is
optional. In DEL format, the delimiter is a double quotation mark ( " ). The
keyword CHARDEL can be used the same as the
DELIM keyword. A non-printable character can be used with
an hexadecimal specification.Important: The CHARDEL and DELIM keywords are supported for compatibility with earlier versions only. For new FORMAT clauses, use the MODIFIED BY clause instead. For example, use
MODIFIED BY CHARDEL '%'instead ofCHARDEL '%' - NULL DELIM
- Use the NULL DELIM keyword to specify that the column value delimiter should
be used in columns that contain null values. By default, null column values are
not enclosed with delimiters. The result of specifying the NULL DELIM keyword is
two consecutive column delimiters that represent the presence of a column that
contains a null value. The NULL DELIM option applies only to
columns that require surrounding delimiters, such as the DEL format where
character columns need delimiters, but integer columns do not. For example, if you accept the defaults for the column separator (SEP) and column value delimiter (DELIM), consider a table that contains three columns: INTEGER, nullable CHARACTER(5), and INTEGER. Place two rows in the columns with the following data: (1,'row1',1) and (2,null,2). When you unload this data with the DELIMITED format without the NULL DELIM option, the two rows would look like this:
When you unload this data by using the DELIMITED format and the NULL DELIM option, the two rows would look like this:1,"row1 ",1 and 2,,21,"row1 ",1 and 2,"",2 - NULLVAL
- Use the NULLVAL option to specify a value to be written in the output file when a null value is encountered.
- ASC
- The ASC format is a non-delimited, sequential ASCII file with fixed-length records,
ordered by row and column. ASC files can be used with the LOAD command, and can be used
for data exchange with any ASCII product that has a columnar format for data.
The ASC format uses the following options:
- INTO tablename or qualifier.tablename
- If you are using the LOADFILE option and you must change the
target table name or qualifier.tablename, you can specify the new name to be used
in the LOAD file as follows:
For example:FORMAT ASC INTO qualifier.tablename
The resulting generated Load File (test.load) would look like this:GLOBAL CONNECT TO SAMPLE; UNLOAD TABLESPACE FLUSH BUFFERPOOLS NO LOCK NO SELECT * FROM EMPLOYEE; CCSID(930,300) OUTFILE("test.out") LOADFILE("test.load") FORMAT ASC INTO DBHPU.EMPLOYEE;LOAD FROM test.out OF ASC MODIFIED BY STRIPTBLANKS METHOD L (1,6,7,18,19,20,34,36, 38, ...108,118) NULL INDICATORS(0,0,0,0,35,... 107) INSERT INTO TABLE DBHPU.EMPLOYEE (EMPNO,FIRSTNME,MIDINT,LASTNAME,WORKDEPT,...)Attention: If you do not specify a name using the INTO clause, the name of the source table will be used in the load file. - MODIFIED BY modifiers
- With the MODIFIED BY option of a FORMAT ASC clause, you can
specify Db2 Load modifiers that behave on
the way an associated Db2 Load command is
generated. You can also specify modifiers from the ones listed below that describe
the way that data is unloaded. The MODIFIED BY must contain at least one of the
modifiers shown at the beginning of the FORMAT clause description, or one of the
modifiers shown in the following list. You can set more than one modifier by
specifying the MODIFIED BY option followed by a space-separated list of the wanted
modifiers. For example:
MODIFIED BY PACKEDDECIMAL STRIPNULLSTip: The features of the MODIFIED BY option can be used without generating a load file to modify the unloaded data format.- BINARYNUMERICS
- You can specify numeric data (INTEGER, DECFLOAT, and real data) to be
unloaded in binary format by using the BINARYNUMERICS
modifier. The binary representation used will always be big-endian, the one
expected by Db2 Load. By default,
unload does not use binary format for numeric data.
When you specify BINARYNUMERICS and the LOADFILE option is also selected, BINARYNUMERICS will be added to the MODIFIED BY clause in the load file.
- PACKEDDECIMAL
- Use this modifier to unload decimal data types in packed representation.
This is not the default behavior.
When specifying PACKEDDECIMAL and the LOADFILE option is also selected, PACKEDDECIMAL will be added to the MODIFIED BY clause in the load file. This modifier is incompatible with the IMPLIEDDECIMAL and ZONEDDECIMAL modifiers.
- DECPLUSBLANK
- You can specify if positive decimal data is to be unloaded with a blank space as the leading sign instead of a plus sign (+) by using DECPLUSBLANK. By default, the plus sign (+) is used.
- STRIPTBLANKS or STRIPTNULLS
- You can specify if data for character columns of variable size is to be
unloaded padded with a blank character or a null character by using the
corresponding mutually exclusive modifiers: STRIPTBLANKS
and STRIPTNULLS.
By default, the padding character is the blank (STRIPBLANKS). If the LOADFILE option is also selected, the load command will include either the STRIPTBLANKS or the STRIPTNULLS modifier in the MODIFIED BY clause.
- NULLINDCHAR ‘char’|x’XX’
- Use the NULLINDCHAR modifier if you want to specify the single character to be considered for denoting a NULL value into the output file. Its default value is ‘Y’. When this modifier is specified, it overrides the potential usage of the older NULL option, which also allows to specify the characters denoting if a value is NULL or not.
- IMPLIEDDECIMAL
- Use the IMPLIEDDECIMAL modifier if you want to unload the decimal type data without a character denoting the decimal separator. If the LOADFILE clause is also specified, the Db2 Load command generated will include the IMPLIEDDECIMAL modifier in its MODIFIED BY option. This modifier is incompatible with the PACKEDDECIMAL and ZONEDDECIMAL modifiers.
- ZONEDDECIMAL
- Use the ZONEDDECIMAL modifier if you want to unload the decimal type data in zoned representation into the output file. If the LOADFILE clause is also specified, the Db2 Load command generated will include the ZONEDDECIMAL modifier in its MODIFIED BY option. This modifier is incompatible with the PACKEDDECIMAL and IMPLIEDDECIMAL modifiers.
- USEGRAPHICCODEPAGE
- Use the USEGRAPHICCODEPAGE modifier if you want to unload the double-byte types data in DBCS code page into the output file. If the LOADFILE clause is also specified, the Db2 Load command generated will include the USEGRAPHICCODEPAGE modifier in its MODIFIED BY option.
- FASTPARSE
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the FASTPARSE modifier in its MODIFIED BY option.
- NOCHECKLENGTHS
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the NOCHECKLENGTHS modifier in its MODIFIED BY option.
- DUMPFILE “filename”
- This modifier has no impact on the data unloaded. The value specified to it must be an absolute path. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILE modifier in its MODIFIED BY option.
- DUMPFILEACCESSALL
- This modifier has no impact on the data unloaded. If the LOADFILE clause is also specified, the Db2 Load command generated will include the DUMPFILEACCESSALL modifier in its MODIFIED BY option.
- DSNTIAUL
- DSNTIAUL is an output that produces a format that allows the unloaded file to be
loaded into Db2 for z/OS®. The output format is a sequential file without row or
column delimiters. This file consists of an unbroken sequence of fixed-length records.
- INTO tablename or qualifier.tablename
- If you
are using the LOADFILE option to generate a LOAD file and you want to
change the name of the target table name or qualifier.tablename, you can specify the
new name using the following option:
FORMAT DSNTIAUL INTO qualifier.tablenameAttention: If you do not specify a name using the INTO clause, the name of the source table will be used in the load file.
- XML
- The XML format is a file that consists of a sequence of records of variable length
that are ordered by rows and columns. All of the records are string formatted with XML
tags. Each record contains column names and column data.
The XML format uses the following options:
- COLATTVAL or COLATTVAL_XML
- The data in column names or column values can contain invalid XML characters.
The COLATTVAL and COLATTVAL_XML options control
the replacement of invalid XML characters in the result string.
When you use the COLATTVAL option, the program replaces invalid XML characters in both column values and column names. The COLATTVAL option is the default. You must specify the COLATTVAL_XML option if you want to replace invalid characters in column names only.
Table 1. Character replacement for XML attribute values and element values Character Replacement < < > > “ " & & ‘ ' - ROWTAGSTRING
- Use the ROWTAGSTRING option to modify the name of the row tag,
that the XML format uses to identify each row. Using this modifier, you can
specify a different string constant for the tag. By default, the value "row" is
assumed. You can use this option to customize the output to fit your specific XML
requirements.
For example:
FORMAT XML ROWTAGSTRING "line"When you unload data and this option is specified, the "row" tag is replaced with the "line" tag in the output file:
<?xml version="1.0" encoding="windows-1252" ?> <table name="TBL_XML"> <line> <column name="NUMBER">123</column> <column name="NUMBER_NN">345</column> </line> </table>
- MIGRATION
- Use the MIGRATION keyword to specify the default format for data migration. At this
time, the MIGRATION format works the same way as the DEL format. The MIGRATION keyword
uses the following option:
- INTO tablename or qualifier.tablename
- When you migrate a specific table and specify an explicit select request for
this table, the INTO option can be used to supply the table name. If the target
table qualifier and name are different from the source table ones, use this option
to specify the qualifiers. Optim High Performance Unload uses the table name and qualifier from the INTO clause in the corresponding
load command instead of the ones in the source table. Important: If you do not specify a name using the INTO clause, the name of the source table will be used in the load file.
- JSON
- The JSON format is an appropriate one to generate files which can be imported into a
NoSQL database like Cloudant, CouchDB or MongoDB.
In addition to the list of rows extracted, the output files generated in the JSON output format might also contain a header and a footer, if the task specified implies that associated header and footer be there around the rows.
The layout of a table row is the following one:- An opening brace.
- For each column, a pair compounded by the column name and its value, separated by a colon. These columns pairs are separated by commas.
- A closing brace.
The layouts for the columns and their associated values are the same ones for all destinations.
Specifying a LOADDEST clause behaves on the content of the output file generated. The contents of its header and footer depend on the NoSQL destination chosen (either Cloudant, CouchDB or MongoDB). In the case where there is no LOADDEST clause specified, which means that there is no specific destination chosen, a generic output file is generated, without any content specific to any destination. As a result, in such a case, the output file generated does not contain a header and a footer, their contents depending on the destination to be considered.
When an output file with the JSON output format is generated with an associated upload command, the LOADDEST clause is mandatory.
- Db2 and JSON data types:
-
The JSON output format is not compatible with CLOB, BLOB, DBLOB and XML data type columns. Specifying an unload in JSON output format against an SQL statement referring to a column of one of these data types would be rejected. The lack of finding an automatic user-friendly method to associate LOB or XML data to JSON documents is the main reason for this incompatibility.
Among the data types supported by the JSON output format, there is no distinction between numeric data, the data type is named number. Its values layout is the numeric value without any rounding character. As a result, the following Db2 data types are formatted into this data type:- SMALLINT
- INTEGER
- BIGINT
- DECIMAL
- REAL
- DOUBLE
For the null values, they are expressed into the JSON data type called null, which value is always the constant string 'null' without any rounding character.
- Big Data output formats
- The Big Data output formats supported are the Parquet format and the ORC format. Their use can be specified with the PARQUET and ORC keywords respectively.
- EXTERNAL
- The EXTERNAL format is the one to be used for interfacing with the Db2 external tables. When it is associated to a DDLFILE clause, it allows to generate an external table creation command. The output format of the generated data files depends on the value of the FORMAT EXTERNAL clause, which can be TEXT, FIXED or BINARY.