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

Why to use Include in SQLCA instead of COPY


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mr.Niceguy

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Mon Apr 02, 2007 9:35 am
Reply with quote

Hi all,

Why we are using "INCLUDE" statement instead of "COPY" while including SQLCA or DCLGENS in the code? Can't we use COPY instead of that? Please answer me if anyone knows.

Thanks in Advance!!
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Mon Apr 02, 2007 10:45 am
Reply with quote

As per my knowledge,

INCLUDE gets resolved @ precompilation where as COPY gets resolved during compilation, If am right.
You can use either one and may depend upon the program logic.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Apr 02, 2007 1:50 pm
Reply with quote

INCLUDE is not only for SQLCA or DCLGENS.
All the fields used by DB2 must be resolved at DB2 precompilation time.
For example, if you use
Code:
    SELECT ...
    FROM ...
    WHERE fld = :MYFIELD1
the DB2 precompiler must find "MYFIELD1" in WORKING-STORAGE.
If that field is in a copybook, you will receive an error.
That's why you must use
Code:
    EXEC SQL INCLUDE MYCOPY1 END-EXEC
instead of
Code:
    COPY MYCOPY1.
(assuming that MYFIELD1 is in MYCOPY1).
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 -> Mainframe Interview Questions

 


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