Previous Topic Next topic Print topic


Program structure for example 4

The following tables show COBOL statements that relate to performing XML Extensions statements. Some COBOL statements (mostly the DISPLAY statements) have been omitted. The source of this example is in the file, example04.cbl.

Initialization

COBOL Statement

Description

XML INITIALIZE.

Execute the XML INITIALIZE statement (no parameters).

If Not XML-OK Go To Z.

If the statement terminates unsuccessfully, go to the termination logic.

Exporting an XML document

COBOL Statement

Description

XML DISABLE ATTRIBUTES If Not XML-OK Go To Z.
XML DISABLE ALL-OCCURRENCES If Not XML-OK Go To Z.

Selectively ENABLE or DISABLE ATTRIBUTES and ALL-OCCURRENCES. All four combinations of ENABLE and DISABLE are used for tables 1 - 4.

Initialize Data-Table. Move "B" to X (2). 
Move 2 to N (2).
Move "D" to X (4).
Move 4 to N (4).

Initialize the Data-Table structure to the preferred values.

XML EXPORT FILE Data-Table "table1" "Data-Table".

Execute the XML EXPORT FILE statement specifying: the data item address, the XML document filename (table1 - table4), and the ModelFileName#DataFileName parameter value.

If Not XML-OK Go To Z.

If the statement terminates unsuccessfully, go to the termination logic.

Importing an XML document

COBOL Statement

Description

Initialize Data-Table.

Ensure that the data item contains no data.

XML IMPORT FILE Data-Table "table1" "Data-Table".

Execute the XML IMPORT FILE statement specifying: the data item address, the XML document filename (table1 - table6), and the ModelFileName#DataFileName parameter value.

If Not XML-OK Go To Z.

If the statement terminates unsuccessfully, go to the termination logic.

Program exit logic

Same as example 1.

Termination test logic

Same as example 1.

Status display logic

Same as example 1.

Previous Topic Next topic Print topic