To define static SQL statements for the static DB2 package

  1. Click the Add button in the CONNX Data Dictionary Manager window.

  2. The Enter the Name of the New Table or View dialog box appears. Type a user-defined character string in the SQL Object Name text box.

    image\db2pkg05.jpg

  3. Select DB2 Static SQL in the Object Type list box.

  4. Select the package name in the Database list box.

  5. Click the OK button.

  6. The Static SQL Properties tab is selected in the lower pane of the CONNX Data Dictionary Manager window. Type a dynamic SQL statement in the CONNX SQL Statement text box.

    image\db2pkg06.jpg

  7. Click the Verify SQL button to view the results of the DB2 SQL statement in the lower DB2 SQL Statement pane.

    image\db2pkg07.jpg

  8. Select the Static SQL Columns tab, which displays the attributes of the result column(s) and the input parameter(s) of the static SQL statement.

    image\db2pkg08.jpg

  9. The first static SQL statement in package PKG01 is now defined. To bind another static SQL statement, return to the main CDD window and click the Add button. In keeping with the naming convention of step 2, define a user-defined SQL Object Name = PKG0102, an object type = DB2 Static SQL, and select package PKG01 from the list box.

    image\db2pkg09.jpg

  10. Enter the dynamic SQL UPDATE statement as it appears in the CONNX SQL Statement list box.

  11. Click the Verify SQL button. The DB2 SQL statement appears in the lower window.

    image\db2pkg11.jpg

  12. Return to the main CDD window and click the Add button. In keeping with the naming convention of step 2, define a user-defined SQL Object Name = PKG0103, an object type = DB2 Static SQL, and select package PKG01 from the list box.

  13. Enter the dynamic SQL DELETE statement as it appears in the CONNX SQL Statement list box.

  14. Click the Verify SQL button. The DB2 SQL statement appears in the lower window.

    image\db2pkg15.jpg

  15. Select the Static SQL Columns tab, which displays the attributes of the result column(s) and the input parameter(s) of the static SQL statement (not shown).

  16. Return to the main CDD window and click the Add button. In keeping with the naming convention of step 2, define a user-defined SQL Object Name = PKG0104, an object type = DB2 Static SQL, and select package PKG01 from the list box.

    image\db2pkg17.jpg

  17. Enter the dynamic SQL INSERT statement as it appears in the CONNX SQL Statement list box.

  18. Click the Verify SQL button. The DB2 SQL statement appears in the lower window.

    image\db2pkg19.jpg

  19. Select the Static SQL Columns tab, which displays the attributes of the result column(s) and the input parameter(s) of the static SQL statement.

  20. Return to the main window and click the PKG01 icon. Then click the Rebuild Package button.

  21. If you are not currently logged on to the target host, the CONNX DB2 Database Logon dialog box appears.

  22. CONNX logs on to the target host and issues Static SQL Binds into package PKG01 for the four statements described in the preceding steps.

    image\db2pkg23.jpg