In my program I am using a copybook which has copy statement inside.
The compilation is failing because of nested COPY.
Is there any compiler option i need to use for using nested copy in my program.
Joined: 06 Jun 2008 Posts: 8165 Location: East Dubuque, Illinois, USA
There is a link to the manuals at the top of the page. If you read up on the COPY statement in the COBOL Language Reference manual, section 8.1.4, you will find:
COPY statements can be nested. However, nested COPY statements cannot contain the REPLACING phrase, and a COPY statement with the REPLACING phrase cannot contain nested COPY statements.
A nested COPY statement cannot cause recursion. That is, a COPY member can be named only once in a set of nested COPY statements until the end-of-file for that COPY member is reached. For example, assume that the source text contains the statement: COPY X. and library text X contains the statement: COPY Y..
In this case, library text Y must not have a COPY X or a COPY Y statement.
So the answer to your question is that no compiler option is required to use nested COPY statements.
What is the exact error statement you are getting? Which COBOL compiler version are you using? What does the COPY statement look like in the program, and what does the nested COPY statement look like?