On 28/04/2017 9:13 AM, Andrew Rowley wrote:
On 28/04/2017 3:23 AM, Kirk Wolf wrote:
And yet I fail to see why this is an issue since the JZOS sample JCL shows
how to use the shell language to handle this - with more flexibility.

For example, the "java" command launcher can't do this:

for i in "${MYDIR}"/foo*.jar; do
     CLASSPATH="$CLASSPATH":"$i"
     done
I love JZOS, except for this shell script. I feel that a tailored shell script in every Java batch job is a major obstacle, because as you say "most Java users don't know their shell". Even more so for most z/OS users.


I agree that it would be ideal if the JZOS batch launcher was modernized to support wildcards but disagree about the shell. I find it's absolutely necessary just to do stuff like:

. /etc/profile       # set TZ variable and other stuff

You are just setting the CLASSPATH environment variable, so yes you can do the same thing using the java command in BPXBATCH if you need to (apologies for naming my program ClassPath, which is slightly confusing):

//S1  EXEC PGM=BPXBATCH,REGION=512M
//STDENV  DD *
CLASSPATH=java/target
//STDPARM DD *
SH for i in java/lib/slf*.jar; do
 CLASSPATH="$CLASSPATH":"$i";
 done;
 export CLASSPATH="$CLASSPATH";
 /usr/lpp/java/J8.0/bin/java ClassPath
//STDOUT    DD SYSOUT=*
//STDERR    DD SYSOUT=*

Output:
java/target:java/lib/slf4j-api-1.7.21.jar:java/lib/slf4j-simple-1.7.21.jar
/home/andrewr/java/target/
/home/andrewr/java/lib/slf4j-api-1.7.21.jar
/home/andrewr/java/lib/slf4j-simple-1.7.21.jar

It's the handling of the CLASSPATH environment variable that's the issue.

I have been playing around with PROCs to try to simplify things so you can use more traditional JCL for JZOS jobs (hence my other questions about JCL substitutions in instream data).
e.g.

//JAVA     EXEC PROC=JAVA8G,
// JAVACLS='''MyProgram''',
// APPHOME='''java/target''',
// CLASPATH='''java/lib/*:java/easysmf-je-1-5-2/jar/*'''
//INPUT    DD DISP=SHR,...

It is difficult to handle the classpath like this if you need to allow multiple entries and support any sort of wildcard. It would be much easier if it followed the same rules as the java command.


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

Reply via email to