View previous topic :: View next topic
|
Author |
Message |
Mr.Niceguy
New User
Joined: 16 Jun 2005 Posts: 63
|
|
|
|
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 |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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
(assuming that MYFIELD1 is in MYCOPY1). |
|
Back to top |
|
|
|