Difference among COPY, INCLUDE and ++INCLUDE.
- Akshya Chopra
- Registered Member
- Posts: 77
- Joined: Mon May 20, 2013 11:32 pm
Difference among COPY, INCLUDE and ++INCLUDE.
Hi all,
What is the difference between COPY and INCLUDE and ++INCLUDE. I was under the impressions that ++INCLUDE was obsolete.
Thanks,
What is the difference between COPY and INCLUDE and ++INCLUDE. I was under the impressions that ++INCLUDE was obsolete.
Thanks,
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: COPY and INCLUDE and ++INCLUDE.
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.
- Anuj Dhawan
- Founder
- Posts: 2802
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Difference among COPY, INCLUDE and ++INCLUDE.
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:
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.
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.
++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.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- Former Team Member
- Posts: 62
- Joined: Wed Aug 07, 2013 6:43 pm
Re: Difference among COPY, INCLUDE and ++INCLUDE.
CA-Roscoe and CA-Librarian also have include-ability.
Hope this helps,
d
d
- Akshya Chopra
- Registered Member
- Posts: 77
- Joined: Mon May 20, 2013 11:32 pm
Re: Difference among COPY, INCLUDE and ++INCLUDE.
Thanks Robert, Dick and Anuj - this is one of the best explanations I've ever got for this question. Great!
Regards,
Regards,
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Difference among COPY, INCLUDE and ++INCLUDE.
How about posting the other best explanations so others can benefit. Why did you ask again if you already have several best explanations?
- Akshya Chopra
- Registered Member
- Posts: 77
- Joined: Mon May 20, 2013 11:32 pm
Re: Difference among COPY, INCLUDE and ++INCLUDE.
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.
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.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute