Databases Reference
In-Depth Information
4.3.5 Using db2bfd to display host variable declarations
If a bind file is created during precompile time, we can use a DB2 bind file
description tool named db2bfd to look at the contents of the bind file. This may be
useful for debugging and can display information such as SQL statements or
host variables declared. Table 4-3 lists the db2bfd command options.
Table 4-3 db2bfd command options
db2bfd option
Information
-s
SQL statements
-b
Bind file header
-v
Host variables declared
-h
Help
For example, let us precompile the source file and add the option to create a bind
file by running the command:
db2 prep inventory.sqc bindfile
This will produce a bind file named inventory.bnd .
Running the command db2bfd -v inventory.bnd provides CLP output as shown
in Example 4-8.
Example 4-8 db2bfd sample output
inventory.bnd: Host Variables = 3
Type SQL Data Type Length Alias Name_Len Name UDT Name
---- -------------- ------ ------ -------- ---------------
---------------
460 C STRING 11 H00001 3 PID
496 INTEGER 4 H00002 8 quantity
460 C STRING 128 H00003 8 location
4.3.6 Using db2dclgn to generate host variable declarations
DB2 can simplify development by automatically generating host variable
declarations for a specified database table.
In Example 4-9 on page 158, the command will generate an .h output file with the
same name as the table. It will contain the host variable declarations.
 
Search WWH ::




Custom Search