Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What is the use of DCLGEN for table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
anurag_25dec

New User


Joined: 01 Aug 2006
Posts: 4
Location: Banglore

PostPosted: Wed Sep 27, 2006 7:23 pm    Post subject: What is the use of DCLGEN for table
Reply with quote

Hi
Anyone can tell me that what is the use of DCLGEN for table?
If it is declared and included into application program then what is the need for delaring host varriable?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Sep 27, 2006 7:47 pm    Post subject:
Reply with quote

Hi Anurag,

DCLGEN generates a table declaration and puts it into a member of a partitioned data set that you can include in your program. When you use DCLGEN to generate a table's declaration, DB2 gets the relevant information from the DB2 catalog, which contains information about the table's definition and the definition of each column within the table. DCLGEN uses this information to produce a complete SQL DECLARE statement for the table or view and a corresponding PL/I, C structure declaration, or COBOL record description. You can use DCLGEN for table declarations only if the table you are declaring already exists.

Host variable is used
Suppose we have a table EMPLOYEE that have coloumn EMPID,EMPNAME,EMPFNAME,DOJ,EMPSALARY.Now we have DCLGEN
EMPLOYEE for this table which is included in the application pgm but
in the pgm we need to select all the emp whose fname is VIJAY which is
in some working storage variable like WS-EMPFNAME.
In the pgm we can use
EXEC SQL
SELECT *
FROM EMPLOYEE
WHERE EMP_FNAME = :WS-EMPNAME
END-EXEC.

HERE IN THE FOLLOWING QUERY WE USED WS-EMPNAME AS HOST VARIABLE.
Hope i make myself clear enough.
Back to top
View user's profile Send private message
anurag_25dec

New User


Joined: 01 Aug 2006
Posts: 4
Location: Banglore

PostPosted: Sat Sep 30, 2006 2:28 pm    Post subject: db2
Reply with quote

Thanks !
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Getting soc4 on internal table in cobol abdulrafi COBOL Programming 13 Fri May 06, 2016 3:39 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us