For your managed applications, OpenESQL provides the option of using traditional host variable declarations, and an option
.NET data types as your host variable declarations. Use of
.NET data types is made possible by the OpenESQL Managed Runtime, specified by setting the DBMAN directive option to
When your managed application contains traditional host variable declarations using PIC clauses, this requires the OpenESQL
Managed Runtime to read each PIC clause and convert it to the equivalent
type. However, by declaring your host variables using the
data types in place of the PIC clause, you get these advantages:
- Improved performance - it is not necessary for the OpenESQL Managed Runtime to translate PIC clauses to
.NET types, thereby greatly enhancing performance.
- No size restrictions -
.NET variables in managed applications are not restricted in size, whereas native COBOL applications have size restrictions on
host variables, especially for applications that involve LOB data.
- Improved application portability - the managed runtime simplifies the process of porting existing native EXEC SQL applications
When coding your applications to use
host variables, keep in mind:
- Only the OpenESQL preprocessor supports the use of
.NET host variables. Currently, no DBMS vendors provide direct support for EXEC SQL syntax in
- For complete information on declaring
.NET host variables for the OpenESQL Managed Runtime, see the reference topics under
SQL Data Types.
- The OpenESQL Assistant provides an easy method of generating
.NET host variables for a table via the DCLGEN option in the tool. See
for more information on how to generate copybooks in this format.
.NET host variables
*> COBOL HOST VARIABLES FOR TABLE EMP
01 EMP-EMPNO STRING.
01 EMP-FIRSTNME STRING.
01 EMP-MIDINIT STRING.
01 EMP-LASTNAME STRING.
01 EMP-WORKDEPT STRING.
01 EMP-PHONENO STRING.
01 EMP-HIREDATE type System.DateTime.
01 EMP-JOB STRING.
01 EMP-EDLEVEL BINARY-SHORT.
01 EMP-SEX STRING.
01 EMP-BIRTHDATE type System.DateTime.
01 EMP-SALARY DECIMAL.
01 EMP-BONUS DECIMAL.
01 EMP-COMM DECIMAL.
FROM HCOSQL.EMP A
WHERE (A.EMPNO = :EMP-EMPNO)