Re: Running an MVS executable using a .so library

2016-03-31 Thread Paul Gilmartin
On Wed, 30 Mar 2016 16:54:46 -0500, Janet Graff wrote:
>
>...  ISTR that mixing MVS and USS files on a DD allocation is not allowed but 
>I'm not sure how else to do this?
> 
It is allowed for HLASM SYSLIB.  Binder explicitly prohibits any UNIX directory 
in
a concatenation.  It sort of works but is unsupported for SYSEXEC.  I haven't
tried it in STEPLIB; I'd bet against it.

It usually works for sequential data sets except that some persnickety utilities
perform a gratuitous check on device type and reject UNIX files.  Some of those
such as AMATERSE can be fooled by preconcatenating an empty temp PS data set.
I believe IEBCOPY will not accept any UNIX file as PDSU.
 
>// DD  PATH='/u/Java6_31/J6.0/bin/j9vm/',
> ...
>Also I'm not sure if the ending slash is necessary.  ...
> 
It has no effect on a directory; it's prohibited on a basefile (which your 
example
seems to be -- I'd expect an allocation failure).  It might be used to force an 
error
if a basefile is inadvertently supplied where a directory is expected.

-- gil

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


Re: Running an MVS executable using a .so library

2016-03-31 Thread Scott Ford
Janet,

I would be very interested on the performance of the JVM and if Java is
involved with interllanguage type calls..

Regards,

Scott
Idmworks

On Wednesday, March 30, 2016, Janet Graff <
004dc9e91b6d-dmarc-requ...@listserv.ua.edu> wrote:

> This was the problem.  Apparently I didn't need to specify a classpath.
>
> I changed the code to
>
> JNIEnv* create_vm(JavaVM **jvm)
> {
> JNIEnv* env;
> JavaVMInitArgs args;
> JavaVMOption options;
> args.version = JNI_VERSION_1_6;
> args.nOptions = 0;
> args.options = 
> args.ignoreUnrecognized = 0;
> int rv;
> rv = JNI_CreateJavaVM(jvm, (void**), );
> if (rv < 0 || !env)
> printf("Unable to Launch JVM %d\n",rv);
> else
> printf("Launched JVM! :)\n");
> return env;
> }
>
> and now the JVM comes up!
>
> Thank you all for your help!
> Janet
> >Why does the JNI_CreateJavaVM have a classpath?  Isn't there one already
> specified in the _CEE_ENVFILE?  Maybe I don't need this?
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu  with the message:
> INFO IBM-MAIN
>

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
This was the problem.  Apparently I didn't need to specify a classpath.

I changed the code to

JNIEnv* create_vm(JavaVM **jvm)
{  
JNIEnv* env;   
JavaVMInitArgs args;   
JavaVMOption options;  
args.version = JNI_VERSION_1_6;
args.nOptions = 0; 
args.options =
args.ignoreUnrecognized = 0;   
int rv;
rv = JNI_CreateJavaVM(jvm, (void**), );   
if (rv < 0 || !env)
printf("Unable to Launch JVM %d\n",rv);
else   
printf("Launched JVM! :)\n");  
return env;
}  

and now the JVM comes up!

Thank you all for your help!
Janet
>Why does the JNI_CreateJavaVM have a classpath?  Isn't there one already 
>specified in the _CEE_ENVFILE?  Maybe I don't need this?

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
Heres' the C source code calling JNI_CreateJavaVM that is getting the "Unable 
to Launch JVM -6".  I pretty much copied it from various web pages on "how to 
call JNI from C".

Why does the JNI_CreateJavaVM have a classpath?  Isn't there one already 
specified in the _CEE_ENVFILE?  Maybe I don't need this?



JNIEnv* create_vm(JavaVM **jvm)
{  
JNIEnv* env;   
JavaVMInitArgs args;   
JavaVMOption options;  
args.version = JNI_VERSION_1_6;
args.nOptions = 1; 
options.optionString = 
 "-Djava.class.path=.:/u/vendor/jig/DOZAPI3";  
args.options =
args.ignoreUnrecognized = 0;   
int rv;
rv = JNI_CreateJavaVM(jvm, (void**), );   
if (rv < 0 || !env)
printf("Unable to Launch JVM %d\n",rv);
else   
printf("Launched JVM! :)\n");  
return env;
}  

Janet

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread David Crayford
Drop the export. It's not a shell script. I'm surprised that parsed??

