Highlighted
Absent Member.
Absent Member.
12720 views

Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution

[Migrated content. Thread originally posted on 05 April 2012]

Hello,
sorry for my bad English.
I installed Micro Focus Cobol visual 2010 trial for eclipse (windows 32 bit), I added an application that I want to debug COBOL. But I EXEC SQL ... END EXEC, eclipse tells me that as an error: "COBCH0149S No sql Have Been Set". I want to link to a database compiled and run Oracle for the application to debug COBOL.

How is your project connected to the database eclipse has oracle ?

Where should retract the user and password for database oracle ?

I saw that in the properties of the project "Micro Focus Cobol / property of language / Cobol / addtionnelles guidelines" that we could write "p(cobsql)" or "SQL(DBMan=ODBC). Eclipse tells me that I have 1 error but when I run the application it tells me: "the COBOL program to run could not be found" and the problem he said "connot open file: meprojet.obj"

Thank you for your help.
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hi,

Firstly, please confirm the exact version of the Oracle client-side software you have installed, by executing

sqlplus /nolog

and whether you have a 32-bit or 64-bit Oracle client installed.

With reference to the Oracle support document 43208.1 - which you can access from the Oracle Support website - it documents the platforms where their language precompilers have been certified. For COBOL on Windows, they state :

32-bit
* 10.2.0 Micro Focus NetExpress 4.0
* & ACUCOBOL-GT 6.2
* 11.1.0 Micro Focus NetExpress 5.0
* 11.2.0 Micro Focus NetExpress 5.0

64-bit
*Cobol < 10.2.0.4 none
* 10.2.0.4+ Micro Focus NetExpress 5.0
* 10.2.0.4+ Micro Focus NetExpress 5.1 (Windows 2008)
* 11.1.0 Micro Focus NetExpress 5.0
* 11.2.0 Micro Focus NetExpress 5.0

So, depending on the fixpack level you have installed, you may need to upgrade to the latest fixpack for your release.

In order to install Pro*COBOL, when running the Oracle installer, you need to select a Custom Install, choose your existing Oracle home (for the relevant version), and select "Oracle Programmer". If you expand that - there should be a checkbox at the bottom of the dialog box - you should be able to see "Precompilers". Once that has run to completion, then you may need to upgrade to a later Oracle fixpack, based on the information shown above.

Note that if looking to install Pro*COBOL on UNIX platforms, you *must* have your COBOL environment configured prior to invoking the installer. Otherwise you will not get an option for installing Pro*COBOL.

Hope this helps.

SimonT.

View solution in original post

0 Likes
16 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
I just tested this here fine with Visual COBOL for Eclipse R4 update 2.

First you need to know what preprocessor is supposed to be used to compile the program.

If you are using Oracle's Pro*COBOL then the appropriate Oracle client software including Pro*COBOL has to installed on your computer and must be accessible within the PATH.

You must be able to connect to the Oracle database using Oracles SQL Developer, etc.

If you are using OpenESQL then you must also have the Oracle ODBC driver (or 3rd party Oracle ODBC driver) installed and you must have your DSN setup to connect to your database.

The following instructions are assuming that you have a program that needs to be compiled with Oracle's Pro*COBOL precompiler.

That means it uses the COBSQL preprocessor of Visual COBOL.
If you are not using Pro*COBOL then let me know and I will post the instructions for OpenESQL as well.

Open up the Visual COBOL Eclipse IDE and select File->New COBOL Project and then give the project a name like "oraconnect".

Click Finish.

Right click on the project name in Navigator and select New->COBOL Program

This should create a new program called Program1.cbl in the editor.

Copy and paste the following over the source for Program1.cbl in the editor:
You should replace the values of username and paswd with your own if these are not valid.

This also assumes that you have the Oracle Sample database installed.


       IDENTIFICATION DIVISION.
       PROGRAM-ID.  ORACONNECT.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
           exec sql include sqlca end-exec

           EXEC SQL BEGIN DECLARE SECTION END-EXEC.

       01  USERNAME   PIC X(10).
       01  PASSWD     PIC X(10).
       01  emp-name   pic x(50).
           EXEC SQL END DECLARE SECTION END-EXEC.
       PROCEDURE DIVISION.
       LOGON.

            MOVE "SCOTT" TO USERNAME.
            MOVE "TIGER" TO PASSWD.
            EXEC SQL
                CONNECT :USERNAME IDENTIFIED BY :PASSWD
            END-EXEC.
            DISPLAY sqlcode
            exec sql select EMP.ENAME INTO :emp-name FROM EMP
               where EMP.EMPNO = 7369
            end-exec
            display emp-name
            stop run.


