Program structure for example 10

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, example10.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.

Testing for a well-formed document

COBOL Statement Description
XML TEST WELLFORMED-FILE
 "x-addressa1".
Execute the XML TEST WELLFORMED-FILE statement specifying the XML document filename.
If Not XML-OK Perform Display-Status.
If the statement terminates unsuccessfully, perform the Display-Status paragraph to display any error messages.
XML TEST WELLFORMED-FILE
 "x-addressa2".
Execute the XML TEST WELLFORMED-FILE statement specifying the XML document filename.
If Not XML-OK Go To Z.
If the statement terminates unsuccessfully, go to the termination logic.

Testing for a valid document

COBOL Statement Description
XML VALIDATE FILE
 "x-addressa2"
 "example10".
Execute the XML VALIDATE FILE statement specifying: the XML document filename and the ModelFileName#DataFileName parameter value.
If Not XML-OK Perform Display-Status.
If the statement terminates unsuccessfully, perform the Display-Status paragraph to display any error messages.

Testing for a well-formed document

COBOL Statement Description
XML TEST WELLFORMED-FILE
 "x-addressa3".
Execute the XML TEST WELLFORMED-FILE statement specifying the XML document filename.
If Not XML-OK Go To Z.
If the statement terminates unsuccessfully, go to the termination logic.

Testing for a valid document

COBOL Statement Description
XML VALIDATE FILE
 "x-addressa3"
 "example10".
Execute the XML VALIDATE FILE statement specifying: the XML document filename 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.