This section describes a recommended file structure for developing applications with DB/Assist.
The file structure described here is an example only. However, regardless of the file structure you choose, make sure that the ESL code you generate is stored in a consistent manner.
Required Include Files Supplied by DB/Assist
In order to compile an ESL Application that uses the Action Routines generated from one or more SAMs, the following include files, which contain subroutine declarations and variables, must be included in your Applications source code:
•ESQLCA.INC (ESL SQL Communications Area)
•ESQLDA.INC (ESL SQL Descriptor Area)
•EDB2.INC (ESL Database 2 Runtime and Service Commands)
Required ESL Code Supplied by You
In order to run an application built with DB/Assist, you must write the following ESL code and include it in your application:
•An action routine that connects to a database. This routine calls EDB2Connect and handles any errors that may occur. You can place this routine in the DBCOMMON.INC or START.INC include files, as described in the next section.
•An action routine that disconnects from a database. This routine calls EDB2Disconnect( ) and handles any errors that may occur. You can place this routine in the DBCOMMON.INC include file, as described in the next section.
•A stimulus declaration for EDB2. You can place this routine in the DBCOMMON.INC include file, as described in the next section.
The Sample Program for Positioned SQL shows a sample ESL program that uses positioned UPDATE and DELETE statements to cycle through data in your database.
Include Files Supplied by You
We recommend that you write ESL code for the include files listed in the following table. The filenames used in the table are examples only. Use names that meet the needs of your application.
You must create the files listed in the following table; they are not supplied with DB/Assist.
Sample Filename |
Contains |
SAMPLE.VAR |
Variable declarations for the columns you access in each database. For example, you might name the variable file for the DB2 Sample database SAMPLE.VAR. |
PRIMARY.INC |
Code for common primary window and menu bars. |
DBCOMMON.INC |
Common database access routines. This should include required action routines for connecting to and disconnecting from the database, as described in the previous section. It can also include a generic SQL error handling routine. |
FUNCTA.ACT |
DB/Assist-generated action routines for each SAM (We recommend that you organize and name SAMs by functional areas, such as FUNCTA.SAM.) |
FUNCTA.INC |
Other ESL code that you maintain for each functional area. Can reside in one or more files, such as FUNCTA.GUI or FUNCTA.LOG. |
START.INC |
Code for response to start. |
Creating the Main Source File
We recommend that you place all include files for your application in the main source file. This file should contain only include files and the screen size declaration. We recommend that include files do not nest other include files.
The following is an example of an ESL main source file named PROGRAM.EAL It includes all of the files described in the preceding sections.
screen size dialog units
include "MESSAGE.INC" # Files provided by
include "ESQLCA.INC" # ESL Syndetic Ltd..
include "ESQLDA.INC"
include "EDB2.INC"
include "SAMPLE.VAR" # All variables for
# Sample database.
include "PRIMARY.INC" # Common primary window
# and menu bars.
include "DBCOMMON.INC" # Common database access
# routines.
include "FUNCTA.ACT" # DB/Assist-generated
# action routines.
include "FUNCTA.INC" # All other EASEL code
# for function.
include "FUNCTB.ACT" # DB/Assist generated
# action routines.
include "FUNCTB.INC" # All other EASEL code
# for function.