Save this.
Right click on the project name in Navigator again and select Properties.
Open Micro Focus COBOL-->Build Configurations-->COBOL

Target Type should be single executable file.
Platform should be 32-bit.

Click on the arrow next to Override COBOL Project settings

In the Additional Directives box copy and paste the following:

p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP ENDP litlink
Click Apply

Now click on the Link tab which is two below the COBOL tab in the properties list.

In the box for Additional items to be linked (obj, lib, etc)
enter in the location and name of the appropriate Oracle library,

On my system for Oracle 11g client it looks like the following:

C:\app\crg\product\11.2.0\client_1\precomp\LIB\orasql11.lib

It may have a different name depending on the version of Oracle you are using.

Click Apply and then OK to close the properties window.

If everything is setup correctly then it should compile and link cleanly.
If you get a compile or link error then check the steps above to ensure that the correct information has been entered.

If it compiles and links cleanly you should then be able to debug the program in the debug perspective.

Let me know if you have any problems with this.

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hello,

I modified the PATH by adding: C:\oracle\10G\precomp\LIB
goal when I compile I have always a mistake, he said he knows not "procob"

here is the result of the compilation:
cfg.New_Configuration:
[cobol]
[cobol] Compiling dtmx1000.pco...
[cobol]
[cobol] * Cobsql Integrated Preprocessor
[cobol] * CSQL-I-004: Accepted VERBOSE
[cobol] * CSQL-I-004: Accepted KEEPCBL
[cobol] * CSQL-I-008: Invoking cp Preprocessor
[cobol] * CSQL-I-017: Creating "C:\DOCUMENTS AND SETTINGS\LAMBIN_M\WORKSPACE\DEMTEC\dtm
[cobol] * CSQL-I-018: Invoking Oracle Precompiler/Translator
[cobol] 'procob' n'est pas reconnu en tant que commande interne
[cobol] ou externe, un programme ex‚cutable ou un fichier de commandes.
[cobol] * CSQL-F-021: Precompiler did not complete -- Terminating
[cobol] Compilation complete with 0 errors, 0 warnings, 0 notices and an exit code of 16
[cobollink] Linking demtec.exe...
[cobollink] Micro Focus COBOL - CBLLINK utility
[cobollink] Version 1.3.2.10 Copyright (C) Micro Focus IP Development Limited 1984-2011.
[cobollink]
[cobollink] ERROR: (1) Cannot open file : dtmx1000.obj
[cobollink] ERROR: (6) No public symbols found. No object file generated
[cobollink] Link complete with errors

I do not understand how "procob"

Thank you for your help

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
C:\oracle\10G\precomp\LIB is not where procob.exe resides.
This may be the location for the oracle link libraries but procob itself should be in C:\oracle\10G\client_1\bin or some folder name like that.

Use Windows Explorer and do a search for procob.exe and then add this location to your PATH.

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hi,

Pro*COBOL is only installed as part of an Oracle client installation, and then, only when you use the Custom installation option - it will show up under either "Oracle Programmer" or "Precompilers". When installed, procob.exe will be located within the "BIN" directory under your Oracle installation. If you have an Oracle server installation - for example Oracle XE, or the full Oracle Database - then I don't believe that Pro*COBOL will be available.

Note that Oracle provides both 32-bit and 64-bit client-side software, so you need to ensure that you have the appropriate software installed for the applications you wish to build.

SimonT.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
hello,
Can not find procob.exe I install the version of Oracle 10g and 11g and no pre-Cobol compiler. Could you help me find "procob.exe" or to add a tutorial on the cobol precompiler oracle. In versions of Oracle I install there the pre-compiler c/c++ "proc.exe". Thank you in advance for your help, I'll tighten very grateful if you find me a solution.

Sincerely,
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hi,

Firstly, please confirm the exact version of the Oracle client-side software you have installed, by executing

sqlplus /nolog

and whether you have a 32-bit or 64-bit Oracle client installed.

With reference to the Oracle support document 43208.1 - which you can access from the Oracle Support website - it documents the platforms where their language precompilers have been certified. For COBOL on Windows, they state :

32-bit
* 10.2.0 Micro Focus NetExpress 4.0
* & ACUCOBOL-GT 6.2
* 11.1.0 Micro Focus NetExpress 5.0
* 11.2.0 Micro Focus NetExpress 5.0

