Page 1 of 1

Can COPY be used in Procedure Division.

Posted: Wed Aug 14, 2013 11:21 am
by Router
Hi,

In a recent interview I'm asked if the COPY statement can be used in Procedure Division Yes/No?

I think we can sue it but what if the member has only a copy-book details? I've heard there are shops which might use COPY to have some "sub-modules" in the main program and there we can make use of COPY? Is that correct?

Please help.

Re: Can COPY be used in Procedure Division.

Posted: Wed Aug 14, 2013 3:27 pm
by Robert Sample
Yes, COPY is valid in PROCEDURE DIVISION. It is not used that often, but one example I've seen of it is where a group wanted to ensure everyone used a data base the same way, the various data base access commands (this was pre-SQL) were placed into COPY books and copied into the program when needed.

Re: Can COPY be used in Procedure Division.

Posted: Sun Oct 13, 2013 5:04 pm
by Router
Thanks Robert. But in doing so, I think , we can't use "REPLACING" phrase I believe. I'll try to experiment it once I get to Mainframes....

Thanks,

Re: Can COPY be used in Procedure Division.

Posted: Sun Oct 13, 2013 6:44 pm
by Robert Sample
I am not aware of any restrictions on REPLACING in the PROCEDURE DIVISION COPY statement.

Re: Can COPY be used in Procedure Division.

Posted: Sat Oct 19, 2013 4:18 pm
by Router
This works in PROCEDURE DIVISION as well. Thanks for your insight Robert.

Regards,