Original Message:
Sent: Fri May 05, 2023 11:27 AM
From: David Tremaine
Subject: Call Java Pgm on MVS
Hi Alina,
I have some good news for you. I was thinking about an easy workaround to your problem and I realized that there already is a way to override compiler options in the environment in which cjbuild runs. The cob2 utility, which cjbuild uses, supports option overrides via an environment variable called COBOPT.
So if you set the following in your environment before running cjbuild, everything will work fine:
export COBOPT="dbcs,nsymbol(national)"
Obviously, if you're putting this in an environment file, you don't include the "export".
I tested this out in my environment (I set NODBCS and NSYMBOL(DBCS) in my installation defaults first) and it worked great.
At the very least, a future release of cjbuild will likely be updated to explicitly specify DBCS and NSYMBOL(NATIONAL) so that users do not have to do that override. A new cjbuild option that supports supplying override options directly may be provided as well. We're working on it!
Thanks for trying out this feature and giving us your feedback, and thanks for your patience.
Regards,
David
------------------------------
David Tremaine
Senior Software Developer
IBM Canada Ltd.
Original Message:
Sent: Fri April 28, 2023 10:16 AM
From: Alina Dehler
Subject: Call Java Pgm on MVS
Hello Bernie,
your answer definetely helped, we just had to substitute our correct paths. Thank you. We are now able to run a cobol job and call java within.
But we have a problem with passing strings to java (it works with integers).
With this variable definition:
working-storage section.
01 input-str pic x(9) value "fixstring".
01 output-str pic x(9).
And this java call:
call 'Java.CobProd.changeString' using input-str
returning output-str
We get this error in cjbuild (cob2):
# Compiling Java call stub method Java.CobProd.changeString
/usr/lpp/IBM/cobol/igyv6r4/bin/cob2 -qlist -c /cpxvar/JADH/cob64/jtoc/cobprod/out/Java.CobProd.changeString.cbl -I /usr/lpp/IBM/cobol/igyv6r4/include
# Command return code 8:
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.4.0 in progress ...
LineID Message code Message text
IGYSC1105-E The "NODBCS" option was in effect but the program
contained national data. Execution results are unpredictable.
Messages Total Informational Warning Error Severe Terminating
Printed: 1 1
End of compilation 1, program Java_CobProd_changeString, highest severity 8.
Return code 8
How can we pass strings or jsons to the java method?
When we use national data in our own cobol programs, we can set the compile option manually for this one program (either at the top of the program or in the SCLM Archdef). How can we pass compile options for the stub programs that are generated in cjbuild, without changing the default compile options?
Kind regards,
Alina
------------------------------
Alina Dehler
Original Message:
Sent: Fri April 21, 2023 01:38 PM
From: Bernie Rataj
Subject: Call Java Pgm on MVS
Hi Alina,
The missing libjvm.so will be able to be found by including the libjvm.so module's containing directory to the LIBPATH like this
//STDENV DD *
_CEE_ENVFILE_COMMENT=#
_CEE_ENVFILE_CONTINUATION=\
#
LIBPATH=/usr/lpp/java/J8.0/bin\
:/usr/lpp/java/J8.0/bin/j9vm
/*
and pointing LE to STDENV via
//CEEOPTS DD *
ENVAR(_CEE_ENVFILE_S=DD:STDENV)
/*
Do note that LE environment variable files do NOT support symbol substitution the way that shell scripts do. However, you can use JES SYMBOLS= substitution.
Make sure not to include line numbers if using JES input files.
Bernie
------------------------------
Bernie Rataj
Technical Support Professional
IBM Canada Ltd.
Markham ON Canada
https://www.ibm.com/products/cobol-compiler-zos
https://www.ibm.com/products/pli-compiler-zos
Original Message:
Sent: Thu April 20, 2023 02:52 AM
From: Alina Dehler
Subject: Call Java Pgm on MVS
Hello,
we are currently trying to get the example to run, but we want to run a Cobol program that calls a Java method. We are getiing the following error:
IGZ0377S Library module libjvm.so could not be found. Check the STEPLIB DD in the JCL or the environment variable LIBPATH to make sure the module is available.
How and do we have to add the location of JAVA_HOME to the JCL?
Kind regards,
Alina
------------------------------
Alina Dehler
Original Message:
Sent: Mon March 20, 2023 11:41 AM
From: David Tremaine
Subject: Call Java Pgm on MVS
Hi Guido,
Yes, the sample is now available. I'm glad you found it. Please let us know if something is not clear or you have more questions.
Regards,
David
------------------------------
David Tremaine
Senior Software Developer
IBM Canada Ltd.
Original Message:
Sent: Fri March 17, 2023 11:40 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
OK, finally I found the example JCL here: Sample JCL for building and running the COBPROD application - IBM Documentation
Sorry for the confusion
REgards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Fri March 17, 2023 04:27 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hi Bernie,
sorry, the question should have gone to David. :-)
Regards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Fri March 17, 2023 04:18 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hi Bernie, any idea when the sample JCL will be available?
Regards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Mon February 27, 2023 10:31 AM
From: David Tremaine
Subject: Call Java Pgm on MVS
Hi Guido,
Apologies that it appears that the path we show here is not the more general path we intended (my fault). I intended it to say '/usr/lpp/cobol/igyv6r4' but ulitmately it should be set to wherever your z/OS UNIX installation directory is located for your Enterprise COBOL compiler.
The artifact files that the COBOL compiler generates when you use the new Java interoperability feature must be located on the z/OS UNIX file system. Those files must be compiled into a DLL using the cjbuild utility, which is a Java program and is intended to be run from z/OS UNIX . However, as we show in our upcoming sample JCL to be released any day now, you can easily run cjbuild from JCL using the BPXBATCH utility. I recommend waiting to see that sample JCL.
The idea for users is that they should be able to build their user programs in the same way they did previously, but they should delay the linking step until cjbuild has built the DLL for the application, as the user programs may need to link against the side deck for that DLL.
The cjbuild utility takes care of invoking the Enterprise COBOL compiler via cob2, so you don't need to be involved in that, other than to tell the JCL where the z/OS UNIX install directory is. And you can tell cjbuild to output the DLL it produces to a data set, just like you can continue to output the user COBOL program objects in the application into a data set, so there is nothing on the z/OS UNIX file system that is being used at run time -- unless you want it to (e.g., you can also let the DLL be output to a z/OS UNIX directory, in which case at run time you would need to have the directory that holds that DLL in your LIBPATH environment variable). It's all up to you.
Please let me know if you need more info. I am very interested in helping users make progress with this feature.
Thank you.
David
------------------------------
David Tremaine
Senior Software Developer
IBM Canada Ltd.
Original Message:
Sent: Mon February 27, 2023 03:14 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hi Bernie, after a first look to the JCL I see that the COBOL compiler used to compile the COBOL program resides in USS
// SET IGYHOME='/home/tremain/cobol2/igyv6r4'
Is there a possibility to use the MVS COBOL Compiler?
Why do we need to compile the COBOL program in USS?
Regards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Thu February 09, 2023 05:18 PM
From: Bernie Rataj
Subject: Call Java Pgm on MVS
Hi Guido,
The cjbuild utility can be used to generate interface code to go either from COBOL to Java, or Java to COBOL.
In either case, the Java parts MUST reside in the USS filesystem. What the example does is to let you use cjbuild at arm's length via JCL, rather than requiring you to use the OMVS command or an SSH session to do so, though it will still require the userid doing the building to have an OMVS segment in RACF (or whatever security system you're using).
Once built, you can run your COBOL program from a regular job step, given the appropriate STEPLIB, libpath, classpath and so forth.
Bernie
------------------------------
Bernie Rataj
Senior Software Developer
IBM Canada Ltd.
Markham ON Canada
https://www.ibm.com/products/cobol-compiler-zos
https://www.ibm.com/products/pli-compiler-zos
Original Message:
Sent: Thu February 09, 2023 10:37 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hi Bernie, thanks for your answer. The example you are referring to is a COBOL program compiled on USS using the cjbuild utility. But we are looking for a JCL compiling the COBOL pgm on MVS. We want to run a COBOL program on MVS which is calling a JAva program.
Regards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Thu February 09, 2023 09:42 AM
From: Bernie Rataj
Subject: Call Java Pgm on MVS
Hi Guido,
The delivery was delayed to the February month-end PTF. The APAR will note:
New sample JCL demonstrating how a non-OO COBOL/Java
interoperable application can be built and run entirely using
JCL is provided.
The sample JCL is available in the SIGYSAMP data set of the
compiler (see member IGYCJDMJ) and is also available in the zFS
install directory as file
demo/cobol_java_interop_sample/cobprod.jcl
For more information, please refer to the following sections in
the Enterprise COBOL for z/OS 6.4 IBM Documentation online:
Enterprise COBOL for z/OS 6.4
-> Programming Guide
-> Compiling and debugging your program
-> Compiling, linking, and running non-OO COBOL
applications that interoperate with Java
-> Sample JCL for building and running the COBPROD
application
Bernie
https://www.ibm.com/support/pages/fix-list-and-new-features-enterprise-cobol-zos
------------------------------
Bernie Rataj
Senior Software Developer
IBM Canada Ltd.
Markham ON Canada
https://www.ibm.com/products/cobol-compiler-zos
https://www.ibm.com/products/pli-compiler-zos
Original Message:
Sent: Wed February 08, 2023 11:51 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hi Bernie,
many thanks for your answer.
We will give it a try.
Just need to figure out how I can find the example. I am not familar yet with IBM's APAR system. I opened the APAR link from above but I do not find an example anywhere. What am I missing?
Regards
Guido
------------------------------
Guido THelen
Original Message:
Sent: Mon January 09, 2023 09:23 AM
From: Bernie Rataj
Subject: Call Java Pgm on MVS
Hi Guido,
An official sample showing how to use JCL to build Java interoperability components will be available shortly via PH51752, currently scheduled for the January month-end PTF.
However, the userid doing the building will still need to have an OMVS segment, there's no escaping that, as Java needs USS facilities to run.
Bernie
PH51752: NEW SAMPLE JCL TO BUILD/RUN NON-OO COBOL/JAVA INTEROPERABLE APPLICATIONS FROM JCL
https://www.ibm.com/support/pages/apar/PH51752
_________________________________________
Bernie Rataj
Senior Software Developer
Enterprise COBOL & PL/I for z/OS Technical Support
Original Message:
Sent: 1/6/2023 7:39:00 AM
From: Guido THelen
Subject: Call Java Pgm on MVS
Hello,
could you please point me to an example how to call a Java Pgm from COBOL 6.4 and how to compile thie COBOL program. We are especially interested into the example on MVS and not on USS. We already had a look to the USS solution but this is currently of no use for us. Therefore we would highly appreciate an example using the MVS COBOL 6.4 compiler. A JCL would be great.
Regards
Guido
------------------------------
Guido THelen
------------------------------