Getting Started


Chapter 11. Defining an SQL record

VisualAge Generator supports various file access methods and databases, including IBM's implementation of relational databases. In this section of the tutorial, you define the SQL record for the CUSTOMER sample table.

You define all records in the Record Editor, which you have easy access to from the Program Editor.

To begin defining the SQL record:

  1. In the Program Editor, click on the + beside GET-LIST.

    This section of the structure diagram is expanded.

  2. Double-click on the record CUSTOMER.

    The New Part Package/Application window is displayed.

  3. Ensure that tutorial is selected and select OK.

    The Record Editor is displayed.

  4. From the record type drop-down list box, select SQL Row.
    Note:You'll find the record type drop-down list box between the tool bar buttons and the Default Usage drop-down list box. The default record type is Working Storage.
  5. If there is an item in the record, delete it. To delete an item, select it. Then, select Edit>Delete.
  6. Select Define>Properties.

    The SQL Row Properties window is displayed.

  7. On the SQL Row Properties window, select Insert.
  8. A row is added and the cursor appears in the Name pane.

Figure 52. SQL Row Properties

Figure winsqlpr not displayed.

When you define an SQL row record, you specify the SQL table or table joins for the record. In this tutorial, VisualAge Generator Developer uses the CUSTOMER table from the SAMPLE database you specified in VAGen Options/Preferences.

Once the SQL table or table join has been specified, VisualAge Generator Developer can automatically build data item names and characteristics by retrieving the column information for the table or join. This function is only available if you are on a system that has access to the database catalog.

To finish defining an SQL table:

  1. In the Name pane, type customer.
  2. Select OK.

    The SQL Row Properties window closes.

  3. From the Tools menu, select Retrieve SQL. If you are prompted to run the SQLBIND command, select Yes.

    Data items based on the SQL table column characteristics are created and inserted into the SQL row record.

    Note:If Retrieve SQL is not available, delete any data items that appear in the record.
  4. Select the Key field of the CUSNUM data item. Select the Key checkbox.
  5. Press Tab.
    Tip:Before you can save a record, you must press the tab key to move the cursor out of the changed field.
  6. From the File menu, select Save.
  7. Close the Record Editor.
Note:If you have problems with the previous task, refer to the section on installing sample applications in the VisualAge Generator Installation Guide.

Figure 53. Record Editor

Figure edtrrecd not displayed.

In the SQL row record, VisualAge Generator Developer creates data items that have the characteristics of the columns in the table.

Because you can retrieve SQL column information directly from any supported relational database, you do not have to supply data item characteristics. This saves you time and minimizes errors.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]