Previous Topic Next topic Print topic


Program structure for example 3

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

Move … To Time-Stamp.

Populate the Time-Stamp field.

Move 3 to Address-Lines. Move … to Address-Line(1). 
Move … to Address-Line(2). 
Move … to Address-Line(3).

Ensure that Address Lines contain proper information.

XML EXPORT FILE Address-Struct3 
                 "address03.xml" "Address-Struct3".

Execute the XML EXPORT FILE statement specifying: the data item address, 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.

Importing an XML document

COBOL Statement

Description

Initialize Address-Struct3.

Ensure that the address structure contains no data.

XML IMPORT FILE Address-Struct3 
                  "address03.xml" "Address-Struct3".

Execute the XML IMPORT FILE statement specifying: the data item address, 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.

Previous Topic Next topic Print topic