Support This Project Get i5/OS Programmer's Toolkit at Fast, secure and Free Open Source software downloads

Reuse a Program-call Object to Improve Performance

If your need to do program-calls frequently, we recommand that you should create a reusable program-call object (an instance of class as400.prototype.RemoteCommand with its reuse set to true) and call target IBM i host programs by it. The benefit is, it will improving the performance of calling programs dramatically in comparison with creating a new program-call object each time an IBM i program is to be called.

To call an IBM i host program, one need to cooperate with one of the IBM i host servers, the IBM i remote command server, at the TCP socket level. The full name of this server is, remote command and distributed program call server (according to the IBM i info-center). Before the program-call request is really sent to the remote command server, there're several steps have to be done first and some of them are quite time-consuming. For example, establishing a TCP connection with the server, exchanging 8-byte random seeds with the server, sending encrypted password data and user ID to and server and requesting the server to start a PJ (prestarted JOB) job to serve you, etc. At the other hand, if you choose to call programs by reusing a connected program-call object, all the above steps targeting environment initialization and user authentication will NOT happen, the only thing happens when you invoke RemoteCommand.callx() on a connected RemoteCommand instance is the program-call request being sent to the server. is an example of calling IBM i APIs and running CL commands in AS3 using AS-400. It's also an example of using a single reusable program-call object during multiple program-calls. The key point of reusing a program-call object is setting the reuse:Boolean arguemnt of class RemoteCommand's constructor to true.

finish this page!

Support This Project
Generated on Wed Jul 20 07:48:05 2011 for i5/OS Programmer's Toolkit: AS-400 by  doxygen 1.5.9