Removing an MVS file

General discussion on the JZOS batch launcher and toolkit
Post Reply
Nalini
Posts: 27
Joined: Thu Dec 30, 2004 7:03 pm

Removing an MVS file

Post by Nalini »

Hello,

Does anyone know of a way to remove an MVS file from a servlet running Tomcat?

Thanks in advance for your help,
Nalini Elkins
Inside Products, Inc.
www.inside-products.com
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Nalini,

Unfortunately, we do not have a nice simple api in ZFile which does this. I will add it to the list for the next release.

In the mean time, you can delete a traditional MVS dataset by allocating it with disposition delete and then freeing the dataset. This can be done by using the ZUitl.bpxwdyn() method, which is an interface to IBM's BPXWDYN service, which is a text-based interface to dynamic allocation.

For example:

ZUtil.bpxwdyn("alloc fi(mydd) da(fully.qualified.dataset.name) old delete msg(WTP)" );

ZUtil.bpxwdyn("free fi(mydd) msg(WTP)");

Note: "mydd" must be a 1-8 character DD name of your choosing which is not already allocated / in use. You may want to serialize access to the code that does this, since multiple threads running the above code might contend in a race condition for the same ddname.

Documentation for BPXWDYN can be found in the IBM manual:
http://publibz.boulder.ibm.com/epubs/pdf/bpxzb651.pdf
Nalini
Posts: 27
Joined: Thu Dec 30, 2004 7:03 pm

Post by Nalini »

Thanks for the help. Actually, this is an HFS directory. How would I go about doing that?

Nalini
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

HFS files are manipulated using the normal java.io classes.

To delete a file or directory, use java.io.File.delete().
Nalini
Posts: 27
Joined: Thu Dec 30, 2004 7:03 pm

Post by Nalini »

Thanks for your help.

Nalini
Post Reply