Data Representation

COBOL numeric data items are exported to XML as numeric strings. A leading minus sign is added for negative values. Leading zeros (those appearing to the left of the decimal point) are removed. Non-significant trailing zeros (those appearing to the right of the decimal point) are likewise removed. If the value is an integer, no decimal point is present in the XML numeric string. The decimal point in XML numeric items is always represented with .; thus if the COBOL program is using DECIMAL POINT IS COMMA, this conversion is also handled by XML Extensions.
Note: Numeric edited data items are treated as nonnumeric by XML Extensions and thus are exported according to the following paragraph.

COBOL nonnumeric data items are exported to XML as text strings and have trailing spaces removed. (If the item is described with the JUSTIFIED phrase, leading spaces are also removed.) Note, however, that for edited and FILLER data items, leading and trailing spaces are preserved. In addition, any embedded XML special characters not in FILLER data items are represented by escape sequences; the ampersand (&), less than (<), greater than (>), quote ("), and apostrophe (') characters are examples of such XML special characters.

XML strings are imported to COBOL numeric items by storing the algebraic value of the string into the COBOL numeric data item per the rules for its data description. A data conversion error will occur if the XML string does not represent a valid numeric value. (Note: Numeric edited data items are treated as nonnumeric by XML Extensions and thus are imported per the following paragraph.)

XML strings are imported to COBOL nonnumeric items by removing leading and trailing spaces from the XML string and storing the result either left or right justified, depending on the data description of the receiving item. However, for edited and FILLER data items, leading and trailing spaces in the XML string are preserved and no editing is performed when storing into an edited data item. XML escaped characters in the string are converted back to the represented character before storing the string value.

On Windows platforms, nonnumeric displayable data are normally encoded using Microsoft's OEM or ANSI data format. On output, these data are converted to the standard Unicode 8-bit transformation format , UTF-8. On input, data is converted to the OEM or ANSI data format. If the XML SET ENCODING statement is used to specify UTF-8, then the internal data format is UTF-8.

On UNIX platforms, nonnumeric displayable data are normally encoded using a local character encoding that the UNIX system uses. Typically, this may be Latin-1 or Latin-9. On output, these data are converted to the standard Unicode 8-bit transformation format, UTF-8. On input, data is converted to the systems internal format. If the XML SET ENCODING statement is used to specify UTF-8, then the internal data format is UTF-8.