Creating an XML Model File

To create an XML model file for use with XML Extensions, compile your application with the XMLGEN Compiler directive.

By default, this creates an XML model file, named output-name.xml, that includes data descriptions from the File Section of your code. This file is created in the project's root directory.

Note: The output-name defaults to the root name of your program source file, but you can change it in the project's properties.

There are two parameters to this directive that enable you to alter the default behavior:

To change the location of the model file, specify:

XMLGEN(pathname)

where pathname is the absolute or relative path name of the .xml file, which is prefixed to the default file name. You can also use an environment variable, which will resolve to a path name during runtime:

XMLGEN($myXML/)

where myXML is an environment variable set to the absolute or relative path name of the .xml file, which is prefixed to the default file name.

To include data descriptions from the Working-storage section in the model file, specify:

XMLGEN(ws)

See Restricted data items with XML Extensions for a workaround to include data descriptions from other Data Division sections of your source code.

When using both parameters in your program, ensure you set XMLGEN(pathname) before you set XMLGEN(ws); otherwise, XMLGEN(pathname) suppresses the XMLGEN(ws) option, which results in only File Section data descriptions in the XML file.