Fast/Unload with DBCS data: Difference between revisions
(Automatically generated page update) |
m (more conversion cleanup) |
||
Line 1: | Line 1: | ||
<!-- Page name: Fast/Unload with DBCS data--> | <!-- Page name: Fast/Unload with DBCS data--> | ||
<var class="product">Fast/Unload</var> understands the format of three varieties of DBCS shift sequences as | <var class="product">Fast/Unload</var> understands the format of three varieties of DBCS shift sequences as | ||
defined by the hardware vendors IBM, Fujitsu, and Hitachi. | defined by the hardware vendors IBM, Fujitsu, and Hitachi. | ||
You must tell <var class="product">Fast/Unload</var> about your DBCS environment | You must tell <var class="product">Fast/Unload</var> about your DBCS environment | ||
with | with the <var>DBCS</var> parameter, or by customizing <var class="product">Fast/Unload</var>. | ||
See [[Fast/Unload customization of defaults]] for information about customizing <var class="product">Fast/Unload</var>. | See [[Fast/Unload customization of defaults]] for information about customizing <var class="product">Fast/Unload</var>. | ||
<var class="product">Fast/Unload</var> also recognizes the two general types of | <var class="product">Fast/Unload</var> also recognizes the two general types of | ||
DBCS data defined by <var class="product">Model 204</var> | DBCS data defined by <var class="product">Model 204</var>: Pure DBCS and Mixed DBCS. | ||
<var class="product">Fast/Unload</var> always converts DBCS data to the | <var class="product">Fast/Unload</var> always converts DBCS data to the | ||
mixed format before output (except for the UAI format). | mixed format before output (except for the UAI format). | ||
Line 15: | Line 14: | ||
within the string are enclosed in the appropriate Shift-Out and Shift-In | within the string are enclosed in the appropriate Shift-Out and Shift-In | ||
sequences. | sequences. | ||
When you code your FUEL program to PUT pure DBCS string data, the output | When you code your FUEL program to <var>PUT</var> pure DBCS string data, the output | ||
length | length specification must allow for the Shift-Out Shift-In sequences. | ||
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. | ||
These are each | Thus, to correctly output a two byte pure DBCS field in an IBM environment, your | ||
one | <var>PUT</var> statement must have a length specification of at least 4 (one byte for | ||
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). | the Shift-Out, two bytes for the DBCS character, and one byte for a Shift-In). | ||
<var class="product">Fast/Unload</var> respects DBCS character context when DBCS string truncation | <var class="product">Fast/Unload</var> respects DBCS character context when DBCS string truncation | ||
occurs. | occurs. | ||
If a DBCS string is truncated, whole DBCS characters are truncated, preserving | If a DBCS string is truncated, whole DBCS characters are truncated, preserving | ||
the Shift-In sequence. | the Shift-In sequence. | ||
<var class="product">Fast/Unload</var> respects DBCS character context when a start position is | <var class="product">Fast/Unload</var> respects DBCS character context when a start position is | ||
specified on a PUT statement (parameter number 4 on the STRING format). | specified on a <var>PUT</var> statement (parameter number 4 on the <var>STRING</var> format). | ||
That is, the start character counts each DBCS character as a single character | That is, the start character counts each DBCS character as a single character | ||
whether it is 1 or 2 bytes long. | whether it is 1 or 2 bytes long. | ||
Each Shift-In and Shift-Out sequence also | Each Shift-In and Shift-Out sequence also counts as a single character. | ||
counts as a single character. | |||
If the first character to be output is in the middle of a Shift-Out bracket, a | 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. | Shift-Out is added to the start of the string before output. | ||
When <var class="product">Fast/Unload</var> | When <var class="product">Fast/Unload</var> | ||
builds the sort key for a UAI SORT, DBCS fields | builds the sort key for a <var>UAI SORT</var>, DBCS fields | ||
are treated as byte strings ( | 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). | and DBCS characters and shift sequences are not necessarily preserved). | ||
Assignment from a field or %variable preserves the DBCS | Assignment from a field or %variable preserves the DBCS | ||
type of the value. | type of the value. | ||
If a string constant | 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, | to a %variable or field (with <var>CHANGE</var> or <var>ADD</var>), or passed as a #function argument, | ||
the value has type Mixed DBCS, otherwise it is not DBCS. | the value has type Mixed DBCS, otherwise it is not DBCS. | ||
< | |||
The <var>#CONCAT</var> function calculates the appropriate DBCS type and | |||
appropriately combines shifts. | appropriately combines shifts. | ||
For all other #functions, all strings (input and output) are treated | For all other #functions, all strings (input and output) are treated | ||
as non-DBCS strings. | as non-DBCS strings. | ||
For example: | For example: | ||
<p class="code"><nowiki>%LEN = #LEN(PURE_DBCS) /* Returns number of bytes | <p class="code"><nowiki>%LEN = #LEN(PURE_DBCS) /* Returns number of bytes | ||
Line 65: | Line 59: | ||
%ST2 = #CONCAT(PURE_DBCS, PURE_DBCS) /* %ST2 has same DBCS type | %ST2 = #CONCAT(PURE_DBCS, PURE_DBCS) /* %ST2 has same DBCS type | ||
</nowiki></p> | </nowiki></p> | ||
==See also== | ==See also== | ||
[[Fast/Unload overview#WIKFUN$$topics|Fast/Unload topics]] | [[Fast/Unload overview#WIKFUN$$topics|Fast/Unload topics]] |
Revision as of 20:45, 23 February 2015
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