I'm using Visual Cobol For Eclipse on Redhat Linux.
There's some [EXEC SQL ~] Code for Oracle in my project so I'm trying to compile them.
I've checked [ Micro Focus > Build Configurations > COBOL > SQL Preprocessor] and selected [Pro*COBOL],
but while compiling , it shows error [sh cannot find procob].
I think it because of I never installed [Oracle Pro* COBOL] on my Redhat Linux.
So I downloaded instance of [Pro* COBOL] from here
https://www.oracle.com/database/technologies/instant-client/precompiler-downloads.html#license-lightbox
But I don't know how to install it, or maybe I have to install full Oracle Server?
Please help, Thanks.
Hello Zhang Xin,
Thanks for your question. Unfortunately, Micro Focus does not have official information on how to install Oracle components, such as the Oracle Pro*COBOL precompiler.
However, a quick Google search turned up this document, which seems to provide information about installing (for example) the Oracle 19 Database Client, which I believe includes Pro*COBOL:
About Oracle Instant Client
I would recommend that you reach out directly to Oracle, to confirm that you are installing the correct product for your usage and Oracle version.
Hope that helps,
Blair
Hello Zhang Xin,
Thanks for your question. Unfortunately, Micro Focus does not have official information on how to install Oracle components, such as the Oracle Pro*COBOL precompiler.
However, a quick Google search turned up this document, which seems to provide information about installing (for example) the Oracle 19 Database Client, which I believe includes Pro*COBOL:
About Oracle Instant Client
I would recommend that you reach out directly to Oracle, to confirm that you are installing the correct product for your usage and Oracle version.
Hope that helps,
Blair
Thanks for the response.
I'll try to install Oracle Client, but currently there's no Express Version of Oracle what I needed...
It there any way to use [procob] without installing Oracle ? like, set Compile Variable or somehow?
Thanks for the response.
I'll try to install Oracle Client, but currently there's no Express Version of Oracle what I needed...
It there any way to use [procob] without installing Oracle ? like, set Compile Variable or somehow?
procob is (to my knowledge) only available from the Oracle client. Also, you will definitely need the Oracle client software installed. The procob precompiler will insert CALLs to the Oracle client routines into your COBOL program, substituting these for your EXEC SQL statements.
I'm using Visual Cobol For Eclipse on Redhat Linux.
There's some [EXEC SQL ~] Code for Oracle in my project so I'm trying to compile them.
I've checked [ Micro Focus > Build Configurations > COBOL > SQL Preprocessor] and selected [Pro*COBOL],
but while compiling , it shows error [sh cannot find procob].
I think it because of I never installed [Oracle Pro* COBOL] on my Redhat Linux.
So I downloaded instance of [Pro* COBOL] from here
https://www.oracle.com/database/technologies/instant-client/precompiler-downloads.html#license-lightbox
But I don't know how to install it, or maybe I have to install full Oracle Server?
Please help, Thanks.
You can access oracle database with normal sql code over a odbc-driver!
I have many cobol programs demonstrating this and this will works since any years without problems.
Any times, the code will be specific and other as mssql or mysql code, but this can be modified to run!
cg
procob is (to my knowledge) only available from the Oracle client. Also, you will definitely need the Oracle client software installed. The procob precompiler will insert CALLs to the Oracle client routines into your COBOL program, substituting these for your EXEC SQL statements.
Thanks for the response.
I just followed your advice and installed Oracle 19c Clien.
But still showed compile error....like this
============================
[cobol] Compiling (64-bit) xxxxxx.pco...
[cobol]
[cobol] * Cobsql Integrated Preprocessor
[cobol] * CSQL-I-049: Unable to support the SOURCETABSTOP directive, defaulting to 8
[cobol] * CSQL-I-003: COBSQLTYPE is incorrect defaulting to Oracle
[cobol] * CSQL-I-018: Invoking Oracle Precompiler/Translator
[cobol] * CSQL-F-016: UNIX error Return Code is 0127
[cobol] * CSQL-F-021: Precompiler did not complete, no list file present -- Terminating
[cobol] sh: procob: command not found
[cobol] cob64: error(s) in compilation: /home/spcs8/workspaceVisualCobol2/xxxx/xxxx.pco
[cobol] Compilation complete with 0 errors, 0 warnings, 0 notices and an exit code of 16
============================
I've checked the following 3 point and that's all I can thought...
1. Install Oracle Client and set ORACLE_HOME. checked

2. Added [Additional Preprocessors] automatically. checked

3. set [SQL Preprocessor] manually. checked

