missing ZCutil methods

General discussion on the JZOS batch launcher and toolkit
Post Reply
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

missing ZCutil methods

Post by cscs010 »

the ZCutil class as described in the API does not seem to contain some of the methods
described at least getPid(),getPPid(), getCurrentTimeMicros();
i tried several different ibmjzos.jar files from various releases of JZOS (2.2.0, 2.2.1, 2.3.0).
This is the result from the ibmjzos.jar supplied with the latest alphaworks 2.3.0 version of JZOS.
$ javac -cp .:ibmjzos.jar tzutil.java
tzutil.java:33: cannot find symbol
symbol : method getPid()
location: class com.ibm.jzos.ZUtil
int n1 = ZUtil.getPid();
^
tzutil.java:34: cannot find symbol
symbol : method getPPid()
location: class com.ibm.jzos.ZUtil
int n2 = ZUtil.getPPid();
^
tzutil.java:35: cannot find symbol
symbol : method CurrentTimeMicros()
location: class com.ibm.jzos.ZUtil
,===>,

from api doc:
static long getCurrentTimeMicros()
Gets the current time, expressed in microseconds since 00:00:00 Coordinated Universal Time (UTC), January 1, 1970
static int getPid()
Get the process id of the current process.
static int getPPid()
Get the parent process id of the current process.
________
Cosmo
Last edited by cscs010 on Sat Feb 12, 2011 2:21 pm, edited 1 time in total.
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

Post by cscs010 »

note that the compiler ^ symbol is under ZUtil and not n1, etc.
when i paste the entries it looks okay but preview shows the symbol in the wrong place.
tzutil.java:34: cannot find symbol
symbol : method getPid()
location: class com.ibm.jzos.ZUtil
int n1 = ZUtil.getPid();
^
tzutil.java:35: cannot find symbol
symbol : method getPPid()
location: class com.ibm.jzos.ZUtil
int n2 = ZUtil.getPPid();
^
tzutil.java:36: cannot find symbol
symbol : method CurrentTimeMicros()
location: class com.ibm.jzos.ZUtil
long n3 = ZUtil.CurrentTimeMicros();
^
________
Wholesale vaporizer
Last edited by cscs010 on Sat Feb 12, 2011 2:21 pm, edited 1 time in total.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Are you compiling on z/OS with a z/OS SDK? If so, then you are probably picking up the SDK version of the ibmjzos.jar file that is in $JAVA_HOME/lib/ext. I haven't seen this, as I don't use javac on z/OS, but you will probably have to override the jar for javac just like you do with running java using -Djava.ext.dirs. See the alphaworks JZOS installation guide for more information.
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

Post by cscs010 »

i am running on z/os but it would be the same any place on any system.

i copied in each ibmjzos.jar i could find to the directory and specifically pointed to it in the classpath. none of them worked.

where else is the ZUtil class defined?
are there any other ibmjzos.jar files around besides the ones given in lib/ext?

sorry for my mispellings in the original note.
________
MERCEDES-BENZ ACTROS SPECIFICATIONS
Last edited by cscs010 on Sat Feb 12, 2011 2:21 pm, edited 1 time in total.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

You can't override a jar in lib/ext just by copying another version somewhere and pointing CLASSPATH to it. This is probably your problem.

The com.ibm.jzos.ZUtil class is in lib/ext/ibmjzos.jar
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

Post by cscs010 »

the following classpath is set for the alphaworks jzos 2.3.0 ibmjzos.jar to be searched first.
even if i set classpath to a different version of jzos, like the ibmjzos.jar file in java/lib/ext for jzos 2.2.0 that was given with sdk6, i get the same error.
the compiler cannot find some of the methods documented in the api, but it does find other methods.
this would imply that either the documentation is wrong or the ZUtil versions being supplied with jzos are not up to date.
there is no source code supplied so we cannot check what is in it.

note that these are just compile errors, and you can override classpath settings for the compiler by altering the order of jar files searched.

$ echo $CLASSPATH
/u/eileen/j1x/jzos/jzos/ibmjzos.jar:/u/eileen:/../usr/lpp/
31/lib/dfjcics.jar:/../usr/lpp/cicsts/cicsts22/cicsts31/sa
/lpp/cicsts/cicsts22/cicsts31/progs:/../usr/lpp/cicsts/cic
cos.jar:/u/eileen/tmp:/u/eileen/j16/J6.0/mvstools/samples/

javac tzutil.java
tzutil.java:34: cannot find symbol
symbol : method getPid()
location: class com.ibm.jzos.ZUtil
n1 = ZUtil.getPid();
^
tzutil.java:35: cannot find symbol
symbol : method getPPid()
location: class com.ibm.jzos.ZUtil
n2 = ZUtil.getPPid();
^
tzutil.java:36: cannot find symbol
symbol : method getCurrentTimeMicros()
location: class com.ibm.jzos.ZUtil
n3 = ZUtil.getCurrentTimeMicros();
^
________
Marijuana test
Last edited by cscs010 on Sat Feb 12, 2011 2:21 pm, edited 1 time in total.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I still believe that your problem is that you are getting an old lib/ext version of the jar instead of the one that you are trying to use on your classpath.

To verify this: move the jar that you want to use to a Windows or Linux workstation and use javac there. Then you know that you aren't getting interference from the z/OS JRE. (Compiling on z/OS is a bad idea anyway, as far as I'm concerned).

If you open the jar in an IDE like Eclipse, you can see what methods are in the class and their signatures.
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

Post by cscs010 »

well live and learn! you are absolutely right!

i downloaded the ibmjzos.jar file and tzutil.java file to windows and ran
javac -classpath ibmjzos.jar;. tzutil.java and it worked!
javac -classpath ibmjzos.jar:. tzutil.java on z/os does not work.

both are using jdk 6 but z/os is using IBMs java and windows is using Sun's.

thank you so much for resolving this problem.
________
Ts100
Last edited by cscs010 on Sat Feb 12, 2011 2:21 pm, edited 1 time in total.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Glad you were able to resolve it.

The problem is that ibmjzos.jar is in lib/ext in the z/OS SDK, and you CAN'T override it with CLASSPATH. (You must use the -Djava.ext.dir JVM option to override a jar that is in lib/ext). See the alphaworks JZOS documentation for more information.
cscs010
Posts: 37
Joined: Tue Jul 31, 2007 3:50 pm

Post by cscs010 »

yes - this worked on z/os:

javac -classpath ibmjzos.jar:. -extdirs . tzutil.java

thanks again for setting me straight.
________
Extreme q vaporizer
Post Reply