64-bit
*Cobol < 10.2.0.4 none
* 10.2.0.4+ Micro Focus NetExpress 5.0
* 10.2.0.4+ Micro Focus NetExpress 5.1 (Windows 2008)
* 11.1.0 Micro Focus NetExpress 5.0
* 11.2.0 Micro Focus NetExpress 5.0

So, depending on the fixpack level you have installed, you may need to upgrade to the latest fixpack for your release.

In order to install Pro*COBOL, when running the Oracle installer, you need to select a Custom Install, choose your existing Oracle home (for the relevant version), and select "Oracle Programmer". If you expand that - there should be a checkbox at the bottom of the dialog box - you should be able to see "Precompilers". Once that has run to completion, then you may need to upgrade to a later Oracle fixpack, based on the information shown above.

Note that if looking to install Pro*COBOL on UNIX platforms, you *must* have your COBOL environment configured prior to invoking the installer. Otherwise you will not get an option for installing Pro*COBOL.

Hope this helps.

SimonT.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hello,
Thank you, I finally got through they installed the Oracle client version and I have the file "procob.exe".
So I modify my PATH "C:\oracle\product\10.2.0\client_1\bin;"
and the properties of the project: Cobol Micro focus/Configuration de la génération/link and
Additional items to be linked (obj, lib etc), i add : C:\oracle\product\10.2.0\client_1\precomp\LIB\orasql10.lib
And properties of the language project/Cobol, i add : p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP ENDP litlink

i have windows 32 bit, and micro focus visal cobol for eclipse.

When I compile the project for the launch, the Oracle precompiler walk,
but when the program starts, SQL queries are not executed,
as if the program does not take into consideration the requests.
Or when I run my application, compilation stops at 35% ...

os.init.unix:

init:

cfg.New_Configuration:
[cobol]
[cobol] Compiling dtmx1000.pco...
[cobol]
[cobol] * Cobsql Integrated Preprocessor
[cobol] * CSQL-I-004: Accepted VERBOSE
[cobol] * CSQL-I-004: Accepted KEEPCBL
[cobol] * CSQL-I-008: Invoking cp Preprocessor



Where does it say where the eclipse will connect to oracle database ? the host ? login and password ?

Does Eclipse tries to connected to the database and this is why the compiler does not stop ?

thank you in advance

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Put Eclipse and Visual COBOL aside for the moment.

You must be able to connect to Oracle successfully outside of Eclipse and Visual COBOL before you have any chance of getting this to work in COBOL.

Have you setup the Oracle client so that you can connect to the database using the Oracle tools like SQL Developer?
If you cannot connect using SQL Developer then you will not be able to connect in a COBOL application either.

After you have your Oracle client setup and functioning then you should try the sample that I provided earlier and get that working before you move on to your larger application.

You provide the username and password for the database in a CONNECT statement in your program as shown in my sample.

Only once you get these items working should you move on and try to run your full application as there may be some additional configuration necessary depending on what Oracle features the application uses.

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution
Hi,

You may want to start out by building one of the COBOL samples shipped by Oracle, using their build script.

Before executing, you will need to have enabled the EMP sample table within your Oracle server installation. Navigate into the rdbms\admin directory of your Oracle server installation, and execute :

sqlplus /nolog
> connect sys/*your_sys_password* as sysdba;
> @utlsampl.sql


which will create/enable the SCOTT user, and a couple of tables of test data.

Assuming that you have installed the Oracle Examples into your client installation, you will find those samples under the precomp\demo\procob2 directory.

Open up a Visual COBOL command prompt, and navigate into that procob2 directory. You'll see makeit.bat along with a number of .pco files. Build the sample1 program with :

.\makeit sample1

and execute with :

.\sample1.exe

Enter 7369 at the prompt, and you should see some data returned.

SimonT.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution

Dear  Chris,

I have the same problem but with SQL SERVER 2012...Can you Help me Please?

Pedro Juan Montero Bernales

PJM Informatica Soluciones Globales

Santiago - Chile

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect project cobol for eclipse in database oracle and run for debug project

Jump to solution

Could you please give us some more detailed information on the exact problem you are having?

This thread relates to setup issues when using the Oracle Pro*COBOL product and has nothing to do with SQL Server and the OpenESQL preprocessor used for interfacing to ODBC/ADO/JDBC connections.

If it is not related to the Oracle issue then it would be best to start a new thread for the issue.

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.