> On 31 Mar 2016, at 8:10 AM, Janet Graff 
> <004dc9e91b6d-dmarc-requ...@listserv.ua.edu> wrote:
> 
> David,
> 
> my _CEE_ENVFILE file  contains
> 
> export JAVA_HOME=/u/Java6_31/J6.0
> 
> I'm not sure if the export statement is necessary here.
> 
> Janet
> 
>> Do you need to set the JAVA_HOME environment variable to point to the JVM?
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
clearly not as that constant isn't even defined in the jni.h.  I'll stick with 
JNI_VERSION_1_6.

Janet

>ooh my JNI_CreateJavaVM has a options string.  I'm currently passing 

>args.version = JNI_VERSION_1_6; 

>maybe that's was JNI_ENOINVAL?

>How do I determine what the proper version is of this call?

>Since my classpath has /u/Java6_31/J6.0... I'm assuming I'm running 
>JNI_VERSION_6_31 but I've no idea if that's actually how these things work.

>Janet

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
David,

my _CEE_ENVFILE file  contains

export JAVA_HOME=/u/Java6_31/J6.0

I'm not sure if the export statement is necessary here.

Janet

>Do you need to set the JAVA_HOME environment variable to point to the JVM?

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
ooh my JNI_CreateJavaVM has a options string.  I'm currently passing 

args.version = JNI_VERSION_1_6; 

maybe that's was JNI_ENOINVAL?

How do I determine what the proper version is of this call?

Since my classpath has /u/Java6_31/J6.0... I'm assuming I'm running 
JNI_VERSION_6_31 but I've no idea if that's actually how these things work.

Janet

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread David Crayford

Do you need to set the JAVA_HOME environment variable to point to the JVM?

On 31/03/2016 7:16 AM, Janet Graff wrote:

Frank,

That was magnificent and got me past my problem.

Unfortunately I now get "Unable to Launch JVM -6 ".

Which I believe is JNI_EINVAL which I believe means the JVM isn't running.

I've been googling around and I haven't found how to tell if the JVM is running 
on z/OS.  When I installed Rational Developer I made sure that RSED and some 
other job was running but clearly I missed the JVM itself?

Can someone point me to the z/OS JVM manual?

Janet


I think you need a LIBPATH environment variable to point to it
I got the following from the Enterprise COBOL manual:
http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpooo10e.htm
http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpooo08.htm
//RUN EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),
// PARM='ENVAR("_CEE_ENVFILE=/u/userid/javaenv") POSIX(ON)/'
//STEPLIB DD DISP=SHR,DSN=JIG.BASE710.LOAD
// DD DISP=SHR,DSN=CEE.SCEERUN
// DD DISP=SHR,DSN=CEE.SCEERUN2
/u/userid/javaenv would be a Unix file with something like the following:
PATH=/bin:/u/Java6_31/J6.0/bin
LIBPATH=/lib:/usr/lib:/u/Java6_31/J6.0/bin:/u/Java6_31/J6.0/bin/j9vm
CLASSPATH=/u/userid/[something]
Note that I added SCEERUN2 to your STEPLIB.  Not sure if it's necessary, but 
its in the example.
Looks like you may also need to have DD's named JAVAIN, JAVAOUT and JAVAERR, as 
detailed in the second link above.

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


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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
Frank,

That's the right idea, unfortuantely it was the JNI_CreateJavaVM() invocation 
that got the JNI_EINVAL.  So I'm lost how, on z/OS, to get the 
JNI_CreateJavaVM() call to work.

Janet

>Does this help?
>http://www.developer.com/java/data/how-to-create-a-jvm-instance-in-jni.html

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Frank Swarbrick



Does this help?
http://www.developer.com/java/data/how-to-create-a-jvm-instance-in-jni.html

