Hi,
Why to we use DB2 DCLGEN instead of COPY? Can not that make just same impact?
Why to use DB2 DCLGEN instead of COPY?
-
- New Member
- Posts: 6
- Joined: Mon Aug 18, 2014 2:23 pm
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Why to use DB2 DCLGEN instead of COPY?
SQL statements are run through a preprocessor before the COBOL compile is done. The COPY statement is a COBOL verb and hence will not be invoked until the compile, which is after the preprocessor has completed. So using a COPY instead of DCLGEN means nothing will be available to SQL since the preprocessor will not have anything to work with.
-
- New Member
- Posts: 6
- Joined: Mon Aug 18, 2014 2:23 pm
Re: Why to use DB2 DCLGEN instead of COPY?
Thanks Robert. But if use COPY COPYBOOK with DCLGEN variables, when they will be used by program, program will get them and it will work, right?
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Why to use DB2 DCLGEN instead of COPY?
The IBM manual at https://www.ibm.com/support/knowledgece ... clgen.html says
So the DCLGEN does the SQL DECLARE TABLE for which the fields can then be referenced in a copy book.The declarations generator (DCLGEN) produces an SQL DECLARE TABLE statement and a COBOL, PL/I, or C data declaration for a table or a view named in the catalog.
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