difference
Moderators: dbzTHEdinosauer, Moderator Group
-
- Member
- Posts: 2
- Joined: Wed Jun 03, 2009 6:17 am
difference
can any one help me to know what is the diff between copy and include statement in cobol?
Thanks,
M.Karthik
M.Karthik
Karthik,
COPY statement allows pieces of prewritten code to be included in your program just by specifying the member-name without having to rewrite the entire code again.
I am not sure which 'INCLUDE' you're referring to. If you've CA-PANVALET, a "++INCLUDE member-name" does the same function as that of a "COPY".
An EXEC SQL INCLUDE member END-EXEC helps including DB2 copybooks such as DCLGENs,SQLCA etc in a COBOL-DB2 program.
COPY statement allows pieces of prewritten code to be included in your program just by specifying the member-name without having to rewrite the entire code again.
I am not sure which 'INCLUDE' you're referring to. If you've CA-PANVALET, a "++INCLUDE member-name" does the same function as that of a "COPY".
An EXEC SQL INCLUDE member END-EXEC helps including DB2 copybooks such as DCLGENs,SQLCA etc in a COBOL-DB2 program.
Arun
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Here is a bit extension of what Arun has said: COPY statement
DB2 Pre Compiler requires that all referenced working storage areas be available during the Pre Compile. If you include the copybook asthe DB2 Pre Compiler will expand the copybook. If you were to include the copybook via. COBOL COPY
the copybook does not get expanded until the COBOL Compiler gets control, and you get Pre Compiler Errors, AFAIK.
DB2 Pre Compiler requires that all referenced working storage areas be available during the Pre Compile. If you include the copybook as
Code: Select all
EXEC SQL
INCLUDE COPYBOOK
END EXEC.
Code: Select all
COPY COPYBOOK.
Regards,
Anuj
Anuj
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Anuj,Anuj D. wrote:If you include the copybook asthe DB2 Pre Compiler will expand the copybook. If you were to include the copybook via. COBOL COPYCode: Select all
EXEC SQL INCLUDE COPYBOOK END EXEC.
the copybook does not get expanded until the COBOL Compiler gets control, and you get Pre Compiler Errors, AFAIK.Code: Select all
COPY COPYBOOK.
AFAIK, COPY membernames get copied at Compile-time whereas DB2 INCLUDEs get included at Pre-compile time and the difference is just the timing.
It is a common practice to INCLUDE DCLGENs in order to capture errors such as mispelled table names in the early Precompile step itself rather than finding it later in the BIND step.
Arun
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page