How to copy files in a POST_JOB_COMMAND in P/I Output Manager

print
The requirement is to have a POST_JOB_COMMAND that calls a batch file that will copy files to another network location and then delete them.

The mechanism is to write the job and job specific config to a local temp directory.  When that completes, a post job command will run a batch file to move the job and config to a watch folder on PIEM server via a remote drive mapping.

The batch file copies the config then deletes it, then copies the job then deletes it.

If for any reason the job fails to copy it is deleted anyway and the post job command completes. 

The batch file can use the ROBOCOPY command to copy the config and job files to the remote location.  The ROBOCOPY command allows for retries if the copy is not successful:

ROBOCOPY <sourcefile> /W:20 /R:15 <destination>

The /W and /R switches set the wait and retry options; in this case, Robocopy will retry each copy up to 15 times, waiting 20 seconds between attempts. (The defaults allow 1 million retries, at 30-second intervals, allowing copy operations to complete when an open file is closed, even if hours or days have passed since the command was first launched.) 

To see the full syntax, type robocopy /? at a command prompt. 

The START command with the /W switch can be used to make the process wait for the completion of the ROBOCOPY before deleting the files:

Syntax

START "" /W ROBOCOPY <sourcefile> /W:20 /R:15 <destination>

Options:

/W or /WAIT Start application and wait for it to terminate

.

Question

Subject: job missing on transfer from piom to pioe

Initial Details: We had a job in UAT environment get lost without warning. The workflow is flex to vip and back into flex after being normalized to an AFP job with barcodes and indexing for reprints. The mechanism for returning the job to flex is to write the job and job specific config to a local temp directory and on completion have a post job command run a batch file to move the job and config to a watch folder on flex server via a remote drive mapping. The batch file copies the config then deletes it, then copies and deletes the job. If for any reason the job fails to copy it is deleted anyway and the post job command completes. is there a way of getting the status of the copy command returned as the post job command status? or some other mechanism or method that would offer a guaranteed delivery? preferably without altering the workflow, but suggestions/evaluation appreciated.

UPDATED: February 16, 2018