How to handle SFTP File Transfer Job/Application failing when no files are found

Document ID : KB000120642
Last Modified Date : 08/11/2018
Show Technical Document Details
There are times that "No Files" matched but we want the application to continue to run and not left in a "FAILED "state.
How can we setup the job such that when the SFTP file transfer job fails with the message: Transfer failed: "No matching files found" due to there are no files to be transferred, the application continues to run but a notification of the error/warning is issued?
CA Workload Automation DE 11.3.x, 12.x
An option is to setup a File Trigger as predecessor job to monitor for the file existence before releasing the SFTP job.

Also, you can use Email and Alert Notifications;

1. Setup an Email Notification in the SFTP job to notify you on the error when the job failed.

2. Setup an Alert to run a javascript in the SFTP job to monitor for the return code 1 and use the execCommand function to complete the job;

if (WOB._status=='"No matching files found"')
execCommand('%WOB._name','%(APPL._name).%APPL._gen','ACTION COMPLETE Reason("Force complete SFTP job")');
To mark complete the entire Application if the "subcount" >= to "retrycount";

if (WOB._status=='"No matching files found"')
if (WOB._subcount>=WOB._retrycount)
execCommand('ALL','%(APPL._name).%APPL._gen','ACTION COMPLETE Reason("Force complete SFTP job")');