Discussion:
COBOL calling Java - S922 error
Add Reply
Farley, Peter x23353
2017-09-10 14:19:54 UTC
Reply
Permalink
Raw Message
I found the following link courtesy of google with a COBOL-calling-Java example for COBOL V4.2 calling Java 6.0:

http://www-01.ibm.com/support/docview.wss?uid=swg27020750

The JCL/Source and listing texts were pretty self-explanatory, though the COBOL source in the example failed to include the required SET statements using JNIEnvPtr:

Set address of JNIEnv to JNIEnvPtr
Set address of JNINativeInterface to JNIEnv

Which I added. I updated the ENV6 environment settings (and renamed it to ENV7) to use J7.0 instead of J6.0 and added a setting for JAVA_HOME to the J7.0 directory.

We are at z/OS V2.1, and as far as I can tell we have Java SDK7.0 installed, though the default paths are set to J7.0_64 not J7.0.

Telnet shell invocation of "java -version" after setting JAVA_HOME and paths to J7.0 instead of J7.0_64 returns the following:

java version "1.7.0"
Java(TM) SE Runtime Environment (build pmz3170sr10fp5-20170421_01(SR10 FP5))
IBM J9 VM (build 2.6, JRE 1.7.0 z/OS s390-31 20170407_343227 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR10_20170407_0035_B343227
JIT - r11_20170407_343227
GC - R26_Java726_SR10_20170407_0035_B343227
J9CL - 20170407_343227)
JCL - 20170420_01 based on Oracle jdk7u141-b11

I compiled the two Java example programs with J7.0 and not J7.0_64.

When the GO step in the example tries to run, I get a S922 abend for "SYSTEM ERROR IN INITIATOR". Error messages from the log are pasted below. No CEE output at all except the LE U4083 abend in the log.

Did anyone else ever get this COBOL-calling-Java example to run using J7.0? If so, what else did you have to change to make it work?

TIA for any help or pointers you can provide.

Peter


Abend S922 error messages:

587 USER COMPLETION CODE=4083 REASON CODE=00000015
587 TIME=14.18.39 SEQ=32502 CPU=0000 ASID=03B4
587 PSW AT TIME OF ERROR 078D1F00 B6A2E1FC ILC 2 INTC 0D
587 ACTIVE LOAD MODULE ADDRESS=36816500 OFFSET=00217CFC
587 NAME=CEEPLPKA
587 DATA AT PSW 36A2E1F6 - 00181610 0A0D9602 E01A58B0
587 GR 0: 84000000 1: 84000FF3
587 2: 379656D8 3: 378A5FA8
587 4: 3680B7E8 5: 00003500
587 6: 00000000 7: 0000F39C
587 8: 3680B7C4 9: 3680B7AC
587 A: 368138B0 B: 368E81F0
587 C: 36815188 D: 3680B6C8
587 E: 3680AFC8 F: 00000015
587 END OF SYMPTOM DUMP
14.18.39 JOB64693 BPXP018I THREAD 37008E0000000000, IN PROCESS 83889710, ENDED 588
588 WITHOUT BEING UNDUBBED WITH COMPLETION CODE 84000FF3
588 , AND REASON CODE 00000015.
14.18.39 JOB64693 IEC999I IGG0201W,TSOUSERZ,GO
14.18.40 JOB64693 IEA794I SVC DUMP HAS CAPTURED: 624
624 DUMPID=028 REQUESTED BY JOB (TSOUSERZ)
624 DUMP TITLE=IEC999I IFG0RR0A, ,TSOUSERZ,GO ,WORKAREA
14.18.40 JOB64693 IEF187I TSOUSERZ FAILED - SYSTEM ERROR IN INITIATOR
624 = 9AD900
14.18.40 JOB64693 IEF450I TSOUSERZ GO - ABEND=S922 U0000 REASON=00000000 626
--


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Allan Kielstra
2017-09-11 17:08:25 UTC
Reply
Permalink
Raw Message
I did get this to work using USS. I had to change the following calls:

Call "IBMZOS_NewStringPlatform"
Call "IBMZOS_NewStringPlatform"
CALL 'IBMZOS_GetStringPlatformLength'
CALL 'IBMZOS_GetStringPlatform'

