Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 52
Determining the Default Character Set
If the result indicates support for one or more external character sets, then it will also
indicate support for the corresponding internal character set. For example, if IBM Kanji
is supported, then Tandem Kanji is also supported. Support for an external character
set also indicates that the appropriate conversion and formatting routines are available
on your system.
Determining the Default Character Set
Use the MBCS_DEFAULTCHARSET_ procedure to find out which of the supported
internal character sets is the default set. This value is hard coded and can therefore
be changed only by reconfiguring the system using a different object module of the
multibyte character-set library.
Call the MBCS_DEFAULTCHARSET_ procedure as follows:
RESULT := MBCS_DEFAULTCHARSET_;
The result indicates the default character set as follows:
Analyzing a Multibyte Character String
Because the operating system supports mixtures of a multibyte character set and a
single-byte character set, you cannot be sure without testing whether a given byte is a
single-byte character, the beginning of a multibyte character, or part of a multibyte
character that is not the first byte. It is important to be able to recognize the first byte
of a character to make sure that string operations start on a character boundary.
To establish the identity of a character, you use the MBCS_CHAR_ procedure. To use
the MBCS_CHAR_ procedure, you must supply it with a pointer to a text string and the
identity of a multibyte character set. The procedure returns with an indication whether
the specified byte is the start of a multibyte character or a single-byte character. The
procedure also indicates whether the character belongs to the specified multibyte
character set.
When you use MBCS_CHAR_ on a text string for the first time, you should set up the
pointer to the first byte in the string. The first byte will always be either a single-byte
character or the first byte of a multibyte character. Once the character is identified, you
should advance the pointer by the length of the identified character and then test
again. This way, the pointer always points to the first byte of a character.
0 No multibyte character set configured
1 Tandem Kanji
9 Tandem Hangul
1
0
Tandem Chinese Big 5
11 Tandem Chinese PC
1
2
Tandem KC5601