Skip to main content

I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

The problem here is that the LITLINK directive, which is required when linking Oracle Pro*COBOL programs, is causing the compiler to generate the call to TESTCOVER as a static call which needs to be resolved at link time rather than at run-time.

I have created an RPI (bug report) for this because there is currently no TESTCOVER.LIB that you can link to in order to resolve this reference.

As a workaround, you might look at using .int/.gnt code instead of .EXE/.DLLs when running Oracle programs with TESTCOVER as these executable types are not linked but resolve all references dynamically at run-time.

Thanks.


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

I now have a "TESTCOVER.LIB" file that will satisfy the link when using the LITLINK directive.

I have attached it here.

Add this file to the additional link libraries under Project Properties and you should be fine linking your Oracle Pro*COBOL application when also using the TESTCOVER directive.


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

Thank you for reply.

Now I can linking Pro*COBOL application when also using the TESTCOVER directive.

And by the way, is this "TESTCOVER.LIB" will be an official release?


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

This TESTCOVER.LIB will be added directly to the product in a future release, most likely in Release 2.2.

Thanks.


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

I think I have a new problem with the directive.

The problem is when I call a sub program in a Pro*COBOL program.The build error will be happen.The other(no SQL) programs is OK.

I already linked the sub program in the [Properties--Micro Focus COBOL--Build Configurations--Link--Additional Link Files].And I try all types of target type(dll,int/gnt,lbr).

The part of error message is

-------begin-------

[cobollink] SamplePGM.obj

[cobollink] D:\\soft\\testcover.lib

[cobollink] D:\\app\\admin\\product\\11.1.0\\client_1\\precomp\\LIB\\orasql11.lib

[cobollink] D:\\workspace\\SampleSub\\New_Configuration.bin\\SampleSub.lbr

[cobollink] cbllds00000D48.obj

[cobollink] mfsqlsmf.lib

[cobollink] D:\\workspace\\SampleSub\\New_Configuration.bin\\SampleSub.lbr : fatal error LNK1107: invalid or corrupt file: cannot read at 0xC80

[cobollink] Link complete with errors

--------end--------

Thanks.


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

If you wish to link a subprogram to the main .executable it must be created as an .obj file as the other formats that you mention are not linkable.

If you place the source to the subprogram in the same project as the calling program and this is specified to be a single output executable then an .obj will be generated automatically for the subprogram and it will be linked into the main executable.

You do not have to specify the program in the additional link directives.

If you wish to call a subprogram dynamically (as a .dll) from a main program that uses litlink then you must use a call data-name instead of call "literal" so that the compiler will not generate the name as an external.

Thanks.


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

Thank you for reply.

If I put the main and sub into the same project.And I calling the sub in the main like [CALL SUBA USING ABC.],it will be OK.Is this understanding correct?(Now the main and sub in different project.)


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

Yes, you can place the subprogram into the same project as the main program and then they will be linked together into the same executable.

The program to be called should be specified within quotes.

CALL "SUBA" USING ABC.

if this is the actual name of the program to call and not the name of a variable which contains the name of the program to call.

You should also set the entry point of the .executable to the name of the main program so that it will be started first when the program is run.

Entry point can be set under Project Properties-->COBOL tab as follows:


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

Can I use the  "TESTCOVER.LIB" in RedHat Linux?

By the way.There is no Introduction in the manual(Micro Focus Visual COBOL 2.1 for Eclipse(Unix)).Is that means the Visual COBOL doesn't support Test Coverage in Linux?

Thank you!


I wrote a COBOL program(use Oracle DB) by visual COBOL2.1.I can run it with the following directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK).

Then I want see the test coverage.So I add the keyword "TESTCOVER" to the directives.(p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP LITLINK TESTCOVER ). But it didn't work.Some errors had happend.If I wirte the directive like this ( p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C p(cp) ENDP TESTCOVER ),then the coverage is ok and the DB connection is failed.


#COBOL
#VisualCOBOL
#Eclipse

Sorry, but the TESTCOVER.LIB is an import library for linking to Windows applications only.

TESTCOVER is supported in Unix/Linux environments.

If you look in the documentation for Visual COBOL Eclipse 2.1 Update 1 for Linux here: it will provide a link to the Server Express 6.0 docs where you will find the information for using the testcover tools from a Unix command line.

The tools work the same way in Visual COBOL as they did in Server Express.

Thanks.