XML EXPORT FILE

This statement has the following parameters:

Parameter Description
DataItem Identifier of the COBOL data item that contains the data to be exported. (Since this represents a sending item, it can be a literal, but since the value must conform to the structure specified by the ModelDataName parameter, this would rarely to never be meaningful in an actual XML Extensions application.)
DocumentName Nonnumeric literal or identifier of an alphanumeric data item that specifies the filename of a file that will contain the exported XML document upon successful completion of this statement. If an extension is not specified in the filename, the extension .xml is appended to the specified filename.
ModelDataName Nonnumeric literal or identifier of an alphanumeric data item that specifies the name of the model data structure. (Note, this is often the same 'name' that is specified in DataItem, but as a literal enclosed in quotation marks). If the name is not found in the symbol table of the current program, then the symbol tables in the calling programs are searched in order of the call stack from nearest to farthest caller. The name may include qualifiers using // as a separator. The specification A//B//C is equivalent to the COBOL specification C OF B OF A. The top-level qualifier (A in the preceding example) may be a program-name when the name is specific to a particular program in the call stack.
[StyleSheetName] Optional. Nonnumeric literal or identifier of an alphanumeric data item that specifies the filename of an XSLT stylesheet file to be used to transform the generated XML document before it is stored. If an extension is not specified in the filename, the extension .xsl is appended to the specified filename.

Description

The XML EXPORT FILE statement exports the content of the COBOL data item indicated by the DataItem parameter. The content of the data item is converted to an XML document using the structure of the ModelDataName parameter. The output of this conversion is to the file specified by the DocumentName parameter. If the optional StyleSheetName parameter is present, the specified XSLT stylesheet is used to transform the document after it has been generated but before it is stored in the data file.

A status value is returned in the data item XML-Status of XML-data-group, which is defined in the copy file lixmldef.cpy.

Examples

XML EXPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT"
    "MY-DATA-ITEM".
IF NOT XML-OK GO TO Z.
XML EXPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT.XML"
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET" 
IF NOT XML-OK GO TO Z.
XML SET XSL-PARAMETERS
     "MY-COUNT", 7,
     "MY-NAME”, "Henry”.
IF NOT XML-OK GO TO Z.
XML EXPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT.XML"
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET"
IF NOT XML-OK GO TO Z