Do I have to set other thing for Pro*COBOL ? like
how to find procob , environment variables, PATH and configuration file ?
I'm still wondering why Visual Cobol can find where procob is....only ORACLE_HOME enough ?
Waiting for your response. thank you
You can access oracle database with normal sql code over a odbc-driver!
I have many cobol programs demonstrating this and this will works since any years without problems.
Any times, the code will be specific and other as mssql or mysql code, but this can be modified to run!
cg
Yes. But I'm trying to re-compile my Project from Micrfocus Cobol to Visual Cobol...
So basically , I'm not allowed change any cobol souce code, except that's a compatibility issue.
I just uploaded screen captures to descript my question.
Very looking forward to receive your solution. Thanks.
Thanks for the response.
I just followed your advice and installed Oracle 19c Clien.
But still showed compile error....like this
============================
[cobol] Compiling (64-bit) xxxxxx.pco...
[cobol]
[cobol] * Cobsql Integrated Preprocessor
[cobol] * CSQL-I-049: Unable to support the SOURCETABSTOP directive, defaulting to 8
[cobol] * CSQL-I-003: COBSQLTYPE is incorrect defaulting to Oracle
[cobol] * CSQL-I-018: Invoking Oracle Precompiler/Translator
[cobol] * CSQL-F-016: UNIX error Return Code is 0127
[cobol] * CSQL-F-021: Precompiler did not complete, no list file present -- Terminating
[cobol] sh: procob: command not found
[cobol] cob64: error(s) in compilation: /home/spcs8/workspaceVisualCobol2/xxxx/xxxx.pco
[cobol] Compilation complete with 0 errors, 0 warnings, 0 notices and an exit code of 16
============================
I've checked the following 3 point and that's all I can thought...
1. Install Oracle Client and set ORACLE_HOME. checked

2. Added [Additional Preprocessors] automatically. checked

3. set [SQL Preprocessor] manually. checked

