Issue with ZFile.exists()

General discussion on the JZOS batch launcher and toolkit
Post Reply
orr94
Posts: 22
Joined: Thu Feb 24, 2005 1:28 pm

Issue with ZFile.exists()

Post by orr94 »

I am having some trouble with the ZFile.exists() method. I am using JZOS 1.2.2 and Java 1.4.2 on a z/OS 1.4 system.

When I call ZFile.exists() on a sequential dataset or a PDS, it works as it should (true if it exists, false if it doesn't). However, when I call it on a PDS member, it always returns false, whether it exists or not.

There are no errors in the system log. Turning on ZUtil.setLoggingLevel(ZUtil.LOG_TRACE) didn't produce anything that caught my eye. If I open a BufferedReader (using FileFactory.newBufferedReader()) on an existing member, it can read it with no problems.

Am I misunderstanding how exists() is used? Is it not supposed to be used for PDS members?

One another note: there is no documentation in the JZOS javadocs for ZFile.exists() or ZFile.dsExists(). It took me a while to realize that dsExists() does not expect // in front of the dataset names (and will always return false if they are there), unlike exists(). This might be worth noting in the documentation for a future JZOS release.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Yes, ZFile.exists() doesn't work with PDS members in the current versions (1.2.2 or 1.2.3).

This has been fixed in an upcoming release, and the Javadoc has been corrected.

In the mean time, I can think of a couple of workarounds -

- I think that JRIO provides an api for this.
Here's an example from the JRIO User's guide:

IRecordFile rf = new RecordFile("//JOE.PDS.FILE(MEMBER)");
System.out.println("rf="+rf.getAbsolutePath()+
" exists="+
rf.exists());

- You could open a ZFile for input on the member and see if you get an exception.
orr94
Posts: 22
Joined: Thu Feb 24, 2005 1:28 pm

Post by orr94 »

Glad to hear it isn't just me! I'll look forward to the fix in a later version. We actually are using JRIO's RecordFile to check for PDS member existence right now; we're just trying to get away from JRIO and as much as possible!

Thanks for the quick answer!
Post Reply