The OPEN statement in XML syntax opens the I/O stream which contains or will contain XML data.
Format
Syntax Rules:
- File-name-1 is the filename as declared in the SELECT statement as ORGANIZATION IS XML.
General Rules:
- Any OPEN request establishes an internal tree-based representation of an XML stream:
- The various I/O verbs with the KEY IS clause allow traversal, update, deletion or insertion of tree nodes within that internal
representation; however this does not cause any disk or other I/O operation.
- When used with the READ verb in its basic form, I/O is performed and populates the internal representation, deleting the previous
internal representation.
- The WRITE verb in its basic form performs I/O and commits the current internal representation to the I/O stream.
- OPEN INPUT opens a multi-document XML input stream that contains multiple root elements.
- OPEN OUTPUT opens a multi-document XML output stream that can write multiple root elements.
- OPEN EXTEND opens a multi-document XML output stream that can write multiple root elements. The previous contents of the file
are left intact and output begins at the previous end of file. OPEN EXTEND works on physical files only.
- OPEN I-O implicitly defines handshaking, based on the program execution flow, for streams such as pipes to another process,
consoles, or Web-based streams.
- OPEN I-O performed on a stream which does not easily support handshaking causes all input and output operations to be based
at file offset 0. In this case, multiple successive READs (not READ NEXTs) read the same record based on a file offset of
0. Multiple successive WRITEs (without the KEY IS clause) successively overwrite the entire file from a file offset of 0.