To create a new variable and link it to a selected column, follow these steps:
1.If you have not already done so, select SQL Statement Ø Variables or the Link variables button.
The Link Variables dialog box appears. The qualified column names in the statement appear in the Columns/Variables table.
2.Select the column for which you want to create a new variable, and then select the New push button.
The New Variable dialog box appears, overlaying the Link Variables dialog box so both are visible simultaneously. (For an illustration of the New Variable dialog box, see below.)
New Variable dialog box
3.Type a valid ESL variable name in the Name field.
If you need information about the rules for naming ESL variables, see the Programming Guide.
4.Check one of the following variable types:
•String (checked by default)
•Integer
•Float
5.Select the OK push button in the New Variable dialog box.
The New Variable dialog box closes, and the name you specified is linked to the selected column in the Link Variables dialog box, as shown below.
Link Variables Dialog Box with New Variable
In this example, we created a new float variable named NEWSALARY_FV and linked it to the STAFF.SALARY column. We used the Auto Create push button to automatically create variables for the other columns.
If you want to change a variable association before closing the dialog box, select the row containing the column name and variable that you want to change. Then, select the New push button again or select another variable to replace the previous one.
DB/Assist does not actually create the new variable until you create the variable file, as described in Creating a Variable File.
1.Repeat Steps 2 through 5 for each new variable you want to create.
2.Select the OK push button in the Iink Variables dialog box.
DB/Assist updates the SAM containing this statement with the variable associations.
In the SQL Editor window, DB/Assist replaces the parameter markers in the UpdateStaff statement with the variables you specified in the Link Variables dialog box, as follows. Notice that each variable is preceded by a colon ( : ) to indicate that it is an ESL host variable.
UPDATE DB2ADMIN.STAFF
SET ID = :ID_IV, NAME = :NAME_SV, DEPT = :DEPT_IV, JOB = :JOB_SV, YEARS = :YEARS_IV, SALARY = :NewSalary_FV, COMM = :COMM_FV
WHERE DB2ADMIN.STAFF.ID = :ID_IV
If necessary, you can select Options Ø Word wrap to format the text in the SQL Editor window so the entire statement is visible.