Zfile.remove - migrated DSNs

General discussion on the JZOS batch launcher and toolkit
Post Reply
slescure
Posts: 5
Joined: Fri Oct 28, 2011 11:46 am

Zfile.remove - migrated DSNs

Post by slescure »

I have a java program calculates how old a mvs dataset is, and if it over x number of days old, deletes it. ( myzfile.remove("mydsnname") )

This works fine unless the dataset is migrated, in which case the file is not deleted.

I could recall all the datasets first, but that would likely cause space issues.

Can anybody suggest a clean(er) workaround?

thanks
slescure
Posts: 5
Joined: Fri Oct 28, 2011 11:46 am

Re: Zfile.remove - migrated DSNs

Post by slescure »

i should have mentioned message that appears in STDOUT is

[datasetname] on MIGRAT Volume not mounted

so it appears that zfile.remove won't work if the dataset is migrated. the only workaorund i can think of is to recall all the datasets first.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Zfile.remove - migrated DSNs

Post by dovetail »

ZFile.remove simply calls the fremove() C library routine.

I don't know of a work-around. Suggest opening a requirement with IBM.
slescure
Posts: 5
Joined: Fri Oct 28, 2011 11:46 am

Re: Zfile.remove - migrated DSNs

Post by slescure »

ok thanks! At least i know i'm not missing something obvious.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Zfile.remove - migrated DSNs

Post by dovetail »

The only alternative that I can think of is writing a program that does HDELETEs.

Could be done as user-written JNI, but somewhat easier to build a z/OS Unix module and then run is via Runtime.exec() or com.ibm.jzos.Exec. Could pipe a list of datasets to delete or HDELETE via stdin.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Zfile.remove - migrated DSNs

Post by dovetail »

I'm sorry, I completely missed a good way to do this -

JZOS has an interface to calling IDCAMS (com.ibm.jzos.AccessMethodServices).
See the javadoc for example usage.

You could invoke this and then pass IDCAMS DELETE commands. IDCAMS will automatically avoid recalling migrated datasets.
Post Reply