Hello,
is there an opportunity to provide the jobname to the java program. I'like to set it by -Djobame= to be used as system property, but I would like to do so by invoking the class in the JCL.
I won't use the JZOSENV-file for this.
brgds,
Ulrich Schmidt
Setting System.property by JZOS-invocation-JCL
-
- Posts: 37
- Joined: Fri Jan 09, 2009 1:25 pm
- Location: Germany
Ulrich,
I can think of two ways to pass a system property from JCL parameters into a JZOS batch job:
1) pass the parameter as an argument to your main() method and then have the main method use that argument with System.setProperty(). This requires that you modify the Java main class.
2) set an environment variable from the JCL, and then in your STDENV script use that environment variable to set the property in IBM_JAVA_OPTIONS:
I can think of two ways to pass a system property from JCL parameters into a JZOS batch job:
1) pass the parameter as an argument to your main() method and then have the main method use that argument with System.setProperty(). This requires that you modify the Java main class.
2) set an environment variable from the JCL, and then in your STDENV script use that environment variable to set the property in IBM_JAVA_OPTIONS:
Code: Select all
// EXEC JVMPRC60,LEPARM='ENVAR(JOBNM=&JOBNM)',
// JAVACLS='com.myco.Myclass'
//STDENV DD *
...
# Configure JVM options
IJO="-Xms16m -Xmx128m"
IJO="$IJO -Djobname=&JOBNM"
export IBM_JAVA_OPTIONS="$IJO "
//
-
- Posts: 37
- Joined: Fri Jan 09, 2009 1:25 pm
- Location: Germany
I like the second solution.
But get it run I have to change at two positions:
LEPARM='ENVAR(JOBNM=<realJobname>',
and
IJO="$IJO -Djobname=$JOBNM"
which means, the jobname ist filled in dynamically - I have to edit the real jobname to the LEPARM-Field,
and instead of &JOBNM I have to use $JOBNM to see the <realJobname> in my System.getProperty("jobname").
brgds,
Ulrich
But get it run I have to change at two positions:
LEPARM='ENVAR(JOBNM=<realJobname>',
and
IJO="$IJO -Djobname=$JOBNM"
which means, the jobname ist filled in dynamically - I have to edit the real jobname to the LEPARM-Field,
and instead of &JOBNM I have to use $JOBNM to see the <realJobname> in my System.getProperty("jobname").
brgds,
Ulrich