Page 1 of 1
Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Sun Dec 29, 2013 11:51 pm
by Akshya Chopra
Hi all,
What is the difference between COPY and INCLUDE and ++INCLUDE. I was under the impressions that ++INCLUDE was obsolete.
Thanks,
Re: COPY and INCLUDE and ++INCLUDE.
Posted: Mon Dec 30, 2013 2:33 am
by Robert Sample
All of them copy code from another data set into the source for the compile. ++INCLUDE is used by PANVALET, INCLUDE is used by DB2 precompiles (and possibly others), and COPY is the COBOL compiler directive. They are used at different points but the end result is the same for all of them -- source code is compiled with additional statements not in the source file.
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Tue Dec 31, 2013 1:08 am
by Anuj Dhawan
COPY is a COBOL dialect and INCLUDE is of DB2; while ++INCLUDE/INC are of Panvelet.
It is a requirement of DB2 pre-compiler that all the referenced working storage areas are available during the pre-compile. Ad you use:
Code: Select all
EXEC SQL
INCLUDE COPYBOOK
END EXEC.
This way DB2 pre-compiler expands the "copybook". However, if you "include" the copybook using COBOL COPY verb like this:
COPY COPYBOOK. - the copybook does not get expanded until the COBOL Compiler gets control, and it's obvious that you'll get pre-compiler errors.
++INCLUDE, as said earlier, is a Panvelet command. It's "same" as COBOL COPY Verb, but it can expand the "text in it" right away as it retrieves the program from the Source repository. Therefore, the Copybook is available in its expanded form at pre-compile time, and is not necessary to be included vial EXEC SQL.
COBOL has used the COPY statement in 1959 and it was the language of the time, so many other languages have included a similar feature, often using "include" as a keyword. The term “copybook” is mainly used in an IBM mainframe context; however, other languages too have different names for it. To summarize:
COPY text-name. (COBOL),
include ... (Fortran),
%include ... (PL/I),
#include ... (C and C++),
<!--#include ... --> (HTML SSI),
<%@ include ... %> (JSP).
And that's where all this confusion arises...
Hope this helps.
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Tue Dec 31, 2013 2:40 am
by dick scherrer
CA-Roscoe and CA-Librarian also have include-ability.
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Tue Dec 31, 2013 11:17 am
by Akshya Chopra
Thanks Robert, Dick and Anuj - this is one of the best explanations I've ever got for this question. Great!
Regards,
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Tue Dec 31, 2013 1:51 pm
by William Collins
How about posting the other best explanations so others can benefit. Why did you ask again if you already have several best explanations?
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Posted: Tue Dec 31, 2013 4:25 pm
by Akshya Chopra
Hi William,
I should have said "read" instead of "got". However, I can get the links if you want me to but some of them are from other forums so mentionijng them here is not correct, I think.