Highlighted
Absent Member.
Absent Member.
856 views

migrating ora-iface issues

Hi,

i intend to migrate small native cobol app. to VC. Function of the app is to connect to oracle and use interface (data connection., per table) in order 1. Connect to oracle 2) Send request using

to CRUD records. It works like this:
A) connect to oracle(connect.cbl)
B) data request (execute with oracomm.cbl) using data adapter(subprog,e.g table.cbl)

Ill give you few excerpts from (native cobol) programs as a hint:

1) Data Adapter (e.g. table.cbl)

...

WORKING-STORAGE SECTION.
*-----------------------------------------------------------------
EXEC SQL
INCLUDE SQLCA
END-EXEC.

EXEC SQL
BEGIN DECLARE SECTION
END-EXEC.

01 .
05 KEY-SIZE PIC 9(5) VALUE 12.
05 TAB-SIZE PIC 9(5) VALUE 190.

...

05 W-RQ.
10 W-RQ-CMD PIC X(5).
88 CURSORJAV VALUE "LOCNX",
"REDNX",
"RDUNX",
"REDNK",
"RDUNK".
88 CURSORJAR VALUE "LOCBR",
"REDBR".

....

LINKAGE SECTION.
*-----------------------------------------------------------------
01 P-ID.
05 P-ID-PGM PIC X(8).
*
01 P-RQ.
05 P-RQ-CMD PIC X(5).
05 P-RQ-FN PIC X(3).
05 P-RQ-KN PIC X(5).
05 P-RQ-RC PIC X(2).

.....

*-----------------------------------------------------------------
PROCEDURE DIVISION USING P-ID P-RQ P-WA P-EL P-SIZE.
*-----------------------------------------------------------------
*
*-----------------------------------------------------------------
MAIN SECTION.
*-----------------------------------------------------------------
D display 'Main section (' P-RQ-KN ')' UPON CONSOLE
D display "CMD: " P-RQ-CMD UPON CONSOLE
MOVE KEY-SIZE TO P-KEY-SIZE
MOVE TAB-SIZE TO P-TAB-SIZE
IF DIRECTION(1) = SPACE THEN
SET CUR-IND TO 1
MOVE "XXXX" TO DIRECTION(CUR-IND)
MOVE ZERO TO P-CUR-POS
MOVE 1 TO W-INFLAG
D display "Initialer Aufruf" UPON CONSOLE
END-IF

......

2) Connection (e.g. connect.cbl)

...

LINKAGE SECTION.
01 P-PROG PIC X(8).
*-----------------------------------------------------------------
* P R O C E D U R E D I V I S I O N
*-----------------------------------------------------------------
PROCEDURE DIVISION USING P-PROG.

*-----------------------------------------------------------------
* MAIN
*-----------------------------------------------------------------
MAIN.
PERFORM START
PERFORM PROCESS
EXIT PROGRAM.

*-----------------------------------------------------------------
* START - PROCESS
*-----------------------------------------------------------------
START.
MOVE 'USER' TO W-USER
MOVE 'PASSW' TO W-PASSW
MOVE 'SCHEMA' TO W-DATABASE
MOVE 'MACHINE' TO W-MASCHINE
.
*-----------------------------------------------------------------
* PROCESS
*-----------------------------------------------------------------
PROCESS.

..

3) and finaly execute of statement (eg. oracomm.cbl)

...

* W O R K I N G S T O R A G E S E C T I O N
*-----------------------------------------------------------------
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
*
01 WS.
05 NOERR PIC X VALUE SPACES.
05 UPGM PIC X(8) VALUE SPACES.
05 W-ID.
10 W-ID-PGM PIC X(8) VALUE SPACES.
05 W-RQ.
10 W-RQ-CMD PIC X(5) VALUE SPACES.
88 TWO VALUE 'LOCBR',
'LOCKG',
'LOCKL',

....

*-----------------------------------------------------------------
* L I N K A G E S E C T I O N
*-----------------------------------------------------------------
LINKAGE SECTION.
01 P-ID.
05 P-ID-PGM PIC X(8).
*
01 P-RQ.
05 P-RQ-CMD PIC X(5).
05 P-RQ-FN PIC X(3).
05 P-RQ-KN PIC X(5).
05 P-RQ-RC PIC X(2).
05 FILLER PIC X.
05 P-RQ-DBID PIC S9(4) COMP.
05 P-RQ-RID PIC X(7).

....

*-----------------------------------------------------------------
PROCEDURE DIVISION USING P-ID P-RQ P-WA P-EL.
*
*-----------------------------------------------------------------
* MAIN
*-----------------------------------------------------------------
MAIN.
MOVE SPACES TO W-WA
MOVE SPACES TO W-RQ
PERFORM START
PERFORM PROCESS
PERFORM CLOSE
EXIT PROGRAM
.

....

(this is most important part, calling dataconnector)

ELSE

CALL UPGM USING W-ID W-RQ W-WA W-EL W-SIZE

COMPUTE W-KEY-SIZE = W-KEY-SIZE + 76
END-IF
END-IF

....

Any hints, samples, help... is most welcomed.

Regards,

Alex

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: migrating ora-iface issues

Can you please provide some more details?

You state that you are migrating a small native program to VC.
Where are you migrating this program from, platform., compiler, etc.?
And what is your target platform, Windows, Linux, Unix, version of VC?

Are you currently using Oracle in the program through Pro*COBOL, ODBC, etc.?

Visual COBOL provides for many database options including an interface to Oracle's Pro*COBOL in native code programs using COBSQL (see docs here)

You can also connect to Oracle using an ODBC driver and OpenESQL technology in native code or using the Oracle Data Provider ODP.NET in managed .NET code or using the Oracle jdbc driver in managed JVM code so your options really depend on the target platform.
OpenESQL docs here)

There are samples of using embedded database options in the Samples Browser. Start menu-->Micro Focus Visual COBOL-->Samples.

Select SQL in the left hand column and you will be presented with a list of available samples for SQL in the right hand column.

Thanks.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.