Handle canceled zOS batch job

Discussion of the Co:Z Co-Processing Toolkit for z/OS
Post Reply
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Handle canceled zOS batch job

Post by sctebnt » Tue Jul 14, 2015 9:20 am

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.

sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Re: Handle canceled zOS batch job

Post by sctebnt » Tue Jul 14, 2015 11:35 am

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.

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

Re: Handle canceled zOS batch job

Post by dovetail » Tue Jul 14, 2015 5:28 pm

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.

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

Re: Handle canceled zOS batch job

Post by dovetail » Tue Jul 14, 2015 6:44 pm

3) If you are already calling a z/OS REXX script, you could do the rm with a REXX Unix syscall command.

Post Reply