Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1284
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 How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts Image copy after Online reorganization. lind sh IMS DB/DC 0 Tue Jan 30, 2018 9:58 pm
No new posts Copy Specific Groups V S Amarendra Reddy SYNCSORT 10 Thu Jan 11, 2018 1:16 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us