Do I have to set other thing for Pro*COBOL ? like
how to find procob , environment variables, PATH and configuration file ?
I'm still wondering why Visual Cobol can find where procob is....only ORACLE_HOME enough ?
Waiting for your response. thank you
Please try adding the directory containing the procob executable to the PATH environment variable setting. When you use COBSQL, the PATH is used to search for procob. (This must be set in the session that starts Eclipse.)
Also, it may be useful for you to have another resource available as you work through getting your COBOL programs with embedded Oracle working. Here is a link to a Micro Focus Knowledge Base article about Building with Pro*COBOL on Unix/Linux platforms. Although it doesn't specifically mention Visual COBOL for Eclipse, it provides a lot of helpful background about the requirements for building and running COBOL programs with embedded Oracle SQL on that platform, as well as common errors you may encounter:
https://support.microfocus.com/kb/doc.php?id=7020979#oracleenv
Yes. But I'm trying to re-compile my Project from Micrfocus Cobol to Visual Cobol...
So basically , I'm not allowed change any cobol souce code, except that's a compatibility issue.
I just uploaded screen captures to descript my question.
Very looking forward to receive your solution. Thanks.
can you publish a small program working with netexpress 5.x, i will convert this in visual cobol, but in major times, they will work without changes!
* Connect
perform sql-connect
if run-flag = 0
perform verarb
end-if
* Close
perform sql-disconnect
* Examples from a table
/
artikel-sql-loeschen section.
move 'Loeschen der MSSQL-Artikeldaten'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
*
* DELETE Creates the code to delete one or
* more rows in your data source
EXEC SQL
DELETE FROM X_ARTI
* WHERE
* (datepart(year, datum) >= :periode-von-jjjj and
* datepart(month, datum) >= :periode-von-mm) and
* (datepart(year, datum) <= :periode-bis-jjjj and
* datepart(month, datum) <= :periode-bis-mm)
END-EXEC
IF SQLCODE = 0 or 100 *> = +100
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-truncate section.
move 'Truncate der Oracle-Artikeldaten'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
*
* DELETE Creates the code to delete one or
* more rows in your data source
EXEC SQL
TRUNCATE table X_ARTI
* WHERE
* (datepart(year, datum) >= :periode-von-jjjj and
* datepart(month, datum) >= :periode-von-mm) and
* (datepart(year, datum) <= :periode-bis-jjjj and
* datepart(month, datum) <= :periode-bis-mm)
END-EXEC
IF SQLCODE = 0 or 100 *> = +100
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-insert section.
* INSERT Creates the code to insert one or
* more rows in your data source
EXEC SQL
INSERT INTO X_ARTI
(ARTNUM
,ARTBEZ1
,ARTBEZ2
,ARTBEZ3
,EANCODE
,KARTEAN
,NEANCODE
,ARTOWG
,ARTWG
,ARTMHD
,ARTVPE
,ARTINHALT
,ARTCCG
,ARTANL
,ARTFLPAL
,ARTKTPAL
,ARTLAGPAL
,ARTKTLAG
,ARTSTATUS
,ABC
,SORTENREIN
,CRTDTM
,STATUS
,FLAGC
* ,ARTDICHTE
) VALUES
(:sql-art-nr
,:sql-art-bez1
,:sql-art-bez2
,:sql-art-bez3
,:sql-art-eancode
,:sql-art-kartean
,:sql-art-neancode
,:sql-owg-nr
,:sql-wg-nr
,:sql-art-mhd
,:sql-art-vpe
,:sql-art-inhalt
,:sql-art-ccg
,:sql-art-anl
,:sql-art-flpal
,:sql-art-ktpal
,:sql-art-lagpal
,:sql-art-ktlag
,:sql-art-status
,:sql-art-abc
,:sql-art-rein
,:sql-datum
,:sql-status
,:sql-flagc
* ,:sql-art-dichte
)
END-EXEC
IF SQLCODE = 0
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-create section.
move 'Anlage der Oracle-Artikel-Tabelle'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
EXEC SQL
CREATE TABLE X_ARTI
(ARTNUM char (9) NOT NULL
,ARTBEZ1 char(30) NOT NULL
,ARTBEZ2 char(30) NOT NULL
,ARTBEZ3 char(30) NOT NULL
,EANCODE char(14) NOT NULL
,KARTEAN char(13) NOT NULL
,NEANCODE char(13) NOT NULL
,ARTOWG number(6) NOT NULL
,ARTWG number(6) NOT NULL
,ARTMHD number(6) NOT NULL
,ARTVPE number(6) NOT NULL
,ARTINHALT number(6) NOT NULL
,ARTCCG number(6) NOT NULL
,ARTANL number(6) NOT NULL
,ARTFLPAL number(6) NOT NULL
,ARTKTPAL number(6) NOT NULL
,ARTLAGPAL number(6) NOT NULL
,ARTKTLAG number(6) NOT NULL
,ARTSTATUS number(6) NOT NULL
,ABC char(1) NOT NULL
,SORTENREIN char(1) NOT NULL
,CRTDTM char(14) NOT NULL
,STATUS number(2) NOT NULL
,FLAGC number(1) NOT NULL
* ,ARTDICHTE number(3,4) NOT NULL
)
TABLESPACE TS_DC21WMS_ORD STORAGE (INITIAL 1M NEXT 1M
MINEXTENTS 1 PCTINCREASE 0)
END-EXEC
if sqlcode <> 0
* perform 0100-to-0101-fehler
exit section
end-if
EXEC SQL
create index X_ARTI_idx_001 on X_ARTI (ARTNUM)
tablespace Ts_DC21WMS_IDX;
END-EXEC
if sqlcode <> 0
* perform 0100-to-0101-fehler
exit section
end-if
exec sql commit end-exec
Please try adding the directory containing the procob executable to the PATH environment variable setting. When you use COBSQL, the PATH is used to search for procob. (This must be set in the session that starts Eclipse.)
Also, it may be useful for you to have another resource available as you work through getting your COBOL programs with embedded Oracle working. Here is a link to a Micro Focus Knowledge Base article about Building with Pro*COBOL on Unix/Linux platforms. Although it doesn't specifically mention Visual COBOL for Eclipse, it provides a lot of helpful background about the requirements for building and running COBOL programs with embedded Oracle SQL on that platform, as well as common errors you may encounter:
https://support.microfocus.com/kb/doc.php?id=7020979#oracleenv
Thanks for the response.
I finally got the reason why my Visual Cobol Project cannot find procol....
I only added PATH and ORACLE_HOME for my Linux User "oracle" (because of I installed Oracle Client under it)
Now I also added PATH , ORACLE_HOME, and LD_LIBRARY_PATH(thanks for the link) for User that
I created for using Visual Cobol IDE, It's all good now....so silly me
Actually, I'm working on re-compile from Microfocus COBOL to Visual COBOL, and now my Project shows
[COBCH0803S 000008:Must use option SQLCHECK=SEMANTICS(FULL) when there is embedded PL/SQL],
so I added [Exec ORACLE OPTION (SQLCHECK=FULL) End-Exec.] and no compile error now.
But why this error showed up ? Is that because of [Microfocus COBOL => Visual COBOL] or [ORACLE 12c => 19c] ?
Sorry, I have to find out all the reasons why changing source code...
can you publish a small program working with netexpress 5.x, i will convert this in visual cobol, but in major times, they will work without changes!
* Connect
perform sql-connect
if run-flag = 0
perform verarb
end-if
* Close
perform sql-disconnect
* Examples from a table
/
artikel-sql-loeschen section.
move 'Loeschen der MSSQL-Artikeldaten'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
*
* DELETE Creates the code to delete one or
* more rows in your data source
EXEC SQL
DELETE FROM X_ARTI
* WHERE
* (datepart(year, datum) >= :periode-von-jjjj and
* datepart(month, datum) >= :periode-von-mm) and
* (datepart(year, datum) <= :periode-bis-jjjj and
* datepart(month, datum) <= :periode-bis-mm)
END-EXEC
IF SQLCODE = 0 or 100 *> = +100
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-truncate section.
move 'Truncate der Oracle-Artikeldaten'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
*
* DELETE Creates the code to delete one or
* more rows in your data source
EXEC SQL
TRUNCATE table X_ARTI
* WHERE
* (datepart(year, datum) >= :periode-von-jjjj and
* datepart(month, datum) >= :periode-von-mm) and
* (datepart(year, datum) <= :periode-bis-jjjj and
* datepart(month, datum) <= :periode-bis-mm)
END-EXEC
IF SQLCODE = 0 or 100 *> = +100
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-insert section.
* INSERT Creates the code to insert one or
* more rows in your data source
EXEC SQL
INSERT INTO X_ARTI
(ARTNUM
,ARTBEZ1
,ARTBEZ2
,ARTBEZ3
,EANCODE
,KARTEAN
,NEANCODE
,ARTOWG
,ARTWG
,ARTMHD
,ARTVPE
,ARTINHALT
,ARTCCG
,ARTANL
,ARTFLPAL
,ARTKTPAL
,ARTLAGPAL
,ARTKTLAG
,ARTSTATUS
,ABC
,SORTENREIN
,CRTDTM
,STATUS
,FLAGC
* ,ARTDICHTE
) VALUES
(:sql-art-nr
,:sql-art-bez1
,:sql-art-bez2
,:sql-art-bez3
,:sql-art-eancode
,:sql-art-kartean
,:sql-art-neancode
,:sql-owg-nr
,:sql-wg-nr
,:sql-art-mhd
,:sql-art-vpe
,:sql-art-inhalt
,:sql-art-ccg
,:sql-art-anl
,:sql-art-flpal
,:sql-art-ktpal
,:sql-art-lagpal
,:sql-art-ktlag
,:sql-art-status
,:sql-art-abc
,:sql-art-rein
,:sql-datum
,:sql-status
,:sql-flagc
* ,:sql-art-dichte
)
END-EXEC
IF SQLCODE = 0
continue
end-if
exec sql commit end-exec
.
/
artikel-sql-create section.
move 'Anlage der Oracle-Artikel-Tabelle'
to ueberschrift
move 'PRO0004 ' to dateiname
move 0 to anzahl
perform ueberschrift-fuellen
EXEC SQL
CREATE TABLE X_ARTI
(ARTNUM char (9) NOT NULL
,ARTBEZ1 char(30) NOT NULL
,ARTBEZ2 char(30) NOT NULL
,ARTBEZ3 char(30) NOT NULL
,EANCODE char(14) NOT NULL
,KARTEAN char(13) NOT NULL
,NEANCODE char(13) NOT NULL
,ARTOWG number(6) NOT NULL
,ARTWG number(6) NOT NULL
,ARTMHD number(6) NOT NULL
,ARTVPE number(6) NOT NULL
,ARTINHALT number(6) NOT NULL
,ARTCCG number(6) NOT NULL
,ARTANL number(6) NOT NULL
,ARTFLPAL number(6) NOT NULL
,ARTKTPAL number(6) NOT NULL
,ARTLAGPAL number(6) NOT NULL
,ARTKTLAG number(6) NOT NULL
,ARTSTATUS number(6) NOT NULL
,ABC char(1) NOT NULL
,SORTENREIN char(1) NOT NULL
,CRTDTM char(14) NOT NULL
,STATUS number(2) NOT NULL
,FLAGC number(1) NOT NULL
* ,ARTDICHTE number(3,4) NOT NULL
)
TABLESPACE TS_DC21WMS_ORD STORAGE (INITIAL 1M NEXT 1M
MINEXTENTS 1 PCTINCREASE 0)
END-EXEC
if sqlcode <> 0
* perform 0100-to-0101-fehler
exit section
end-if
EXEC SQL
create index X_ARTI_idx_001 on X_ARTI (ARTNUM)
tablespace Ts_DC21WMS_IDX;
END-EXEC
if sqlcode <> 0
* perform 0100-to-0101-fehler
exit section
end-if
exec sql commit end-exec
Thanks for all the details.
I forgot to add PATH/ORACLE_HOME/LIBRARY for the User that I created for using Visual Cobol...
Now my Visual Cobol could find where procob is, But as my replay above,
I had to add [Exec ORACLE OPTION (SQLCHECK=FULL) End-Exec] for my source code.
Is this a compatibility issue while [Microfocus COBOL => Visual COBOL] or Oracle Version up (12=>19)?