COPY Files Simplify Coding

The interface to the XML Extensions library is through COBOL CALL statements. Developing code for this interface is simplified by the use of source text replacement and data values contained in COBOL copy files described below. These copy files are located in the sample/xmlext directory of your installation.

Code developed using the suggested source text replacement will produce XML Extensions source code that appears more like standard COBOL procedural statements.

Documentation for the XML Extensions library is in terms of these suggested source text replacements, rather than the underlying COBOL CALL statements.

lixmlall.cpy Required to define the XML statements and to define some data-items that are referenced. This copy file should be copied at the beginning of the Working-Storage Section of the source program. This copy file copies the other copy files used by XML Extensions. In general, do not modify or edit the contents of this copy file or the copy files that it copies (lixmdef.cpy and lixmlrpl.cpy).
lixmlrpl.cpy Replacement strings used in the REPLACE statement contained in lixmlall.cpy.
lixmldef.cpy XML Extensions data definitions.
lixmldsp.cpy Optional COPY file used with lixmltrm.cpy to display the result status of an XML Extensions operation.
lixmltrm.cpy Optional COPY file which may be used to display the status of an XML Extensions operation, and then terminate XML Extensions.

These copy files are located in the sample/xmlext directory of your installation.

Note that the COBOL language standard allows only one COBOL REPLACE statement to be in effect at a time; a COBOL REPLACE statement overrides any lexically preceding REPLACE statement. Thus, in cases where the program contains a REPLACE statement, it may not be possible to use the lixmlall.cpy file. Instead, the existing REPLACE statement may be augmented by copying lixmlrpl.cpy into the REPLACE statement as follows:

REPLACE
  *> include user’s replacements here
  COPY "lixmlrpl.cpy”.  *> define XML statements
  . *> end of combined REPLACE statement

COPY "lixmldef.cpy".  *>  XML data definitions

When this is done, the lixmlall.cpy file need not be copied in the source program.

An alternative solution to the REPLACE statement issue is to isolate the XML Extensions statements in a new COBOL subprogram. The data structures to be imported or exported can be passed as CALL statement parameters to the linkage section of this new subprogram. XML Extensions searches the caller's symbol table for the description (ModelDataName) of the item actually being imported or exported and thus can properly import or export from the linkage section item.

The lixmltrm.cpy and lixmldsp.cpy COPY files may be used together to supply an orderly shutdown of an XML Extensions application; note this is optional and may not be useful in all situations. The appropriate way to combine these COPY files is as follows:

Z.
Copy "lixmltrm.cpy".
    Stop Run.
Copy "lixmldsp.cpy".

(Z is a paragraph-name where the shutdown logic begins.)