When the data is split up in shorter lengths, again the DBCS data integrity is kept under OPTIONS
EXMODE. In EBCDIC, if the terminal line size is less than 4, the string is treated as SBCS data, because
4 is the minimum for mixed string data.
UPPER
Under OPTIONS EXMODE, the UPPER instruction translates only SBCS characters in contents of one or
more variables to uppercase, but it never translates DBCS characters. If the content of a variable is not
valid mixed string data, no uppercasing occurs.
DBCS Function Handling
Some built-in functions can handle DBCS. The functions that deal with word delimiting and length
determining conform with the following rules under OPTIONS EXMODE:
1. Counting characters—Logical character lengths are used when counting the length of a string (that
is, 1 byte for one SBCS logical character, 2 bytes for one DBCS logical character). In EBCDIC, SO
and SI are considered to be transparent, and are not counted, for every string operation.
2. Character extraction from a string—Characters are extracted from a string on a logical character
basis. In EBCDIC, leading SO and trailing SI are not considered as part of one DBCS character. For
instance, .A and .B are extracted from <.A.B>, and SO and SI are added to each DBCS character
when they are finally preserved as completed DBCS characters. When multiple characters are
consecutively extracted from a string, SO and SI that are between characters are also extracted. For
example, .A><.B is extracted from <.A><.B>, and when the string is finally used as a completed string,
the SO prefixes it and the SI suffixes it to give <.A><.B>.
Here are some EBCDIC examples:
S1 = 'abc<>def'
SUBSTR(S1,3,1) -> 'c'
SUBSTR(S1,4,1) -> 'd'
SUBSTR(S1,3,2) -> 'c<>d'
S2 = '<><.A.B><>'
SUBSTR(S2,1,1) -> '<.A>'
SUBSTR(S2,2,1) -> '<.B>'
SUBSTR(S2,1,2) -> '<.A.B>'
SUBSTR(S2,1,3,'x') -> '<.A.B><>x'
S3 = 'abc<><.A.B>'
SUBSTR(S3,3,1) -> 'c'
SUBSTR(S3,4,1) -> '<.A>'
SUBSTR(S3,3,2) -> 'c<><.A>'
DELSTR(S3,3,1) -> 'ab<><.A.B>'
DELSTR(S3,4,1) -> 'abc<><.B>'
DELSTR(S3,3,2) -> 'ab<.B>'
3. Character concatenation—String concatenation can only be done with valid mixed strings. In
EBCDIC, adjacent SI and SO (or SO and SI) that are a result of string concatenation are removed.
Even during implicit concatenation as in the DELSTR function, unnecessary SO and SI are removed.
4. Character comparison—Valid mixed strings are used when comparing strings on a character basis. A
DBCS character is always considered greater than an SBCS one if they are compared. In all but the
strict comparisons, SBCS blanks, DBCS blanks, and leading and trailing contiguous SO and SI (or SI
and SO) in EBCDIC are removed. SBCS blanks may be added if the lengths are not identical.
In EBCDIC, contiguous SO and SI (or SI and SO) between nonblank characters are also removed for
comparison.
Note: The strict comparison operators do not cause syntax errors even if you specify mixed strings
that are not valid.
Appendix C. Double-Byte Character Set (DBCS) Support 399