(I don't know why that change was made, but it was)

Here is my Makefile:
PROG = IBMEXAM2
CLASSFILES = HelloJ.class IBMExample2.class
JAVABASE = /usr/lpp/java/IBM/J7.1
COBBASE = /usr/lpp/cobol/igy420

run: $(PROG) $(CLASSFILES)
_CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=$(JAVABASE)/lib/s390:$(JAVABASE)/bin/classic ./$(PROG)

%.class: %.java
$(JAVABASE)/bin/javac $^

$(PROG): $(PROG).o
$(COBBASE)/bin/cob2 -o $(PROG) $(PROG).o $(JAVABASE)/lib/s390/libjava.x $(COBBASE)/lib/igzcjava.x

%.o: %.cbl
$(COBBASE)/bin/cob2 -c -I $(COBBASE)/include $^

clean:
rm -f *.class $(PROG) $(PROG).o

Here is what happens when I type gmake run
make clean run
rm -f *.class IBMEXAM2 IBMEXAM2.o
/usr/lpp/cobol/igy420/bin/cob2 -c -I /usr/lpp/cobol/igy420/include IBMEXAM2.cbl
PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0 in progress ...
End of compilation 1, program IBMEXAM2, no statements flagged.
/usr/lpp/cobol/igy420/bin/cob2 -o IBMEXAM2 IBMEXAM2.o /usr/lpp/java/IBM/J7.1/lib/s390/libjava.x /usr/lpp/cobol/igy420/lib/igzcjava.x
/usr/lpp/java/IBM/J7.1/bin/javac HelloJ.java
/usr/lpp/java/IBM/J7.1/bin/javac IBMExample2.java
_CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=/usr/lpp/java/IBM/J7.1/lib/s390:/usr/lpp/java/IBM/J7.1/bin/classic ./IBMEXAM2
B100-INITIALISE.
B200-INIT-INPUT-VALUES
Call "NewStringPlatform" inStringBuf.....
B300-INIT-OUTPUT-VALUES
Call "NewStringPlatform" outStringBuf.....
C100-MAIN.
About to call HelloJ
Hello World, from Java! 2
Returned from sayHello data2 = 000003
About to call IBMExample2 & pass a string
IBM Example input = Hello
IBM Example output = HelloAdded Text
Just returned from JAVA
Method:GetStringPlatformLength returned (0000000016)
Method:GetStringPlatformString returned (HelloAdded Text^@)
STOP RUN.

I haven't tried it using JCL.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Farley, Peter x23353
2017-09-12 05:34:10 UTC
Reply
Permalink
Raw Message
Thanks Alan, but I do not have J7.1 available. I also notice you are using "lib/s390" for the "libjvm.x" binder input and for the LIBPATH, but in my J7.0 directory I only have "libjvm.x" and "linjvm.so" in "J7.0/lib/s390/classic" and also in "J7.0/lib/s390/j9vm".

Which one do you think I should be using for J7.0, "classic" or "j9vm"?

Also, if it is not too sensitive, what does your $PATH look like during your execution? I am initially trying this from JCL as in the original example, so I was thinking my STEPLIB may need to match the right $PATH settings.

I will try your make from a telnet shell tomorrow if I can find some time. I haven't done that before in a z/OS shell, so for expedience I may have to turn the make steps into a simpler shell script to start with.

Thanks again very much for your help.

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Allan Kielstra
Sent: Monday, September 11, 2017 1:10 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: COBOL calling Java - S922 error

I did get this to work using USS. I had to change the following calls:

Call "IBMZOS_NewStringPlatform"
Call "IBMZOS_NewStringPlatform"
CALL 'IBMZOS_GetStringPlatformLength'
CALL 'IBMZOS_GetStringPlatform'

(I don't know why that change was made, but it was)

Here is my Makefile:
PROG = IBMEXAM2
CLASSFILES = HelloJ.class IBMExample2.class
JAVABASE = /usr/lpp/java/IBM/J7.1
COBBASE = /usr/lpp/cobol/igy420

run: $(PROG) $(CLASSFILES)
_CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=$(JAVABASE)/lib/s390:$(JAVABASE)/bin/classic ./$(PROG)

%.class: %.java
$(JAVABASE)/bin/javac $^

$(PROG): $(PROG).o
$(COBBASE)/bin/cob2 -o $(PROG) $(PROG).o $(JAVABASE)/lib/s390/libjava.x $(COBBASE)/lib/igzcjava.x

%.o: %.cbl
$(COBBASE)/bin/cob2 -c -I $(COBBASE)/include $^

clean:
rm -f *.class $(PROG) $(PROG).o

Here is what happens when I type gmake run
make clean run
rm -f *.class IBMEXAM2 IBMEXAM2.o
/usr/lpp/cobol/igy420/bin/cob2 -c -I /usr/lpp/cobol/igy420/include IBMEXAM2.cbl
PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0 in progress ...
End of compilation 1, program IBMEXAM2, no statements flagged.
/usr/lpp/cobol/igy420/bin/cob2 -o IBMEXAM2 IBMEXAM2.o /usr/lpp/java/IBM/J7.1/lib/s390/libjava.x /usr/lpp/cobol/igy420/lib/igzcjava.x
/usr/lpp/java/IBM/J7.1/bin/javac HelloJ.java
/usr/lpp/java/IBM/J7.1/bin/javac IBMExample2.java
_CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=/usr/lpp/java/IBM/J7.1/lib/s390:/usr/lpp/java/IBM/J7.1/bin/classic ./IBMEXAM2
B100-INITIALISE.
B200-INIT-INPUT-VALUES
Call "NewStringPlatform" inStringBuf.....
B300-INIT-OUTPUT-VALUES
Call "NewStringPlatform" outStringBuf.....
C100-MAIN.
About to call HelloJ
Hello World, from Java! 2
Returned from sayHello data2 = 000003
About to call IBMExample2 & pass a string
IBM Example input = Hello
IBM Example output = HelloAdded Text
Just returned from JAVA
Method:GetStringPlatformLength returned (0000000016)
Method:GetStringPlatformString returned (HelloAdded Text^@)
STOP RUN.

I haven't tried it using JCL.

----------------------------------------------------------------------


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Allan Kielstra
2017-09-12 16:40:59 UTC
Reply
Permalink
Raw Message
(It's Allan, not Alan. But that is a common mistake.)

I changed the Java to /usr/lpp/java/IBM/J7.0 and I also changed the run step to set PATH= (That is, PATH has no members in it when I run the program). And, as luck would have it, my program still works. I also ran the program in a script where first I unset every single environment variable.

Assuming that the COBOL compiler and Java are installed in the standard places, the shell script should look like:

#! /bin/bash

/usr/lpp/cobol/igy420/bin/cob2 -c -I /usr/lpp/cobol/igy420/include IBMEXAM2.cbl
/usr/lpp/cobol/igy420/bin/cob2 -o IBMEXAM2 IBMEXAM2.o /usr/lpp/java/IBM/J7.0/lib/s390/libjava.x /usr/lpp/cobol/igy420/lib/igzcjava.x
/usr/lpp/java/IBM/J7.0/bin/javac HelloJ.java
/usr/lpp/java/IBM/J7.0/bin/javac IBMExample2.java
PATH= _CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=/usr/lpp/java/IBM/J7.0/lib/s390:/usr/lpp/java/IBM/J7.0/bin/classic ./IBMEXAM2

Ug... There are five lines of commands but lines 2 and 5 may be wrapped in the text above.

One question I have is: what are your LE options? In particular, is XPLINK(ON) specified?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Kirk Wolf
2017-09-12 17:03:54 UTC
Reply
Permalink
Raw Message
Hi Allan,

AFAIK, mounting the JVM filesystems under /usr/lpp/java/IBM instead of
/usr/lpp/java is *not* standard, but you should of course change the JCL to
match how your installation has it.
Post by Allan Kielstra
One question I have is: what are your LE options? In particular, is XPLINK(ON) specified?
absolutely everything in my example is included in this one JCL file,
except of course the com.ibm.jzos.sample.HelloWorld jar.
For LE options, see the GO step CEEOPTS DD statement.



Kirk Wolf
Dovetailed Technologies
http://dovetail.com
Post by Allan Kielstra
(It's Allan, not Alan. But that is a common mistake.)
I changed the Java to /usr/lpp/java/IBM/J7.0 and I also changed the run
step to set PATH= (That is, PATH has no members in it when I run the
program). And, as luck would have it, my program still works. I also ran
the program in a script where first I unset every single environment
variable.
Assuming that the COBOL compiler and Java are installed in the standard
#! /bin/bash
/usr/lpp/cobol/igy420/bin/cob2 -c -I /usr/lpp/cobol/igy420/include IBMEXAM2.cbl
/usr/lpp/cobol/igy420/bin/cob2 -o IBMEXAM2 IBMEXAM2.o
/usr/lpp/java/IBM/J7.0/lib/s390/libjava.x /usr/lpp/cobol/igy420/lib/
igzcjava.x
/usr/lpp/java/IBM/J7.0/bin/javac HelloJ.java
/usr/lpp/java/IBM/J7.0/bin/javac IBMExample2.java
PATH= _CEE_RUNOPTS="XPLINK(ON)" CLASSPATH=. LIBPATH=/usr/lpp/java/IBM/J7.
0/lib/s390:/usr/lpp/java/IBM/J7.0/bin/classic ./IBMEXAM2
Ug... There are five lines of commands but lines 2 and 5 may be wrapped in the text above.
One question I have is: what are your LE options? In particular, is XPLINK(ON) specified?
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Allan Kielstra
2017-09-12 20:01:05 UTC
Reply
Permalink
Raw Message
(The machine I am using has many versions of Java; hence the extra directory) In my installation, I actually have 5(!) copies of J7.0 libjvm.so. Four of them (bin/j9vm, bin/classic, lib/s390/j9vm, lib/s390/classic) are identical. The fifth (lib/s390/default) is well over twice as large so I assume that it is the same thing compiled with different options such as TEST. It doesn't matter which one I use (they all seem to work.)

Also, I have the latest LE PTFs for the COBOL run time. (Though I can't think of anything recent in there that would make a difference.)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Peter Hunkeler
2017-09-13 05:36:04 UTC
Reply
Permalink
Raw Message
The FM sais for S922, that the problem occurred before the initiator could hand over control to your program, or after the program has returned. Since you got some LE messages (and the LE FRR is in in effect), I understand Java go control. Then something happened, and the FM sais you should get n SVD dump and a LOGREC entry for the initial problem.
Have you looked at those? Maybe you get a hint on what had happened that cause the initiator to issue the 922 ABEND.
Search the system trace in the dump for any error type entries before the S922.


Rerun the job with a CEEOPTS DD specifying TRAP(OFF) to switch off LE error handling. Might give you some hints that LE error supresses.
--
Peter Hunkeler




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Loading...