Skip to main content

Problem:

Release 4.0:

Compiling source code and receiving the error:

COBCH0187S Program is nested in a program defined with the "RECURSIVE" attribute  : C:\\WORK\\Cobol\\z0axd026.cob(3284,21)

What does this mean? I have not used the RECURSIVE attribute.

Resolution:

Basically you have to recode the source:

First, check the compiler directives you use to compile this program: a FLAG"COBOL370" directive was set to compile the source using a COBOL370 environment instead, and compiling was being stopped when a very last END PROGRAM statement was reached.

Second, check the program structure, here found as follows:

identification division.

program-id. progA.

identification division.

program-id. progB.

end program progB.

identification division.

program-id. progC.

end program progC.

end program progA. <-- COBCH0187S

In an 370 environment it is not allowed to nest program sources, s. end program progA. This will be checked as nested in a sense of a recursive call. If you need an END PROGRAM statement it should be noticed immediatly when leaving the related identification division.

In that case it was helpful to move this END PROGRAM progA statement as follows:

identification division.

program-id. progA.

end program progA.   <--- new position

identification division.

program-id. progB.

end program progB.

identification division.

program-id. progC.

end program progC.

Old KB# 3975