DD-ENTITY is included with REPLACING as follows (one of the examples):
01 LK-ENTITY.
COPY DD-ENTITY REPLACING LEADING ==ENTITY== BY ==LK-ENTITY==.
but has itself another REPLACING:
|
COPY DD-INVENTORY-SLOT REPLACING LEADING ==PREFIX== BY ==ENTITY-ITEM==. |
Old standards actually said that there is no COPY allowed at all as soon as REPLACING and GnuCOBOL does support it, but it is one of the show-stoppers to compile CobolCraft with other compilers.
For reference here the current WIP for that rule in 2026 standard:
If the REPLACING phrase is specified, the library text shall not contain a COPY statement with the REPLACING phrase [...]. It can contain a COPY statement (and nested COPY statements) without the REPLACING phrase. The REPLACING phrase applies to all library text that is included by a COPY statement and all nested COPY statements.
So... what can we do? We can move that replacement one step down by using in either the copybook or outside it (possibly with REPLACE LAST OFF) a REPLACE statement (those are handled after all copybooks are included and their content replaced according to the REPLACING clause, if any..
DD-ENTITY is included with REPLACING as follows (one of the examples):
but has itself another REPLACING:
CobolCraft/src/_copybooks/structs/DD-ENTITY.cpy
Line 32 in c6f34f9
Old standards actually said that there is no COPY allowed at all as soon as REPLACING and GnuCOBOL does support it, but it is one of the show-stoppers to compile CobolCraft with other compilers.
For reference here the current WIP for that rule in 2026 standard:
So... what can we do? We can move that replacement one step down by using in either the copybook or outside it (possibly with REPLACE LAST OFF) a
REPLACEstatement (those are handled after all copybooks are included and their content replaced according to the REPLACING clause, if any..