> Date: Wed, 30 Mar 2016 17:21:20 -0600
> From: frank.swarbr...@outlook.com
> Subject: Re: Running an MVS executable using a .so library
> To: IBM-MAIN@LISTSERV.UA.EDU
> 
> Don't you need to do "something" in your program to start up a JVM in your 
> address space?
> 
> With Enterprise COBOL this is to "automagically", so I'm not quite sure how 
> to do it in another language.
> 
> > Date: Wed, 30 Mar 2016 18:16:17 -0500
> > From: 004dc9e91b6d-dmarc-requ...@listserv.ua.edu
> > Subject: Re: Running an MVS executable using a .so library
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > 
> > Frank,
> > 
> > That was magnificent and got me past my problem.
> > 
> > Unfortunately I now get "Unable to Launch JVM -6 ".
> > 
> > Which I believe is JNI_EINVAL which I believe means the JVM isn't running.
> > 
> > I've been googling around and I haven't found how to tell if the JVM is 
> > running on z/OS.  When I installed Rational Developer I made sure that RSED 
> > and some other job was running but clearly I missed the JVM itself?
> > 
> > Can someone point me to the z/OS JVM manual?
> > 
> > Janet
> > 
> > >I think you need a LIBPATH environment variable to point to it
> > 
> > >I got the following from the Enterprise COBOL manual:
> > 
> > >http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpooo10e.htm
> > >http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpooo08.htm
> > 
> > >//RUN EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),
> > >// PARM='ENVAR("_CEE_ENVFILE=/u/userid/javaenv") POSIX(ON)/'
> > >//STEPLIB DD DISP=SHR,DSN=JIG.BASE710.LOAD
> > >// DD DISP=SHR,DSN=CEE.SCEERUN
> > >// DD DISP=SHR,DSN=CEE.SCEERUN2
> > 
> > >/u/userid/javaenv would be a Unix file with something like the following:
> > >PATH=/bin:/u/Java6_31/J6.0/bin
> > >LIBPATH=/lib:/usr/lib:/u/Java6_31/J6.0/bin:/u/Java6_31/J6.0/bin/j9vm
> > >CLASSPATH=/u/userid/[something]
> > 
> > >Note that I added SCEERUN2 to your STEPLIB.  Not sure if it's necessary, 
> > >but its in the example.
> > >Looks like you may also need to have DD's named JAVAIN, JAVAOUT and 
> > >JAVAERR, as detailed in the second link above.
> > 
> > --
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Frank Swarbrick
Don't you need to do "something" in your program to start up a JVM in your 
address space?

With Enterprise COBOL this is to "automagically", so I'm not quite sure how to 
do it in another language.

> Date: Wed, 30 Mar 2016 18:16:17 -0500
> From: 004dc9e91b6d-dmarc-requ...@listserv.ua.edu
> Subject: Re: Running an MVS executable using a .so library
> To: IBM-MAIN@LISTSERV.UA.EDU
> 
> Frank,
> 
> That was magnificent and got me past my problem.
> 
> Unfortunately I now get "Unable to Launch JVM -6 ".
> 
> Which I believe is JNI_EINVAL which I believe means the JVM isn't running.
> 
> I've been googling around and I haven't found how to tell if the JVM is 
> running on z/OS.  When I installed Rational Developer I made sure that RSED 
> and some other job was running but clearly I missed the JVM itself?
> 
> Can someone point me to the z/OS JVM manual?
> 
> Janet
> 
> >I think you need a LIBPATH environment variable to point to it
> 
> >I got the following from the Enterprise COBOL manual:
> 
> >http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpooo10e.htm
> >http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpooo08.htm
> 
> >//RUN EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),
> >// PARM='ENVAR("_CEE_ENVFILE=/u/userid/javaenv") POSIX(ON)/'
> >//STEPLIB DD DISP=SHR,DSN=JIG.BASE710.LOAD
> >// DD DISP=SHR,DSN=CEE.SCEERUN
> >// DD DISP=SHR,DSN=CEE.SCEERUN2
> 
> >/u/userid/javaenv would be a Unix file with something like the following:
> >PATH=/bin:/u/Java6_31/J6.0/bin
> >LIBPATH=/lib:/usr/lib:/u/Java6_31/J6.0/bin:/u/Java6_31/J6.0/bin/j9vm
> >CLASSPATH=/u/userid/[something]
> 
> >Note that I added SCEERUN2 to your STEPLIB.  Not sure if it's necessary, but 
> >its in the example.
> >Looks like you may also need to have DD's named JAVAIN, JAVAOUT and JAVAERR, 
> >as detailed in the second link above.
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
  
--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
Frank,

That was magnificent and got me past my problem.

Unfortunately I now get "Unable to Launch JVM -6 ".

Which I believe is JNI_EINVAL which I believe means the JVM isn't running.

I've been googling around and I haven't found how to tell if the JVM is running 
on z/OS.  When I installed Rational Developer I made sure that RSED and some 
other job was running but clearly I missed the JVM itself?

Can someone point me to the z/OS JVM manual?

Janet

>I think you need a LIBPATH environment variable to point to it

>I got the following from the Enterprise COBOL manual:

>http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpooo10e.htm
>http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpooo08.htm

