Calling Java from Enterprise COBOL program



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

Calling Java from Enterprise COBOL program

Postby danik56 » Tue May 23, 2017 2:34 am

I understand it is possible to call Java classes from COBOL programs using the INVOKE command. I have seen the example in the Prog.Guide.
I need some clarification on passing parameters to Java and returning values from Java.
Is it possible to pass pointer variables to Java? (an address pointing to some storage structure)
The goal is to convert some CPU intensive subroutines into Java classes in order to leverage the Zaap processor.
Is there any useful documentation on this subject ?
danik56
 
Posts: 22
Joined: Tue May 23, 2017 2:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java from Enterprise COBOL program

Postby Robert Sample » Tue May 23, 2017 3:16 am

The Language Reference manual is pretty clear on how pointer variables can be used:
A pointer data item can be used only:
v In a SET statement (format 5 only)
v In a relation condition
v In the USING phrase of a CALL statement, an ENTRY statement, or the PROCEDURE DIVISION header
Since INVOKE is not listed, I tested and found a compile error occurs when you use a pointer with INVOKE.

In general, the manuals lay out how COBOL can interact with Java -- arrays and simple (not group anything) variables are the main things to look at for the interactions.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Calling Java from Enterprise COBOL program

Postby danik56 » Wed May 24, 2017 12:37 pm

Suppose we re-write an existing CPU intensive COBOL application in Java. (pure CPU, no I/O involved)
What kind of overhead can we expect vs the existing COBOL code ? is the benefit of leveraging the ZAAP worth the effort ?
danik56
 
Posts: 22
Joined: Tue May 23, 2017 2:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java from Enterprise COBOL program

Postby Robert Sample » Wed May 24, 2017 8:49 pm

As always with capacity planning, YMMV. Also, note that starting with the z13 machine, zAAP work is run on the zIIP engine (that is, as of the z13 there is no longer a zAAP processor). Hence my comments are focused on zIIP not zAAP.

There is an IEAOPTxx parameter, PROJECTCPU=YES, which will identify work that could be offloaded to the zIIP. I'm not sure which release of z/OS this was introduced in but it could give you some indication of what could move. A system programmer would need to implement it on your system but if you're thinking about moving work from the CP to zIIP, it could be a good parameter to set.

As far as the benefit, it's hard to predict without a lot of performance data about the application. The CP load will NOT go to zero as the Java code running on the zIIP will require some support from the CP. However, if you're running a system that is throttled back (which many systems are), the zIIP runs at the full speed of the processor, so zIIP processing will run faster in many cases. I've seen studies indicating a 25% use of the zIIP is cost-effective. However, as I said it is hard to predict what amount of code any given application will be able to move to zIIP processors. And the question also is, how much effort is required? If it's going to take 10 person-years of effort to rewrite the COBOL code into Java, then it is unlikely your organization would EVER recoup the conversion costs, no matter what the difference is.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Calling Java from Enterprise COBOL program

Postby danik56 » Wed May 24, 2017 10:07 pm

I think I understand in general the Pro's and Con's, and development effort is also a factor, but management seems to think that down the road supporting Java code would be more practical than supporting COBOL code.
And in addition the incentive to save on processor cost by moving more workload to the ZIIPs is another factor in favor.
I understand it is hard to predict how much overhead in CPU cycles Java will bring to the table, but that may be balanced by the ZIIP running at full speed.
If there are any real world case studies on this subject, I'll be looking for those.
danik56
 
Posts: 22
Joined: Tue May 23, 2017 2:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java from Enterprise COBOL program

Postby prino » Thu May 25, 2017 12:34 am

danik56 wrote:Suppose we re-write an existing CPU intensive COBOL application in Java. (pure CPU, no I/O involved)
What kind of overhead can we expect vs the existing COBOL code ? is the benefit of leveraging the ZAAP worth the effort ?

Suppose you use a profiler to actually find out why your code uses so much CPU?

I'm clueless about COBOL, but I have a hell of a lot of knowledge of PL/I, and I know there are some language features in PL/I that, when used indiscriminately, used to completely take the CPU use to 100% - things are getting better with newer releases of Enterprise PL/I, but it's still possible to use features to send CPU use into the sky.

One "feature" that sends CPU through the roof using PL/I is to call lots of procedures calling lots of procedures calling lots of procedures, and all of them using lots of local variables, and then using the LE option "STORAGE(whatever,whatever,0,whatever)"...
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Calling Java from Enterprise COBOL program

Postby Robert Sample » Thu May 25, 2017 3:00 am

I found one study on Software AG's Natural product at http://it.toolbox.com/blogs/mainframe-w ... ziip-75754 and it gives a figure of 110% of the CP CPU required when running with a zIIP; in this specific case the zIIP was using about 80% of the CPU time, so the CP CPU time dropped to 22% of the original total.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Calling Java from Enterprise COBOL program

Postby danik56 » Thu May 25, 2017 3:13 am

Robert Sample wrote:I found one study on Software AG's Natural product at http://it.toolbox.com/blogs/mainframe-w ... ziip-75754 and it gives a figure of 110% of the CP CPU required when running with a zIIP; in this specific case the zIIP was using about 80% of the CPU time, so the CP CPU time dropped to 22% of the original total.


Thanks !!
danik56
 
Posts: 22
Joined: Tue May 23, 2017 2:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java from Enterprise COBOL program

Postby danik56 » Thu May 25, 2017 11:09 pm

In addition to my opening question, I'm looking for reference/guide material on how to interface to Java programs from COBOL-CICS programs.
Would this be even possible ?
danik56
 
Posts: 22
Joined: Tue May 23, 2017 2:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Java from Enterprise COBOL program

Postby Robert Sample » Fri May 26, 2017 12:43 am

IBM has manuals on using Java in CICS directly. And they have manuals on Java calling COBOL and vice versa (but all the examples are batch not CICS). I haven't seen anything on CICS COBOL programs calling Java programs.

You may want to talk to IBM about whether or not what you want to do is possible and if so which manual / Redbook discusses the approach. If it is possible, your site may have to implement WebSphere Liberty in your CICS region(s) to be able to use the programs.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post