You can select one table at a time or you can select all of the tables in a data source. OpenESQL Assistant prompts you to select the type of query you would like to perform on the table or tables by presenting the Select Type of Query to Create dialog box. This dialog box contains a list of query types you can perform on your selection. Depending on the type of query you select, you can also change the default cursor name, specify that your query be generated as a Stored Procedure, and specify the stored procedure (SP) name.
Selected tables appear in the tree view with a check mark next to the table icon, .
Once you have selected a query, the COBOL code for the query you have selected is automatically generated and displayed underneath the Query tab. At the same time, a list of all the columns in the table is displayed underneath the table name.
For SELECT queries, a table alias is generated automatically by the OpenESQL Assistant. For example:
SELECT FROM Customer A
The first table selected generates an alias of the letter A. If you select a second table, the OpenESQL Assistant generates an alias of B and so on.
Each column name is prefixed by its alias (for example, A.CustID, A.Company). This enables you to distinguish the columns in one table from those in another.
Some databases use special characters in the names of system tables. For example, Oracle can use system tables whose names contain a dollar sign ($). When the OpenESQL Assistant encounters a special character in the name of system table that would render the generated table name illegal, it automatically encloses the column and table names in quotes.
If the name generated from the column name (including any prefixes and suffixes) is longer than 31 characters or contains illegal characters would be illegal in COBOL, OpenESQL generates a host variable using the column number (for example, COL005) rather than the column name.