The ASCII source (SRC = "ASCII") enables delimited ASCII format files to be read and written (DB2's standard exchange format). These files allow data to be exchanged between multiple sources (equivalent to Microsoft Excel©'s CSV format).
Important: Date formatting can cause problems with some software packages.
The following source-related parameters are recognized:
Input parameters (DATA_SRC)
Parameter name |
Type |
Mandatory |
Description |
FILE |
string |
Yes |
Name of the ASCII file to be read. |
FILEDIR |
string |
No |
Directory containing the file. If no directory is specified, the current directory will be used. |
COLSEP |
string |
No |
Character used to separate fields in the file. |
STRDEL |
string |
No |
Character used to separate strings in the file. |
NUMPT |
string |
No |
Character used to represent the decimal point in the file. |
ENCODING |
integer |
No |
Indicates the source file encoding. Possible values: 0: ANSI encoding (default value) 1: ASCII encoding 2: UTF-8 encoding |
OEM |
- |
No |
If this parameter is present a character-based data conversion will be performed from the system's OEM code page to its ANSI code page (useful for files generated by DOS programs). Maintained for compatibility reasons, equivalent to ENCODING=1. |
CHECKNULLS |
- |
No |
If this parameter is present, a NULL value will be inserted into the file for any columns that have not been specified. If it is not present, the type's default value will be used. |
Output parameters (DATA_DEST)
Parameter name |
Type |
Mandatory |
Description |
FILE |
string |
Yes |
Name of the ASCII file to be read. |
FILEDIR |
string |
No |
Directory receiving the file. If no directory is specified, the current directory will be used. |
COLSEP |
string |
No |
Character used to separate fields in the file. |
STRDEL |
string |
No |
Character used to separate strings in the file. |
NUMPT |
string |
No |
Character used to represent the decimal point in the file. |
ISO |
integer |
No |
"0" or "1": dates are stored in the ISO format (YYYYMMDD numeric form rather than the string 'YYYY-MM-DD'). |
ENCODING |
integer |
No |
Indicates the destination file encoding. Possible values: 0: ANSI encoding (default value) 1: ASCII encoding 2: UTF-8 encoding |
OEM |
- |
No |
If this parameter is present a character-based data conversion will be performed from the system's OEM code page to its ANSI code page (useful for files generated by DOS programs). The default value is "0". Maintained for compatibility reasons, equivalent to ENCODING=1. |
FIXED |
- |
No |
If this parameter is present, the file will be produced with a fixed width, and the field separators will be ignored. Note: this file format cannot be read again by the current version of the utility. |
Specific features of the Java version:
The delimited ASCII source uses the ASCII and ANSI character sets defined in the introduction. The following extensions are defined in relation to the Windows version:
In read mode, the detection of a BOM in the file takes priority over the specified encoding. UTF-8, UTF-16LE and UTF-16BE encodings are detected automatically. No BOM is inserted in write mode.
In addition to standard values, the "ENCODING" parameter accepts a Java character set definition. This value will not be accepted in the Windows version.
ENCODING
Character sets
0
ANSI (Cp1252 or override with –DansiCharset)
1
ASCII (Cp850 or override with –DasciiCharset)
2
UTF-8
CHARSET_NAME
Charset.forName("CHARSET_NAME")
Character set conversions are non-blocking, no error is issued for a conversion error. An unsupported character will be replaced by a question mark "?".
Click below for further details about:
The DATA_SRC command.
The DATA_DEST command.