>//RUN EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),
>// PARM='ENVAR("_CEE_ENVFILE=/u/userid/javaenv") POSIX(ON)/'
>//STEPLIB DD DISP=SHR,DSN=JIG.BASE710.LOAD
>// DD DISP=SHR,DSN=CEE.SCEERUN
>// DD DISP=SHR,DSN=CEE.SCEERUN2

>/u/userid/javaenv would be a Unix file with something like the following:
>PATH=/bin:/u/Java6_31/J6.0/bin
>LIBPATH=/lib:/usr/lib:/u/Java6_31/J6.0/bin:/u/Java6_31/J6.0/bin/j9vm
>CLASSPATH=/u/userid/[something]

>Note that I added SCEERUN2 to your STEPLIB.  Not sure if it's necessary, but 
>its in the example.
>Looks like you may also need to have DD's named JAVAIN, JAVAOUT and JAVAERR, 
>as detailed in the second link above.

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


Re: Running an MVS executable using a .so library

2016-03-30 Thread Frank Swarbrick



I think you need a LIBPATH environment variable to point to it

I got the following from the Enterprise COBOL manual:

http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpooo10e.htm
http://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpooo08.htm

//RUN EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),
// PARM='ENVAR("_CEE_ENVFILE=/u/userid/javaenv") POSIX(ON)/'
//STEPLIB DD DISP=SHR,DSN=JIG.BASE710.LOAD
// DD DISP=SHR,DSN=CEE.SCEERUN
// DD DISP=SHR,DSN=CEE.SCEERUN2

/u/userid/javaenv would be a Unix file with something like the following:
PATH=/bin:/u/Java6_31/J6.0/bin
LIBPATH=/lib:/usr/lib:/u/Java6_31/J6.0/bin:/u/Java6_31/J6.0/bin/j9vm
CLASSPATH=/u/userid/[something]

Note that I added SCEERUN2 to your STEPLIB.  Not sure if it's necessary, but 
its in the example.
Looks like you may also need to have DD's named JAVAIN, JAVAOUT and JAVAERR, as 
detailed in the second link above.

> Date: Wed, 30 Mar 2016 16:54:46 -0500
> From: 004dc9e91b6d-dmarc-requ...@listserv.ua.edu
> Subject: Running an MVS executable using a .so library
> To: IBM-MAIN@LISTSERV.UA.EDU
> 
> I am writing a C program to invoke the JVM to call an existing JNI package.  
> I have the program compiled and linked but I am having trouble getting 
> libjvm.so loaded at run time.
> 
> Is this the right STEPLIB?  ISTR that mixing MVS and USS files on a DD 
> allocation is not allowed but I'm not sure how else to do this?
> 
> //RUN  EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),  
> //PARM='POSIX(ON)/' 
> //STEPLIB  DD DISP=SHR,DSN=JIG.BASE710.LOAD  
> // DD DISP=SHR,DSN=CEE.SCEERUN   
> // DD  PATH='/u/Java6_31/J6.0/bin/j9vm/',
> //   PATHDISP=(KEEP,KEEP)
> //SYSTSPRT DD SYSOUT=*   
> //SYSPRINT DD SYSOUT=*   
> //SYSOUT   DD SYSOUT=*   
> //STDERR   DD SYSOUT=*   
> 
> CEE3501S The module libjvm.so was not found. 
> 
> Also I'm not sure if the ending slash is necessary.  I get the same result 
> whether it's there or not.  Is there a run time option that affects this?
> 
> Janet
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

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


Running an MVS executable using a .so library

2016-03-30 Thread Janet Graff
I am writing a C program to invoke the JVM to call an existing JNI package.  I 
have the program compiled and linked but I am having trouble getting libjvm.so 
loaded at run time.

Is this the right STEPLIB?  ISTR that mixing MVS and USS files on a DD 
allocation is not allowed but I'm not sure how else to do this?

//RUN  EXEC PGM=CALLJAVA,REGION=0M,COND=(4,LT),  
//PARM='POSIX(ON)/' 
//STEPLIB  DD DISP=SHR,DSN=JIG.BASE710.LOAD  
// DD DISP=SHR,DSN=CEE.SCEERUN   
// DD  PATH='/u/Java6_31/J6.0/bin/j9vm/',
//   PATHDISP=(KEEP,KEEP)
//SYSTSPRT DD SYSOUT=*   
//SYSPRINT DD SYSOUT=*   
//SYSOUT   DD SYSOUT=*   
//STDERR   DD SYSOUT=*   

CEE3501S The module libjvm.so was not found. 

Also I'm not sure if the ending slash is necessary.  I get the same result 
whether it's there or not.  Is there a run time option that affects this?

Janet

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