Append the extension "pco" to the name of the source file for the embedded SQL in COBOL.
When the pco file is precompiled using the ecobpg command, COBOL source files will be created, so use the COBOL compiler for the compile.
ecobpg testproc.pco
For COBOL code notation, "fixed" or "variable" format can be specified as an ecobpg command option. If not specified, "fixed" format is used.
Refer to "D.1 Precautions when Using Functions and Operators" and "D.12.1 ecobpg" for information on COBOL code notation and how to specify options for ecobpg.
If an optimizer hint block comment is specified for the SQL statement, specify the following option in the ecobpg command:
Enables the optimizer hint block comment (hereafter, referred to as the "hint clause"). If this option is not specified, the hint clause will be removed as a result of the ecobpg precompile and be disabled.
The SQL statements that can be specified in the hint clause are SELECT, INSERT, UPDATE, and DELETE.
The locations in which the hint clause can be specified are immediately after one of the SELECT, INSERT, UPDATE, DELETE, or WITH keywords. A syntax error will occur if it is specified in any other location.
EXEC SQL SELECT /*+ IndexScan(prod ix01) */ name_id INTO :name_id FROM prod WHERE id = 1 END-EXEC.
See
For basic usage of pg_hint_plan and pg_dbms_stats, see below.
Control execution plans with pg_hint_plan
https://www.postgresql.fastware.com/postgresql-insider-tun-hint-plan
If the encoding used for embedded SQL source files differs from that of the locale when precompiling was executed, set the encoding for the embedded SQL source files by specifying the following option for ecobpg.
Specify "UTF8", "SJIS", or "EUC_JP".
If this option is omitted, the encoding is processed based on the locale.
The ecobpg command defines a group item "sqlca_t" to handle errors, which is defined in the library file stored in the following path:
Library file name | The storage destination of library file |
---|---|
SQLCA-COBOL.cob | fujitsuEnterprisePostgresClientInstallDir/include |
Library file name | The storage destination of library file |
---|---|
SQLCA-COBOL.cob | fujitsuEnterprisePostgresClientInstallDir\include |
When the ecobpg command generates a COBOL file, it inserts a COPY statement with no options to copy the library file. Therefore, specify the path of the storage destination of library file when compiling. How to specify the path must conform to your compiler's specifications.
There is also a library file with the same contents without the extension"cob".
Information
Refer "D.7.2 sqlca”for information on the sqlca_t.
The applications generated by ecobpg connect to PostgreSQL through the ECPG library. The ECPG library internally loads the libpq library.
Refer to "6.4.2 Compiling Applications" for information on the location and name of the ECPG library. And Refer to " Chapter 5 C Library (libpq)" for information on the location and name of the libpq library.
Also, when using a shared library, refer to "A.6 How to Build and Run an Application that Uses Shared Libraries".
The COBOL compiler provides the how to link various libraries, so be sure to specify the path and libraries according to the specifications of your compiler.
Entry information of subprogram
If you use the ECPG library with a dynamic program structure, copy the entry information stored below. For details, follow the specifications of your compiler.
fujitsuEnterprisePostgresClientInstallDir/share/cobol_entry.info
fujitsuEnterprisePostgresClientInstallDir\share\cobol_entry.info
Example
The examples of compiling the applications that dynamically links the COBOL language library.
Note that "<x>" indicates the product version.
Linux 64-bit application:
cobol -M -o testproc -I/opt/fsepv<x>client64/include -L/opt/fsepv<x>client64/lib -lecpg -lpq testproc.cob
Linux 64-bit application(When to set DT_RUNPATH):
cobol -c -M -o testproc.o -I/opt/fsepv<x>client64/include testproc.cob ld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath /opt/fsepv<x>client64/lib --enable-new-dtags -o testproc /usr/lib64/crti.o /usr/lib64/crt1.o /usr/lib64/crtn.o testproc.o -L/opt/fsepv<x>client64/lib -lecpg -lpq -Bdynamic -L/opt/FJSVcbl64/lib -lrcobol -ldl -lc
The examples of compiling on a 64-bit operating system.
64-bit application
> SET LIB=%ProgramFiles%\Fujitsu\fsepv<x>client64\lib;%LIB% > cobol -I "%ProgramFiles%\Fujitsu\fsepv<x>client64\include" -M testproc.cob > link testproc.obj F4AGCIMP.LIB LIBCMT.LIB LIBECPG.LIB LIBPQ.LIB /OUT:testproc.exe
32-bit application
[NetCOBOL V10.5 or earlier]
> SET LIB=%ProgramFiles(x86)%\Fujitsu\fsepv<x>client32\lib;%LIB% > cobol32 -I "%ProgramFiles(x86)%\Fujitsu\fsepv<x>client32\include" -M testproc.cob > link testproc.obj LIBC.LIB F3BICIMP.LIB LIBECPG.LIB LIBPQ.LIB /OUT:testproc.exe
[NetCOBOL V11.0 or later]
> SET LIB=%ProgramFiles(x86)%\Fujitsu\fsepv<x>client32\lib;%LIB% > cobol32 -I "%ProgramFiles(x86)%\Fujitsu\fsepv<x>client32\include" -M testproc.cob > link testproc.obj MSVCRT.LIB F3BICIMP.LIB LIBECPG.LIB LIBPQ.LIB /OUT:testproc.exe