Can COPY be used in Procedure Division.

All sort of Mainframes Interview Questions.
Post Reply
Router
Registered Member
Posts: 22
Joined: Tue Jul 16, 2013 12:29 pm

Can COPY be used in Procedure Division.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Can COPY be used in Procedure Division.

Post 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.
Router
Registered Member
Posts: 22
Joined: Tue Jul 16, 2013 12:29 pm

Re: Can COPY be used in Procedure Division.

Post 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,
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Can COPY be used in Procedure Division.

Post by Robert Sample »

I am not aware of any restrictions on REPLACING in the PROCEDURE DIVISION COPY statement.
Router
Registered Member
Posts: 22
Joined: Tue Jul 16, 2013 12:29 pm

Re: Can COPY be used in Procedure Division.

Post by Router »

This works in PROCEDURE DIVISION as well. Thanks for your insight Robert.

Regards,
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”