Problem:
Compiling PROGRAM1.CBL with PROGRAM1.CPY as a copybook fails with "COBCH0056S COPY is recursive"
[PROGRAM1.CBL]
...
COPY PROGRAM1.
...
Resolution:
COPYEXT(CBL,CPY) is a default compiler directive that causes the compiler to pick up a copybook with CBL extension first. In a case where the copybook has the same name as the program, the compiler will pick up the program itself.
To avoid this, here are two options:
1. set COPYEXT(CPY) to pick up copybooks with CPY extension first, or
2. rename the copybooks that have the same names as programs