This statement has the following parameters:
Parameter | Description |
---|---|
DataItem | The name of the COBOL data item that is to receive the imported data. |
DocumentName | The name of the file that contains the XML document to be imported. |
ModelFileName#DataFileName | This parameter may be either of the following:
|
[StyleSheetName] | Optional. The name of an external XSLT stylesheet that will be used to transform the imported XML document before it is stored in the data item. |
The XML IMPORT FILE statement imports the content of the file indicated by the DocumentName parameter. If the optional StyleSheetName parameter is present, the external XSLT stylesheet is first used to transform the document. The content of the XML document is converted to COBOL format using the file specified by the ModelFileName#DataFileName parameter, and then is stored in the data item specified by the DataItem parameter.
A status value is returned in the XML-data-group data item, which is defined in the copybook, lixmldef.cpy.
Without an External XSLT Stylesheet:
XML IMPORT FILE MY-DATA-ITEM "MY-DOCUMENT" "MY-MODEL-FILE". IF NOT XML-OK GO TO Z.
With an External XSLT Stylesheet:
XML IMPORT FILE MY-DATA-ITEM "MY-DOCUMENT.XML" "MY-MODEL-FILE" "MY-STYLE-SHEET" IF NOT XML-OK GO TO Z.
With an External XSLT Stylesheet and Parameters:
XML SET XSL-PARAMETERS "MY-COUNT", 7. IF NOT XML-OK GO TO Z. XML IMPORT FILE MY-DATA-ITEM "MY-DOCUMENT.XML" "MY-MODEL-FILE" "MY-STYLE-SHEET" IF NOT XML-OK GO TO Z.