Is it possible to have the CA Mainframe Application Tuner (MAT) JVM agent activated for a measurement of a batch job? The TRCUST dialog shows this approach:
4. Add a parameter to the java command or use an environment variable:
a. java -agentlib:/jvmjti_path/tnuljtix64 application.main.class
c. For debugging: -agentlib:/jvmjti_path/tnuljtix64=debug=n
If you see a problem updating JCL streams, is there a possibility to have this activation done from outside the JCL like setting the option in an environmental variable?
To avoid having to change individual JCL streams, you will need to change the IBM_JAVA_OPTIONS environmental variable. This is a default set of parameters used for every JVM started in a specific USS environment.
You can include the -agentlib parameter there in order to activate the agent in any JVM that is started in this environment. However, if the startup JCL changes the IBM_JAVA_OPTIONS defaults, for example by defining its own -agentlib, it will override the environmental defaults and the activation will fail.
USS administration provides several methods to perform this action:
1) For a single user, if you can execute the relevant jobs under a specific userid, you can define the variable directly in a .profile file in the users home directory, by adding this into it:
IBM_JAVA_OPTIONS="$IBM_JAVA_OPTIONS -agentlib=<path to your agent installation>"
However, there are some limitations to this approach. According to IBMs USS User Guide, the settings in .profile are applied when the user logs into USS, and in the case of Java batch jobs, only when these run with the SH option (by default they do).
2) For all users, you can define the same 2 lines in file /etc/profile. Please note, however, that if a user overrides the default IBM_JAVA_OPTIONS in their user specific .profile files, the individual options will take precedence. This can be avoided by simply concatenating the variable (as per in the example in point 1) and this approach should work fine.
3) If your Java jobs use BPXBATCH without the SH option, you can put the same definition into a dataset or unix file allocated to the STDENV DD
It should also be noted, however, that the agent has both a 64 bit and a 31 bit version and the correct version must be used for their respective JVMs. If your site uses only 64-bit Java, this is no problem, use the 64 bit agent in the -agentlib parm. However if you still have some legacy 31-bit Java jobs, these will have a problem starting with a 64-bit agent attached. In that case, setting up the agent across the whole system won't be possible, since you can only have one version of the agent set this way.