Fast/Unload with DBCS data

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Fast/Unload understands the format of three varieties of DBCS shift sequences as defined by the hardware vendors IBM, Fujitsu, and Hitachi. You must tell Fast/Unload about your DBCS environment with the DBCS parameter, or by customizing Fast/Unload. See Fast/Unload customization of defaults for information about customizing Fast/Unload.

Fast/Unload also recognizes the two general types of DBCS data defined by Model 204: Pure DBCS and Mixed DBCS. Fast/Unload always converts DBCS data to the mixed format before output (except for the UAI format). Mixed DBCS means simply EBCDIC and DBCS data are permitted in the field, but all DBCS character strings within the string are enclosed in the appropriate Shift-Out and Shift-In sequences.

When you code your FUEL program to PUT pure DBCS string data, the output length specification must allow for the Shift-Out Shift-In sequences. These are each one byte long for IBM and Fujitsu systems, and two bytes long for Hitachi. Thus, to correctly output a two byte pure DBCS field in an IBM environment, your PUT statement must have a length specification of at least 4 (one byte for the Shift-Out, two bytes for the DBCS character, and one byte for a Shift-In).

Fast/Unload respects DBCS character context when DBCS string truncation occurs. If a DBCS string is truncated, whole DBCS characters are truncated, preserving the Shift-In sequence.

Fast/Unload respects DBCS character context when a start position is specified on a PUT statement (parameter number 4 on the STRING format). That is, the start character counts each DBCS character as a single character whether it is 1 or 2 bytes long. Each Shift-In and Shift-Out sequence also counts as a single character. If the first character to be output is in the middle of a Shift-Out bracket, a Shift-Out is added to the start of the string before output.

When Fast/Unload builds the sort key for a UAI SORT, DBCS fields are treated as byte strings (that is, dshifts are not added to pure DBCS fields, and DBCS characters and shift sequences are not necessarily preserved).

Assignment from a field or %variable preserves the DBCS type of the value.

If a string constant that contains a Shift Out sequence is assigned to a %variable or field (with CHANGE or ADD), or passed as a #function argument, the value has type Mixed DBCS, otherwise it is not DBCS.

The #CONCAT function calculates the appropriate DBCS type and appropriately combines shifts.

For all other #functions, all strings (input and output) are treated as non-DBCS strings.

For example:

%LEN = #LEN(PURE_DBCS) /* Returns number of bytes %STR = #SUBSTR(PURE_DBCS, 1, %LEN) /* %STR is non-DBCS %ST1 = PURE_DBCS /* %ST1 has same DBCS type %ST2 = #CONCAT(PURE_DBCS, PURE_DBCS) /* %ST2 has same DBCS type

See also