In order to compile a SAM in DB/Assist, you must link ESL variables to columns in each SQL statement in the SAM This section provides the steps you should follow in DB/Assist to facilitate this process.
We recommend that you build a variable file that links ESL variables to each table column used in your application database. Creating this variable file has the following benefits:
•Organizes the variables by databases.
•Facilitates variable creation in DB/Assist by using the Auto Create push button in the Link Variables dialog box.
•In a multiple-developer environment, allows each developer to use the Auto Create push button to link variables. This will automatically reference the variables declared in the variable file.
You should create a variable file only once per ESL application, unless you add or delete a column from the application database. In multiple-developer environments, you can share the variable file among many developers. In addition, for applications that include more than one SAM, the variable declarations contained in the file can be referenced by all of these SAMs.
To build a variable file for your application database, follow these general steps. This procedure assumes the following:
•You are using the Sample database provided with DB2.
•Your application project uses the file structure described in Creating a File Structure.
1.Start DB/Assist.
2.Create a SAM named for the database. For example, name the SAM for the SAMPLE database SAMPLE.SAM
3.Create one multi-row SELECT, statement for each table used in your application database. This SELECT, statement should retrieve all columns from that table.
4.For each SELECT, statement, use the Auto Create push button in the Link Variables dialog box to link ESL variables to each column.
5.Add the generated variables to a file you create named SAMPLE.VAR.