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
 

 

Why to use Include in SQLCA instead of COPY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Why to use Include in SQLCA instead of COPY
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    Post subject:
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: 1224
Location: Israel

PostPosted: Mon Apr 02, 2007 1:50 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions 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