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.

Procedure

  • 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):
    1. Count the number of single-byte characters possible.
    2. Subtract 2 characters, one each for the SO and SI delimiters that are automatically generated.
    3. 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:
    1. Count the number of double-byte characters in the string.
    2. Multiply the number of double-byte characters by 2.
    3. Add 2 (one each for the SO and SI delimiters).
    4. Add the sums from all the individual strings of double-byte characters, then count the number of single-byte characters.
    5. 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.