Joined: 14 Oct 2005 Posts: 1187 Location: Bangalore,India
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
WHERE EMP_FNAME = :WS-EMPNAME
HERE IN THE FOLLOWING QUERY WE USED WS-EMPNAME AS HOST VARIABLE.
Hope i make myself clear enough.