Using COPY copybooks in COBOL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Using COPY copybooks in COBOL

Postby nikesh_rai » Thu Apr 25, 2013 10:27 pm

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.
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Using COPY copybooks in COBOL

Postby Akatsukami » Thu Apr 25, 2013 10:40 pm

Have you considered COPY REPLACING?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Using COPY copybooks in COBOL

Postby nikesh_rai » Thu Apr 25, 2013 11:01 pm

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.
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Using COPY copybooks in COBOL

Postby BillyBoyo » Thu Apr 25, 2013 11:42 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Using COPY copybooks in COBOL

Postby dick scherrer » Fri Apr 26, 2013 7:11 am

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?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Using COPY copybooks in COBOL

Postby Anuj Dhawan » Tue Apr 30, 2013 5:24 pm

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?
Anuj

These users thanked the author Anuj Dhawan for the post:
nikesh_rai (Tue Jul 02, 2013 1:22 pm)
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post