I am working at a software house maintaining an application written in MF Object COBOL V4.0 which has DB2 SQL statements. These SQL statements are processed by the DB2 pre-processor by our build scripts which is then compiled into DLL's, EXE's, etc.
Our long-term plan (at the moment) is to re-engineer this system using Visual COBOL and use ODBC to interface with the (any) DB. It is a successful product that is still selling well and provides a good source of revenue for the company.
A short term requirement has arisen for the system to use a Oracle DB rather than DB2. I'm not close to the decisions that have been made for this, so I'll just go with it.
We've installed the Oracle bits and I have managed to get the pre-processor in place with the following command line.
PROCOB MODE=ANSI INPUT-NAME.CBL OUTPUT-NAME.CBL
This gives me a new output program that has replaced the SQL code with the Oracle calls. A good start.
I'm now struggling to discover how to actually execute these new bits of code. Previously, our code was previously 'linked' with DB2API.LIB which I'm guessing is how the previous version of the system allowed the DB2 calls to work. I guess I need something equivalent now but I don't know what or where to find it.
The previous LINK command in the script was:
LINK -OUT:%1.DLL -SUBSYSTEM:WINDOWS,4.0 -NODEFAULTLIB -DLL -DEF:%1.DEF %1.OBJ CBLLDS.OBJ ..\RESOURCE\%1.RES MFRTS32.LIB MSVCRT.LIB KERNEL32.LIB DB2API.LIB>>%1.ERR
Note the DB2API.LIB, which is now unnecessary obviously.
The system is on Windows.
I did encounter a couple of SQL differences too.
The CONNECT syntax was different, so:
EXEC SQL
CONNECT TO :WS-SQL-DBNAME
IN SHARE MODE
USER :WS-SQL-USERID
USING :WS-SQL-PASSWORD
END-EXEC.
Is replaced with:
MOVE "db1RMSG" TO WS-SQL-DBNAME
MOVE "PASSWORD" TO WS-SQL-PASSWORD
EXEC SQL
CONNECT :WS-SQL-DBNAME IDENTIFIED BY :WS-SQL-PASSWORD
END-EXEC.
Straightforward enough, BUT how to maintain? I would like the same program to be used for both versions of the system. If I use a compile-time switch then (I think) both SQL statements are examined by the pre-processors as they don't understand the compile-time code. Any ideas for this.
Also, there doesn't appear to be a DISCONNECT statement in Oracle although I haven't investigated this yet.
Within my 'DECLARE CURSOR' statements I use 'FOR FETCH ONLY'. Oracle doesn't like this, so I have removed them for now. Of course more investigation needed here. (FOR READ ONLY I believe is the replacement)
Any help from you chaps is appreciated.
Regards
Razor