Ask the Expert

Triggering an import job

You Can View User Feedback To This Expert Q&A

We currently receive data on our iSeries into the IFS via FTP. We have a scheduled job that imports the data into the main database. Is there any way this can be automated so that when the data is written into the IFS the import job can be triggered?

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.

USER FEEDBACK TO THIS EXPERT Q&A

  • 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.


This was first published in September 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: