Previous Topic Next topic Print topic


REPLACE statement considerations

The copybook, lixmlall.cpy, contains a REPLACE statement to define the XML statements. A COBOL REPLACE statement overrides any lexically preceding REPLACE statement. Thus, in cases where the user's program contains a REPLACE statement, it may not be possible to use the lixmlall.cpy file. For this reason, the lixmlrpl.cpy copybook, which is copied by the lixmlall.cpy file, is provided as part of XML Extensions. The lixmlrpl.cpy file contains the operands of the REPLACE statement needed to define the XML statements, but not the REPLACE statement itself. Accordingly, the user's 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 lixmall.cpy file need not be copied in the source program.

Note: If there are multiple REPLACE statements in your source program, each REPLACE statement that precedes any XML statements needs to copy the lixmlrpl.cpy file into the REPLACE statement to preserve the statements for replacement.
The InstantSQL product has a copybook, lisqlall.cpy, which contains a REPLACE statement to define the SQL statements. In cases where InstantSQL is used with XML Extensions, neither the lixmlall.cpy nor the lisqlall.cpy copybook should be used. Instead, create a copybook (for example, named isqlxml.cpy) with the following contents:
REPLACE
 *> optionally include user's replacements
 COPY "lisqlrpl.cpy". *> define SQL statements
 COPY "lixmlrpl.cpy". *> define XML statements
 . *> end of combined REPLACE statement
COPY "lisqldef.cpy". *> SQL data definitions
COPY "lixmldef.cpy". *> XML data definitions

Use this copybook in place of lixmlall.cpy and lisqlall.cpy.

Previous Topic Next topic Print topic