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: 1232
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 Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
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


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