IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is the use of DCLGEN for table


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Wed Sep 27, 2006 7:47 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top