Calling Java program on UNIX/USS from a COBOL CICS program?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Calling Java program on UNIX/USS from a COBOL CICS program?

Postby zbius » Tue Nov 05, 2024 2:37 pm

Hello,
currently we are running multiple COBOL programs which call one another (dynamic calls). For now lets say we have program A and B.
Our company wants to shift step by step to Java. So the plan is, that program A gets migrated to Java first.

Given:
- A currently gets called by B with parameters
- A has to migrate to Java.
- A in Java has to call the DB2 and return the result to B.
- B is running as COBOL CICS (no idea if that makes sense but it is running on the z/OS "directly").
- B has to keep running on the z/OS directly.
- SOAP/REST (and therefore Websphere/WAS) is not an option because we need those quick RAM processing times

What I have already seen from the IBM tutorial is
- that you can run Java and COBOL _easily_ (according to their documentation) on z/OS USS/UNIX
-- https://www.ibm.com/docs/en/cobol-zos/6 ... ng-running
- a JCL for building an running the COBOL-calls-java-application (https://www.ibm.com/docs/en/cobol-zos/6 ... pplication)
-- my understanding is that with this scenario that Java and COBOL both run on the z/OS directly?
- the demo provided under /usr/lpp/cobol/demo also gives a good insight on how to run Java and COBOL on UNIX / USS
- connecting Java with COBOL through JNI, but that is also only for UNIX / USS. (at least that is my understanding from the commands I have seen)
-- https://www.ibm.com/support/pages/using ... -jni-cobol
-- which kind of confuses me because the redbook (https://www.redbooks.ibm.com/redbooks/pdfs/sg248116.pdf) seems to connect/bind/link COBOL CICS with JCL to Java running on UNIX?
- CICS Transaction Server (CTG): giving CICS regions access to z/OS UNIX directories and files
-- https://www.ibm.com/docs/en/cics-ts/6.x ... ries-files
-- using the CTG (and probalby Liberty?) will result in higher processing times I guess.

What would be "optimal" is
- Java (program A) running on z/OS USS because just deploying a .jar file and letting Java run the JVM seems easier than writing JCL/BXBATCH for me
- A is able to call a DB2 and pass the data to B.
- COBOL (program B) running on the z/OS directly.

Questions
- But I have not seen any calls from COBOL (CICS?!) to Java (UNIX/USS). Is that even possible since they both probably won't share the same storage area?
- My guess is that the COBOL programs need recompiling anyway since there won't be any dnyamic call like options for calling a Java program from COBOL CICS?
- Will there be a performance loss if we shift all COBOL CICS programs to UNIX / USS?
- What is the best practise to call a Java program (which has either to cache a lot of data or just call a DB2 when it's needed) from a COBOL CICS program?
- The redbook (https://www.redbooks.ibm.com/redbooks/pdfs/sg248116.pdf) seems to connect/bind/link COBOL CICS with JCL to Java running on UNIX?

Thanks in advance!
zbius
 
Posts: 5
Joined: Mon Nov 04, 2024 5:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java program on UNIX/USS from a COBOL CICS progr

Postby zbius » Tue Nov 05, 2024 8:29 pm

One idea that I had was to run COBOL with Java in a z/OS batch environment and then to call the batch program from a cobol pgm. See New Ways of Running IBM z/OS Batch Applications: https://www.redbooks.ibm.com/redbooks/pdfs/sg248116.pdf

Turns out that you can't do that when you're using SQL I/O in the batch... (I need to get data from a DB2 with the Java program or even worse get data via RESTful service and "cache" them.)
At least this information is from the EGL documentation but I guess that counts for all of the z/OS.

Sharing called programs between environments
Programs generated for IMS/VS, BMP, and z/OS® CICS® can call subprograms generated for the z/OS batch environment. You must ensure that the z/OS batch program does not do any SQL I/O, file I/O, or batch-environment-specific calls, as these will not be allowed from the original environment. For example, as CICS owns all file I/O access, it will not allow batch-type file access to execute. Programs that are generated for z/OS batch but are called by logic running in other environments are typically limited to operations such as calculations and table lookups.
https://www.ibm.com/docs/en/rbd/9.6?top ... vironments
zbius
 
Posts: 5
Joined: Mon Nov 04, 2024 5:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java program on UNIX/USS from a COBOL CICS progr

Postby zbius » Wed Nov 06, 2024 6:02 pm

What so far seems to work according to the IBM documentation:
- Java and COBOL on z/OS USS (UNIX)
- Java and COBOL on z/OS Batch Runtime
- Java and COBOL-CICS with a JVM Server (e.g. Liberty)

... since we don't want network delay, all of those options won't work for us.

Optimal would be:
- Java and COBOL-CICS via the same data storage / as (dynamic) CALL.

Compiling Java and COBOL on the z/OS USS / UNIX might work for COBOL-CICS -> DLL (COBOL program on the z/OS USS) -> Java? I have no clue how MVS data sets interact with CICS (regions, I guess?).

"[...]
If the DLL is output to an MVS data set, the DLL will appear as a member in that data set with the name LIBAPP1. [...]"
https://www.ibm.com/docs/en/cobol-zos/6 ... from-cobol

+

Description from CICS Transaction Server for z/OS 5.6: (with 6.x there will be a kinda different description)
"The CICS® shared data table facility is an extension of the CICS file management services. Using shared data tables, all files that are defined as data tables can potentially be shared using cross-memory services. No changes are required to the file definitions for existing data tables.

The concept of shared data tables exploits the fact that it is more efficient:
To use MVS™ cross-memory services instead of CICS function shipping to share a file of data between two or more CICS regions in the same MVS image.
To access data from memory instead of from DASD.
To access a file of data from memory using services integrated within CICS file management instead of using VSAM services and a local shared resource (LSR) pool."
https://www.ibm.com/docs/en/cics-ts/5.6 ... ata-tables

+

"The data table records are stored in one or more MVS™ data spaces, whether the data table is to be shared by more than one region or not. A separate set of data spaces is used for each CICS® region."
https://www.ibm.com/docs/en/cics-ts/6.x ... paces-data

...which leaves me even more confused.
Is there a way to access MVS data sets/members (the DLL) from COBOL-CICS?
zbius
 
Posts: 5
Joined: Mon Nov 04, 2024 5:16 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post