Building Applications

The following sample use case scenarios show typical SQL compiler directives you might set for HCOPG applications:

Type of Program Scenario SQL Compiler Directive Options
COBOL Connect to the database for full SQL syntax checking during compilation SQL(DBMAN={ODBC}, TARGETDB=POSTGRESQL, DB=databaseName, [PASS=userid.password, ] BEHAVIOR=OPTIMIZED, DIALECT=MAINFRAME)
COBOL Do not connect to the database during compilation SQL(DBMAN=ODBC, TARGETDB=POSTGRESQL, BEHAVIOR=OPTIMIZED, DIALECT=MAINFRAME, NOCHECK)

In the IDE, you compile applications by building the projects that contain them. When you build an HCOPG application, you must first set appropriate SQL compiler directive options, and in most cases, establish a connection to your PostgreSQL database.

In addition to the standard SQL compiler directive options, HCOPG includes these specific options to handle SQL compatibility between DB2 and PostgreSQL:
  • DATE
  • DIALECT (required)
  • TARGETDB (required)
  • QUALIFIER
  • TIME
At a minimum, edit your project's SQL properties to set the following compiler directive options for the OpenESQL ESQL preprocessor to ensure that the build process generates the appropriate DBRMs and converts DB2 SQL into PostgreSQL where necessary.
DBMAN
Set this to ODBC.
TARGETDB
Set this to one of the following:
  • POSTGRESQL or PGSQLAWS for AWS PostgreSQL
  • PGSQL for PostgreSQL GDG community edition (early adopter program)
DB
Set this value to your PostgreSQL data source connection name.
PASS
If your data source connection requires that you provide a user ID and password to connect, provide a user ID and password as follows:

userID.password

DIALECT
Set this to MAINFRAME.
DETECTDATE
No value required.
INIT
No value required

Before compiling, unless you have specified the SQL(NOCHECK) directive, you must be connected to the database specified by the DB directive via an ODBC connection.