Page 1 of 1

Using COPY copybooks in COBOL

PostPosted: Thu Apr 25, 2013 10:27 pm
by nikesh_rai
Hi,

I have a COBOL module which will be having two copybooks(say A and B) included using COPY verb. Now copybooks A and B both have same programming logic except 2 - 3 lines. These two copybooks are framework copybooks and designed for some specific purpose, so I can not modify the copybooks. These copybooks have same SECTIONs name even. Now my problem is I have to use both the copybooks in same COBOL module. and this will cause compilation error.

Can anyone please suggest me a better approach for this.

Re: Using COPY copybooks in COBOL

PostPosted: Thu Apr 25, 2013 10:40 pm
by Akatsukami
Have you considered COPY REPLACING?

Re: Using COPY copybooks in COBOL

PostPosted: Thu Apr 25, 2013 11:01 pm
by nikesh_rai
but COPY REPLACING I have used when copybook have layout for records. My copybooks have programing logics and I never used COPY REPLACING for copybooks having programs. If possible can you paste some examples here if you have.

Re: Using COPY copybooks in COBOL

PostPosted: Thu Apr 25, 2013 11:42 pm
by BillyBoyo
The mechanism is the same. It is just a COPYBOOK, contents irrelevant to how it is acted upon by the compiler. COPY and REPLACE are not verbs, by the way.

Re: Using COPY copybooks in COBOL

PostPosted: Fri Apr 26, 2013 7:11 am
by dick scherrer
Hello,

Suggest you consider Not using either/both of the original copybooks.

This may only be the first situation that needs the functionality of both of the originals.

Possibly one new copybook that contains all of the functionality with non-conflicting names would be a step in a better direction?

Re: Using COPY copybooks in COBOL

PostPosted: Tue Apr 30, 2013 5:24 pm
by Anuj Dhawan
COPY REPLACING is a good option, however, that would require the original COPYBOOKs to be modified to have a "-:TAG:-" to be replaced.

I have a COBOL module which will be having two copybooks(say A and B) included using COPY verb. Now copybooks A and B both have same programming logic except 2 - 3 lines.
If this is the case, one possible option can be using the COPYBOOK with less number of code in the program and copy the "rest 2-3 lines" in your program logic itslef and just don't use the second copybook at all, no?