Page 1 of 1

call java from mainframe cobol

PostPosted: Fri Nov 12, 2010 6:38 am
by joenazi
Require a cobol program to call a java program in the mainfrane.

The java program(pgm j) is already developed and working fine, but on unix.

Now the cobol program (pgm c) that is currently working well in the mainframe needs to call the java program (pgm j)

the cobol program must pass few parameters(dollar amounts) to the java program, the java program will process those
dollar amounts and calculate taxes and return back the results to the cobol program.

so I need to know how this can be done.

1) compile the java pgm on the mainframe ?

2) any thing special/different when compiling the cobol program that now will the java call ?

2) how to call the java program from the cobol pgm and what things are required in the cobol pgm to support this

3) how to execute the cobol/java pgm in batch(jcl) on the mainframe.

Thanks

Re: call java from mainframe cobol

PostPosted: Fri Nov 12, 2010 7:19 am
by Robert Sample
If your site has java installed, use Unix System Services (OMVS) to enter the command javac <java file name> to compile the java program. Enter javac -v to verify that the site has Java installed, and check the version. This can also be done through batch.

The other questions I won't be able to check on until tomorrow.

Re: call java from mainframe cobol

PostPosted: Fri Nov 12, 2010 7:43 pm
by Robert Sample
Googling z/os cobol and java returns 138,000 hits. One of the first few is a Share presentation on using COBOL and Java together -- including calling Java programs from COBOL, passing data to the Java program, getting data back from the Java program, compiling and linking, and pretty much everything you need to know. Looking on the IBM web site for OO COBOL material will also provide helpful information.

I've run some of the manual examples of COBOL and JAVA, and the process requires tweaking of Unix path, libpath, and classpath statements to get things to work -- but eventually I did manage to get the manual examples working.

Re: call java from mainframe cobol

PostPosted: Sat Nov 13, 2010 2:53 am
by joenazi
Thanks a lot Robert !!!

Re: call java from mainframe cobol

PostPosted: Sun Jan 09, 2011 7:06 pm
by YDM
Please see my post Call COBOL with DB2 in Java-Batch.

We have a problem in the other direction (Java calling COBOL - with DB2).
I don't know it's also a problem to have the same transaction if you are calling Java from COBOL.