Previous Topic Next topic Print topic


Program structure for example 9

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, example09.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.
XML EXPORT FILE
 Address-Struct
 "address09a"
 "Address-Struct".
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.

Transforming to external XML format

COBOL Statement Description
XML TRANSFORM FILE
 "address09a"
 "toext"
 "address09b".
Execute the XML TRANSFORM FILE statement specifying: the input XML document filename, the XSLT stylesheet filename, and the output XML document filename.
If Not XML-OK Go To Z.
If the statement terminates unsuccessfully, go to the termination logic.

Transforming to internal XML format

COBOL Statement Description
Initialize Address-Struct.
Ensure that the address item contains no data.
XML TRANSFORM FILE
 "address09b"
 "toint"
 "address09c".
Execute the XML TRANSFORM FILE statement specifying: the input XML document filename, the XSLT stylesheet filename, and the output XML document filename.
If Not XML-OK Go To Z.
If the statement terminates unsuccessfully, go to the termination logic.

Importing an XML document

COBOL Statement Description
XML IMPORT FILE
 Address-Struct
 "address09c"
 "Address-Struct".
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.

Transforming to include COBOL attributes

COBOL Statement Description
XML TRANSFORM FILE
 "address09c"
 "example09"
 "address09d ".
Execute the XML TRANSFORM FILE statement specifying: the input XML document filename, the XSLT stylesheet filename, and the output XML document filename.
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