IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

include and copy


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
mainframesiva

New User


Joined: 01 Jan 2020
Posts: 3
Location: India

PostPosted: Fri Mar 05, 2021 7:05 pm
Reply with quote

Is there any difference between using include and copy while declaring the copybooks?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2137
Location: USA

PostPosted: Fri Mar 05, 2021 7:17 pm
Reply with quote

Try to google the keywords:
“Difference cobol copy include”
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Mar 05, 2021 7:55 pm
Reply with quote

Welcome!
<Copied from Internet>
A.COPY

Any Source code statements that you want to use in multiple places can be kept in COPYBOOK. This can be included in main source program by issuing below statement.

Code:
COPY COPYBOOK.


A COPY statement can appear in the source text anywhere a character string or a separator can appear.

B.INCLUDE

The INCLUDE statement inserts declarations or statements into a source program.

Code:
EXEC SQL
INCLUDE MEMBER
END-EXEC


The member can contain any host language statements and any SQL statements other than an INCLUDE statement. In COBOL, INCLUDE member-name must not be specified in other than the DATA DIVISION or PROCEDURE DIVISION

1.So INCLUDE can also have just COBOL statements like COPY (Copybook) and can be used in place of COPY in a COBOL program.
2.Details in INCLUDE member is replaced at Precompile time while statements in COPY member are replaced in Compilation time.
3.REPLACING option can be used for COPY and not for INCLUDE
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2137
Location: USA

PostPosted: Fri Mar 05, 2021 8:22 pm
Reply with quote

Does it make any sense to copy the whole parts of manuals, references, and user guides from widely available sources to this forum, just to satisfy those chairwarmers who are not able even to enter a Google search request, or are not able to read any book , or a computer game instruction?
Modified.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Mar 06, 2021 12:47 am
Reply with quote

sergeyken, Please refrain from commenting on Religion or God in any kind.
It totally make sense to me to not to disappoint or insult any new joiner when it is easy for us to post what is needed even if its manual link , Google Search or simple stuff. Once TS familiarize how this forum works, We wouldn't see such posts as often as before.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts ISRDSLST(3.4) Do not include addition... TSO/ISPF 0
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts Use Copy Utility DB2 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top