0

I am working on Microfocus COBOL code on UNIX box and trying to connect to Postgres database using a system DSN which is already being created and for connecting to that Database I am executing below SQL Query in our code:-

EXEC SQL CONNECT TO ‘SYSTEM_DSN’ USER ‘username.password’ END-EXEC.

However I am getting following error in the response when I am submitting a JCL for the Microfocus COBOL code:-

JCLCM0188I J0003556 BE24010R JOB STARTED 01:02:56
 CASKC0027E Error executing service 'PGM#AR641010' Load error : file 'sqlastrt' error code: 173, pc=F97, call=1, seg=0 173 Called program file not found in drive/directory 01:02:57
 JCLCM0192S J0003556 BE24010R STEP ABENDED STEP001 - COND CODE RTS0173 01:02:57
 JCLCM0181S J0003556 BE24010R JOB ABENDED - COND CODE RTS0173 01:02:57

ODBC Driver DSN created with following details in /etc/odbc.ini :-

[DTF_Postgres_DSN]
Driver=/usr/edb/connectors/odbc/edb-odbc.so
Ess Kay
  • 109
  • 7
AmitG
  • 10,365
  • 5
  • 31
  • 52

1 Answers1

4

Actually the error doesn't say "can't connect to postgres" but "Called program file 'sqlastrt' not found".

Very likely the shown EXEC SQL is translated to CALL 'sqlastrt' by a precompiler and this module/function is not found in the COBOL runtime environment.

Options:

  • If there's a module with the same name somewhere: include its directory in the COBOL run path (and check with ldd that its dependencies are in LD_LIBRARY_PATH), otherwise either
  • pre-load the shared object (postgresql/odbc library) that provides this function (also verify that ldd doesn't show any missing dependencies) or
  • ensure that your compiler uses static linking for the generated CALLs and link against the postgresql/odbc library, this way there's no dynamic module search within the COBOL runtime, instead the system will load it when the COBOL program is loaded into memory

Once this issue is solved you'll be able to check if the postgres/odbc library actually find/reads the DSN you've created.

Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38