On the process that is doing the FTP command, add an extra statement to start the import process. FTP on the 400 supports calling remote iSeries commands using the quote rcmd function. An example FTP statement to call an iSeries program would look like this:
quote rcmd CALL PGM(MYLIB/MYPGM)
If you use call like in this example, the program being called should take care of setting up the library list for the rest of the job, and other things like that. You could have just as easily put in a SBMJOB command from the FTP prompt or just about any other command the iSeries supports.
You could also do a never-ending program that would sit out in batch and wake up occasionally to check the status of what is in the IFS, but that is not nearly as efficient or as quick to code as using FTP to start the process.
- With regards to the recent question regarding an IFS trigger when the file is sent via FTP, I have recently implemented a solution using an FTP exit program (FTP Server Request Validation - QIBM_QTMF_SERVER_REQ).
On an FTP PUT statement, the exit program checks directory being used, and if it is the target directory, a job is submitted that processes the file. The filename is known to the exit program so that is passed as a parameter.
This method requires no extra effort from the sending party such as RCMD, which in my case is important because the files are FTP'd in from outside my company. It is also more efficient than a continually running batch job.
The only downside is that the exit program is called BEFORE the PUT statement is performed, meaning that at the time I submit the job, the file is not ready. The way I overcame this was to put a DLYJOB at the beginning of my program (to allow the send to complete), and also I copy the file before processing it, and if the file is still in transit the copy will fail (to which I wait a couple more seconds and try again). Robert Mashiah
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig deeper on RPG iSeries programming
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.