Function
The START statement positions to elements or attributes in the XML document and assigns them to data items in the FD.
Format
START file-name-1 {ATTRIBUTE | ELEMENT} data-name-1 [INDEX IS {identifier-1 | integer-1}]
[INVALID KEY imperative-statement-1]
[NOT INVALID KEY imperative-statement-2
]
[END-START]
Syntax rules
file-name-1 must be the name of a file with organization XML.
data-name-1 may be qualified.
data-name-1 must be described with an IDENTIFIED clause and subordinate to the filename-1 file.
identifier-1 must be defined as an integer numeric elementary item.
If ATTRIBUTE is specified in the START statement, the ATTRIBUTE phrase must be specified in the IDENTIFIED clause in the data description entry of data-name-1.
If ELEMENT is specified in the START statement, the ELEMENT phrase must be specified or implied in the IDENTIFIED clause in the data description entry of data-name-1.
The INDEX specification is not permissible if the BY and ATTRIBUTE phrase is specified in the IDENTIFIED clause in the data description entry of data-name-1.
General rules
If the file-name-1 file is not open, the START statement is not successful. The I-O status of the file is set to 47.
If no XML document is open in the file-name-1 file, the START statement is not successful. The I-O status of the file is set to 4D.
If the data item directly superordinate to data-name-1 does not have a valid position, or if data-name-1 has level number 1 but no valid position, the START statement is not successful. The I-O status of the file is set to 25, i.e. an invalid key condition exists.
The START statement performs assignment (see section "Language elements of the DATA DIVISION" ), but transfers no data. If no node from the XML tree can be assigned in the first step of this assignment procedure, the START statement is not successful. The I-O status is set to 23, i.e. an invalid key condition exists.
If the names in the IDENTIFIED clauses which are effective in the assignment are not unique (see section "IDENTIFIED clause", general rule 9), the START statement is not successful. The I-O status of the file is set to 4C.
If individual attribute or element names from the IDENTIFIED clauses which are effective in the assignment cannot be represented in UTF-16 encoding, the START statement is not successful. The I-O status of the file is set to 4E.
When assignment takes place, only data item data-name-1 must be taken into consideration in the first step on the COBOL side, then all children in the XML tree – in the order from the oldest to the youngest child – of the node which is assigned to the data item that is directly superordinate to data-name-1. If data-name-1 has level number 1, only the node assigned to data-name-1 need be considered in the XML tree.
If INDEX is specified, integer-1 or the content of identifier-1 shows which node from the set of all nodes from the XML tree that can in principle be assigned in the first assignment step is actually to be assigned to data-name-1 by the statement. If the value specified is less than 1 or greater than 231 - 1, the behavior is undefined.
Whether execution of the START statement continues depends on whether INVALID KEY or NOT INVALID KEY is specified (see section "Invalid key condition" ).