I have a need to cleanup some USS files in the event that the batch job, running coz launcher, was canceled by an end user or timed out.
I have a coz launcher job starting from zos, the step executes a Perl script on a distributed Linux server. In the event that the zos batch job is canceled I need to perform some cleanup tasks. I do have a handle coded in the Perl script on Linux and am successful in cleaning the Linux server side items, but the handle routine is unable to cleanup uss due to the fact that the connection to client no longer exists (I cannot run cozclient commands). I am not aware of any way to code a handle on the zos side to perform some file cleanup within uss, when the coz launcher steps is canceled. The cleanup tasks I need to perform is to move a file from one directory (running) to another directory (completed).
Please share any ideas on how I can perform a cleanup routine on the client side when the batch job is canceled.
Handle canceled zOS batch job
Re: Handle canceled zOS batch job
I tried running the following BPXWDYN in an attempt to have the file (name only known at runtime) deleted if the job step fails. However I have only been able to get BPXWDYN to support zos dataset files, not HFS files.
ALLOC DD(USSX) PATH('test.txt2') PATHMODE=(SIRWXO,SIRWXG,SIRWXU) PATHOPTS=(OWRONLY,OCREAT) PATHDISP=(KEEP,DELETE)
The above command is initiated from cozclient to rexx in uss.
ALLOC DD(USSX) PATH('test.txt2') PATHMODE=(SIRWXO,SIRWXG,SIRWXU) PATHOPTS=(OWRONLY,OCREAT) PATHDISP=(KEEP,DELETE)
The above command is initiated from cozclient to rexx in uss.
Re: Handle canceled zOS batch job
Right - BPXWDYN won't delete z/OS Unix files.
A couple of ideas:
1) from the remote script, you could do this:
cozclient rm /path/to/zos/unix/file
2) You could have a conditional COZBATCH step, following the COZLNCH step, that has z/OS Unix shell commands to clean up z/OS files and data sets.
A couple of ideas:
1) from the remote script, you could do this:
cozclient rm /path/to/zos/unix/file
2) You could have a conditional COZBATCH step, following the COZLNCH step, that has z/OS Unix shell commands to clean up z/OS files and data sets.
Re: Handle canceled zOS batch job
3) If you are already calling a z/OS REXX script, you could do the rm with a REXX Unix syscall command.