ccsid (default best)

The ccsid option specifies the CCSID to be used for processing the document. Some CCSID conversions may be performed during the XML-INTO or DATA-INTO operation:
  • CCSID conversion may be required from the document to a temporary copy of the document, if the CCSID of the document differs from the CCSID used for parsing.
  • CCSID conversion may be required when assigning data to an RPG variable, if the CCSID used for parsing differs from the CCSID of the RPG variable.
If the CCSID of the actual document is different from the CCSID to be used for processing the document, CCSID conversion will be done on the entire document before parsing begins. If the CCSID to be used for processing the document is different from the CCSID of an RPG variable, CCSID conversion will be done on the data when it is assigned to the RPG variable.
  • best indicates that the document should be processed in the CCSID that will best preserve the data in the document. If the document is in the job CCSID or an ASCII CCSID related to the job CCSID, the document will be processed in the job CCSID. Otherwise, the document will be processed in UCS-2 and the data will be converted to the job CCSID before it is assigned to variables with a data type other than UCS-2.
    Note: ccsid=best is only supported for the XML-INTO operation.
  • job indicates that the document should be processed in the job CCSID. The data will be converted to UCS-2 when it is assigned to UCS-2 variables.
  • ucs2 indicates that the document should be processed in UCS-2. The data will be converted to the job CCSID when it is assigned to variables with a data type other than UCS-2.

When the document is in a file, the contents of the entire file may be converted to another CCSID before parsing begins.

The following table lists several files and their CCSIDs:
File File CCSID Related EBCDIC CCSID
file1.xml 37 37
file2.xml 1252 37
file3.xml 874 838
file4.xml 13488 (N/A, UCS-2)
file5.xml 1208 (N/A, UTF-8)
The following table shows the CCSID that would be used for processing these files for each value of the ccsid option, assuming the job CCSID is 37. An asterisk indicates that the file is converted to a different CCSID before processing:
Note: The value "best" is not supported for the DATA-INTO operation.
File CCSID Option Value
best job ucs2
file1.txt 37 37 13488*
file2.txt 37* 37* 13488*
file3.txt 13488* 37* 13488*
file4.txt 13488 37* 13488
file5.txt 13488* 37* 13488*

When the document is in a variable, the entire document may be converted to a different CCSID before parsing begins.

Given the following variable definitions:
       D chrData         S            100A
       D ucs2Data        S            100C
The following table shows the CCSID that would be used for processing these variables for each value of the "ccsid" option, assuming the job CCSID is 37. An asterisk indicates that the data in the variable is converted to a different CCSID before processing.
Variable CCSID Option Value
best job ucs2
chrData 37 37 13488
ucs2Data 13488 37* 13488