How DBCS data changes the length of names and fields
Generally, when you use double-byte characters in QMF, you enter fewer characters than when you use only single-byte characters.
- To calculate the length of names and
fields containing only double-byte characters (assuming that each
double-byte character is represented internally by two bytes):
- Count the number of single-byte characters possible.
- Subtract 2 characters, one each for the SO and SI delimiters that are automatically generated.
- Divide the remaining number of characters by 2 to get the number of double-byte characters the name or field can contain. If the number is odd, drop the remainder after doing the division.
- To determine whether a name or field can contain a particular
mix of double-byte and single-byte characters, use a similar process.
First, for each string of double-byte characters in the name or field:
- Count the number of double-byte characters in the string.
- Multiply the number of double-byte characters by 2.
- Add 2 (one each for the SO and SI delimiters).
- Add the sums from all the individual strings of double-byte characters, then count the number of single-byte characters.
- Add the number of single-byte characters to the sums
of the double-byte characters. The total cannot exceed the maximum length of the name or field that is stated for single-byte characters.