Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Diff.. Btn Copy and Include?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Diff.. Btn Copy and Include?
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    Post subject:
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    Post subject: copy and include differences
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    Post subject: copy and include differences
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: 151
Location: Tokyo, Japan

PostPosted: Thu Feb 19, 2004 2:16 pm    Post subject:
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    Post subject: Some more++++++++
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    Post subject:
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    Post subject:
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    Post subject: a small cobol queryl
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us