This statement has the following parameter:
|Nonnumeric literal or identifier of an alphanumeric data item with a value that must be either local or utf-8. If the value is local, then the character encoding used by the operating system is used. If the value is utf-8, then the data is treated as UTF-8 encoded. The parameter value is case insensitive. Any hyphen and underscore characters are optional. For example, LOCAL, Local, and local are equivalent. UTF-8, Utf_8, and utf8 are also equivalent.
The XML SET ENCODING statement allows the developer to specify the character encoding of data within a COBOL data structure. The developer may use this statement to switch between the local character encoding and UTF-8. For more information on this environment variable, see COBOL and Character Encoding.
Although the XML SET ENCODING statement does not affect the character encoding of the XML document, it does affect the character encoding of the data in the COBOL program. For more information, see Data Representation. Be particularly aware that when the encoding is set to UTF-8, non-ASCII characters require more than one byte to encode and thus the size of data items that might contain such characters must be adjusted accordingly to avoid truncation on import. Further, UTF-8 data in the COBOL program generally cannot be handled correctly by normal COBOL statements other than MOVE. UTF-8 encoding is mostly useful only to guarantee preservation of non-ASCII characters on import that cannot be represented in the local character encoding, but are going to be exported later with XML Extensions.
The XML SET ENCODING statement returns an error status value if the value of the Encoding parameter is not recognized.
XML SET ENCODING "local". IF NOT XML-OK GO TO EXIT-1.The default value is local. If XML SET ENCODING is never called, the default is used.