Loading delimited files

You can load a delimited file by using the FORMAT DELIMITED option. A delimited file contains cell values that are separated by delimiters. Delimiters are predefined characters that separate data. The column delimiter separates one column value from the next. Character string delimiters identify the beginning and end of a single cell value and are required only if the cell value contains the column delimiter.

Recommendation: If a delimited file is to be transferred to or from an operating system other than z/OS® or between DB2® for z/OS systems that use different EBCDIC or ASCII CCSIDs, use Unicode as the encoding scheme for the delimited file. Using Unicode avoids possible CCSID translation problems.

You are responsible for ensuring that the data in the file does not include the chosen delimiters. If the delimiters are part of the file's data, unexpected errors can occur.

Restrictions: The following restrictions apply to the use of delimiters:
  • You cannot specify the same character for more than one type of delimiter (COLDEL, CHARDEL, and DECPT).
  • You cannot specify a character constant for a delimiter if the utility control statement is not coded in the same encoding scheme as the input file. For example, the utility control statement is coded in Unicode, and the input data is coded in EBCDIC.
  • You should use the hexadecimal representation for non-default delimiters if the utility control statement is coded in a different encoding scheme than the input file. For example, the utility control statement is coded in Unicode, and the input file is coded in EBCDIC. In this case, if you do not use the hexadecimal representation for the non-default delimiters, the results can be unpredictable.
  • You do not need to specify the POSITION keyword when you specify the DELIMITED option. The utility ignores the POSITION keyword when you also specify DELIMITED. The utility overrides field data type specifications according to the specifications of the delimited format. (For example, length values for CHAR, VARCHAR, GRAPHIC, VARGRAPHIC, CLOB, DBCLOB, and BLOB data are the delimited lengths of each field in the input data set, and the utility expects all numeric types in external format.)
  • You cannot specify a binary 0 (zero) for any delimiter.
  • You cannot specify the default decimal point as a string character delimiter (CHARDEL) or a column string delimiter (COLDEL).
  • You cannot specify shift-in and shift-out characters for EBCDIC MBCS data.
  • You cannot specify the pipe character ( | ) for DBCS data.
  • You cannot specify the semicolon character (x'5E') as a delimiter character for COlDEL.
  • Start of changeYou must enclose all space values with CHARDEL if you want to load the character string into a target column that is defined with NOT NULL and without the default value. If a character string is not enclosed by CHARDEL, the utility skips the leading and trailing space characters. If the characters between two column delimiters are all space values, the field is set to null and cannot be loaded into a column.End of change

The following table lists the default hexadecimal values for the delimiter characters based on encoding scheme.

Table 1. Default delimiter values for different encoding schemes
Character EBCDIC SBCS EBCDIC DBCS/MBCS ASCII/Unicode SBCS ASCII/Unicode MBCS
Character string delimiter X'7F' X'7F' X'22' X'22'
Decimal point character X'4B' X'4B' X'2E' X'2E'
Column delimiter X'6B' X'6B' X'2C' X'2C'

In most EBCDIC code pages, the hexadecimal values that are specified in the previous table are a double quotation mark(") for the character string delimiter, a period(.) for the decimal point character, and a comma(,) for the column delimiter.

The following table lists the maximum allowable hexadecimal values for any delimiter character based on the encoding scheme.

Table 2. Maximum delimiter values for different encoding schemes
Encoding scheme Maximum allowable value
EBCDIC SBCS None
EBCDIC DBCS/MBCS X'3F'
Start of change(X'7F', X'4B', X'6B' are also allowed.)End of change
ASCII/Unicode SBCS None
ASCII/Unicode MBCS X'7F'

The following table identifies the acceptable data type forms for the delimited file format that the LOAD and UNLOAD utilities use.

Table 3. Acceptable data type forms for delimited files
Data type Acceptable form for loading a delimited file Form that is created by unloading a delimited file
CHAR, VARCHAR A delimited or non-delimited character string Character data that is enclosed by character delimiters. For VARCHAR, length bytes do not precede the data in the string.
GRAPHIC (any type)4 A delimited or non-delimited character stream Data that is unloaded as a delimited character string. For VARGRAPHIC, length bytes do not precede the data in the string.
INTEGER (any type)1 A stream of characters that represents a number in EXTERNAL format Numeric data in external format.
DECIMAL (any type) 2 A character string that represents a number in EXTERNAL format A string of characters that represents a number.
DECFLOAT EXTERNAL A character string that represents A SQL numeric constant.
FLOAT 3 A representation of a number in the range -7.2E+75 to 7.2E+75 in EXTERNAL format A string of characters that represents a number in floating-point notation.
BLOB, CLOB A delimited or non-delimited character string Character data that is enclosed by character delimiters. Length bytes do not precede the data in the string.
DBCLOB A delimited or non-delimited character string Character data that is enclosed by character delimiters. Length bytes do not precede the data in the string.
DATE A delimited or non-delimited character string that contains a date value in EXTERNAL format Character string representation of a date.
TIME A delimited or non-delimited character string that contains a time value in EXTERNAL format Character string representation of a time.
TIMESTAMP A delimited or non-delimited character string that contains a timestamp value in EXTERNAL format Character string representation of a timestamp.
Start of changeTIMESTAMP WITH TIME ZONEEnd of change Start of changeA delimited or non-delimited character string that contains a timestamp with time zone value in EXTERNAL formatEnd of change Start of changeCharacter string representation of a timestamp with time zone.End of change
Note:
  1. Field specifications of INTEGER or SMALLINT are treated as INTEGER EXTERNAL.
  2. Field specifications of DECIMAL, DECIMAL PACKED, or DECIMAL ZONED are treated as DECIMAL EXTERNAL.
  3. Field specifications of FLOAT, REAL, or DOUBLE are treated as FLOAT EXTERNAL.
  4. EBCID graphic data must be enclosed in shift-out and shift-in characters.