View previous topic :: View next topic
|
Author |
Message |
vamseepotti
New User
Joined: 21 Oct 2003 Posts: 45
|
|
|
|
What is the difference between copy and include? |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
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 |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
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 |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
Back to top |
|
|
saravananc
New User
Joined: 24 Feb 2004 Posts: 1 Location: India
|
|
|
|
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 |
|
|
amitrath
New User
Joined: 30 Apr 2004 Posts: 28 Location: Carmel, USA.
|
|
|
|
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 |
|
|
Praveen_Potti
New User
Joined: 18 Aug 2004 Posts: 1
|
|
|
|
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. |
|
Back to top |
|
|
himansu
New User
Joined: 22 Mar 2005 Posts: 3 Location: bangalore
|
|
|
|
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 |
|
|
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
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 |
|
|
|