If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How DCLGEN can be used to create Host variables in COBOL-DB2 program

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-07, 10:33
Niraj Minz Niraj Minz is offline
Registered User
 
Join Date: Sep 2007
Posts: 3
How DCLGEN can be used to create Host variables in COBOL-DB2 program

Hi all,

A very good morning to the members. I am very new to DB2 and wanted to know how DCLGEN is used in COBOL-DB2 program.
If anyone can explain with a reference program, kindly help.

Thanks,
Niraj
Reply With Quote
  #2 (permalink)  
Old 09-03-07, 11:52
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The DCLGEN will produce the working storage variables for a table or a view that you can copy into your program. In COBOL, the host variables need to included in the Working Storage Section.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 09-04-07, 04:44
Niraj Minz Niraj Minz is offline
Registered User
 
Join Date: Sep 2007
Posts: 3
DCLGEN query

Hi Marcus,

Thanks for your reply.
Still my question is how it is done.
I mean, is DCLGEN a utility that creates host variables?

Waiting for your reply,
Nitesh
Reply With Quote
  #4 (permalink)  
Old 09-04-07, 04:50
Niraj Minz Niraj Minz is offline
Registered User
 
Join Date: Sep 2007
Posts: 3
DCLGEN query

Hi Marcus,

Thanks for your reply.
Still my question is how it is done.
I mean, is DCLGEN a utility that creates host variables?

Waiting for your reply,
Nitesh
Reply With Quote
  #5 (permalink)  
Old 09-04-07, 09:03
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
DCLGEN is a DB2-Command that can be executed in foreground ( e.g. invoked by the TSO/DB2-Interactive Panel ) or in background.

It generates a copy-book that containes the declaration of the table
( EXEC SQL DECLARE TABLE .... ) and that includes also the definitions of
the host variables.
Those definitiones can be generated for the COBOL, PL/I or C -language.
Reply With Quote
  #6 (permalink)  
Old 09-04-07, 19:53
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Logon on to TSO and go to the DB2 panel, and select DB2I.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #7 (permalink)  
Old 09-04-07, 19:56
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by umayer
It generates a copy-book that containes the declaration of the table
( EXEC SQL DECLARE TABLE .... ) and that includes also the definitions of
the host variables.
Those definitiones can be generated for the COBOL, PL/I or C -language.
The Decalre Table is actually optional, and is only used by the DB2 precompiler to validate SQL statements that would otherwise not be validated until the bind step. But there is no reason to not use it.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On