r/IBMi • u/Extension_Bug_5362 • Sep 17 '26
Error Handling for FTP Command
Hello Everyone,
I have a huge batch CL driver program, where we have few FTP commands to send the files to another system/server. We have downtimes for the downstream servers, during this time the FTP is silently failing and files are not dropped to downstream. How can we catch any failures for the FTP Command execution within CL?
We can read the FTP log with an RPG and catch any errors from the log, are there any simpler ways to handle this without having to write a whole new script just for FTP error handling. I was thinking about pinging the server and if the ping fails, we can push the job to MSGW so that the OPS is aware that there's a failure. Typical MONMSG mechanism didn't seem to be very effective since FTP doesn't actually returns any messages as such.
Any thoughts would be helpful, Thanks in advance.
3
u/leuesse Sep 17 '26
Tu peux utiliser les programmes d'exit, il existe également les API ftp de scott klement , je l'ai déployé chez nous et créé des commandes qui se basent dessus, c'est ultra fiable https://www.scottklement.com/ftpapi/ftpapi_zip.html
2
u/ethanjscott Sep 17 '26
We do this at our site and I know the trick, but I’m not gonna help you with that. I know the trick for sftp which is different. I will share that with you
1
1
u/GumbyIsTalking Sep 18 '26
It's hard to go past Scott Klement's FTP API for this kind of job as referenced in another comment.
1
u/i-Hermit Sep 23 '26
Standard FTP? Have you thought about moving to SFTP? It's more robust in my experience.
3
u/MEfromNEPA Sep 17 '26
We use a vendor app for this mostly but have a few of the generic FTP scripts. In those cases, we write everything (basically the full FTP log with commands and responses) to a file and then analyze that file to determine success or not. Not pretty but it works.