Skip to main content

[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

You have first not said which product you are using, so I will assume it is Net Express.

I will start with a quick check list of things to look for in your environment:
1) you are using the the threaded runtime for you .exe/.dll, for int/gnt use the "runm" trigger
2) you are using the right version of Java for the runtime you are using, eg: if you are using the 32bit runtime use the 32bit version of Java
3) ensure you that jvm.dll is on the PATH (I usually put JDK/bin & JDK/jre/bin/client on the PATH and use JDK 1.6)

And here is your example running:

D:\\DemosAndTests\\java.basic>runm testfd
Operating System: Windows Vista


[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

spgennard originally wrote:
You have first not said which product you are using, so I will assume it is Net Express.

Sorry for not mentioning, as I said I'm new to COBOL so I didn't even know that there are different products :)

We are running Server Express on an HPUX box


spgennard originally wrote:
1) you are using the the threaded runtime for you .exe/.dll, for int/gnt use the "runm" trigger

What is the runm? We have a runb but I see no mention of a runm.

spgennard originally wrote:
3) ensure you that jvm.dll is on the PATH (I usually put JDK/bin & JDK/jre/bin/client on the PATH and use JDK 1.6)

Is there a shared library for HPUX that I need to have in my path?

I've made sure to add these directories to my path anyways:
export PATH=$JH/bin:$JH/jre/lib/PA_RISC2.0/server:$PATH


[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

As you are using Server Express, it comes with a script called cobjse that setups the environment for you:

.$COBDIR/bin/cobsje -J MyJavaHome

and you need to use cobjrun instead of the traditional java trigger (only difference is the cobjrun preloads the COBOL runtime).

For more information have a look @ support.microfocus.com/.../djjint.htm

[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

$COBDIR/bin/cobjse doesn't exist on my server. Is this something that should be available on version 2.2 of server express?

[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

I have try to run above program with with Net express 5.1

it gives this error

Load Failure

$Java$Java.lang.System


[Migrated content. Thread originally posted on 20 October 2011]

I am fairly new to COBOL, I am a JAVA developer but I have been tasked with calling a java program from an existing cobol program. So I thought I'd start with a basic proof of concept to see how it works and I can't even get it to load basic java libraries.

here is my program:
$set ooctrl" p-f"
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-FD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.

class-control.
   Sys is class "$java$java.lang.System"
    .
   
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
77  pic-x-item  pic x(50).

thread-local-storage section.
01 anInt  pic x(5) comp-5.

/
PROCEDURE DIVISION.                                   
    invoke Sys "getProperty" using "os.name" giving pic-x-item.
    display "Operating System: " pic-x-item.
   
000-EXIT-TPR.
     STOP RUN.



And my Error:
Load error : file '$java$java.lang.System'
error code: 198, pc=0, call=1, seg=0
198 Load failure .. ..................................................................................................................................



Any help would be appreciated.
Thanks!

Please check the items that Stephen mentioned earlier in this thread:


I will start with a quick check list of things to look for in your environment:
1) you are using the the threaded runtime for you .exe/.dll, for int/gnt use the "runm" trigger
2) you are using the right version of Java for the runtime you are using, eg: if you are using the 32bit runtime use the 32bit version of Java
3) ensure you that jvm.dll is on the PATH (I usually put JDK/bin & JDK/jre/bin/client on the PATH and use JDK 1.6)


Thanks.