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

Diff.. Btn Copy and Include?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vamseepotti

New User


Joined: 21 Oct 2003
Posts: 45

PostPosted: Mon Feb 16, 2004 11:42 pm
Reply with quote

What is the difference between copy and include?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Feb 17, 2004 8:07 am
Reply with quote

Hi Vam,
Quote:
What is the difference between copy and include?

Not much. The compiler uses copy; DB2 uses include; some of the lib mgmt packages use ++include.

They all seem to do the same thing. I'm not sure if you can substitute one for the other though. Give it a try and let us know whay you find out.

Regards, Jack.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Feb 18, 2004 10:08 pm
Reply with quote

hi vamsee,

adding to jack,here is some more info.

COPY statement includes some pre defined cobol statements where u coded copy.this will be understood by the compiler.

where as,

INCLUDE brings the members of dclgen.though it is similar to copy(in action) precompiler cant recognize copy.so AFAIK copy cant be substituted by include and viceversa.

THANKS AND REGARDS
ANU
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Feb 18, 2004 10:40 pm
Reply with quote

if you need to include some statements in procedure division and needed in precompilation time hope u can use include in place of copy.

THANKS AND REGARDS
ANU
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Thu Feb 19, 2004 2:16 pm
Reply with quote

You can refer the following link.
http://www.ibmmainframes.com/expertforum/viewtopic.php?t=284&highlight=
Back to top
View user's profile Send private message
saravananc

New User


Joined: 24 Feb 2004
Posts: 1
Location: India

PostPosted: Tue Feb 24, 2004 12:05 pm
Reply with quote

Members mentioned in the include verb will get expanded during the DB2 precompiler time. But the members mentioned in the copy verb will get expanded during the COBOL compiler time. So the host variables used in the embedded SQLs, must be declared in the include library or directly in the data division.
If you use a host variable that defined in the Copy library then you will get a error saying "The host variable is not declared" as the copy library is not expanded during precompiler time.
Back to top
View user's profile Send private message
amitrath

New User


Joined: 30 Apr 2004
Posts: 28
Location: Carmel, USA.

PostPosted: Thu Aug 12, 2004 4:36 pm
Reply with quote

Hi,
This is what I can add to this existing discussion.

In a COBOL program, usually we "include" code written in COBOL. But we "copy" code written in assembly languge.

For example, some CICS macros are written in assembly language. All CICS maps are written using assembly language macros like DFHMDI etc. If we "include" these in COBOL programs, we will get error from precompiler, as COBOL precompilers will not understand assembler syntax. But by "COPY"ing these assembly code, we ensure that these are unexpanded until compilation stage.

In short, use "include" for COBOL copybooks, use "copy" for system macros etc written in assembly language.
Back to top
View user's profile Send private message
Praveen_Potti

New User


Joined: 18 Aug 2004
Posts: 1

PostPosted: Wed Aug 18, 2004 5:54 pm
Reply with quote

Hi Vakkai,

The INLCUDE is an SQL statement that is satisfied in the DB2 pre-compile step where as the COPY statement is satisfied in the COBOL compile step.

Regards,
Praveen. icon_lol.gif
Back to top
View user's profile Send private message
himansu

New User


Joined: 22 Mar 2005
Posts: 3
Location: bangalore

PostPosted: Wed Mar 23, 2005 12:01 pm
Reply with quote

hi
suppose you hv 10 records in a ksds file,bt you forgot the key value.so how can you read the last record randomly?is it possible
bye.
himansu
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Mar 23, 2005 10:43 pm
Reply with quote

Himansu
It's a better practice to start a new topic to post a question that is completely different in subject of the current thread. Your question should be posted under VSAM.
If you want to read the last record in a KSDS using COBOL , move HIGH-VALUES to the key and use READ PREVIOUS.

hth
-Som
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts DB2 Table - Image copy unload IBM Tools 2
Search our Forums:

Back to Top