1. XML GENERATE
The XML GENERATE statement converts data to XML format.
The following items are specified in the statement.
-
identifier-1
-
Receives a generated XML document.
-
References one of the following.
-
An alphanumeric elementary data item
-
An alphanumeric group item
If identifier-1 references an alphanumeric group item, it is treated as an alphanumeric elementary data item.
identifier-1 must not be described with the JUSTIFIED clause and cannot be a function identifier. It can be subscripted or reference modified. It must not overlap identifier-2 and identifier-3.
identifier-1 must be large enough to contain the generated XML document. Typically, it must be from 5 to 10 times the size of identifier-2, depending on the length of the data-name or data-names within identifier-2. If identifier-1 is not large enough, an error condition exists at the end of the XML GENERATE statement.
-
-
-
identifier-2
-
Group or elementary data item to be converted to XML format.
-
Cannot be a function identifier or be referenced modified, but can be subscripted. It must not overlap identifier-1 and identifier-3. It must not specify the RENAMES clause.
The following data items specified in identifier-2 are ignored by the XML GENERATE statement.
-
Subordinate unnamed elementary data item or elementary FILLER data items
-
Slack bytes inserted for SYNCHRONIZED items
-
Data items subordinate to a data item that is described with the REDEFINES clause or that is subordinate to such a redefining item
-
Data items subordinate to a data item that is described with the RENAMES clause
-
Group data items whose subordinate data items are ignored
-
-
Data items specified in identifier-2 that are not ignored according to the previous rules must satisfy the following.
-
Each elementary data item must be alphabetic, alphanumeric, numeric, or index data item.
-
There must be at least one such elementary data item.
-
Each data name that is not FILLER must be unique within any immediately superordinate group data item.
-
Data items must not specify the DATA FORMAT clause.
-
-
-
identifier-3
-
Contains the number of generated XML character encoding units after the XML GENERATE statement execution, if the COUNT IN phrase is specified. (Unit: bytes)
-
Integer data item defined without the symbol P in the picture string. It must not overlap identifier-1 and identifier-2.
-
-
ON EXCEPTION phrase
-
There are exception conditions when an error occurs during an XML document generation. For example, if identifier-1 is not large enough to contain a generated XML document, the generation stops and identifier-1 is undefined. If the COUNT IN phrase is specified, identifier-3 is defined as the number of generated character positions, which can be from 0 to the length of identifier-1.
-
If the ON EXCEPTION phrase is specified, control is sent to imperative-statement-1. Otherwise, the NOT ON EXCEPTION phrase, if any, is ignored and control is sent to the end of the XML GENERATE statement.
-
-
NOT ON EXCEPTION phrase
-
When this phrase is specified, if an exception condition does not occur during an XML document generation, control is sent to imperative-statement-2. If an exception condition occurs, control is sent to the end of the XML GENERATE statement. If the ON EXCEPTION phrase is specified, this phrase is ignored.
-
-
END-XML phrase
-
Indicates the end of the XML GENERATE or XML PARSE statement.
-