The ServiceProgramCall class makes it possible for you to call an iSeries service program, pass data to an iSeries service program through input parameters, and access data the iSeries service program returns through output parameters. Using ServiceProgramCall causes the AS400 object to connect to the iSeries. See managing connections for information about managing connections.
The default behavior is for service programs to run
in a separate server job, even when the Java program and the
service program are on the same server. You can override the
default behavior and have the service program run in the Java job
using the inherited (from ProgramCall)
setThreadSafe() method.
The ProgramParameter
class works with the ServiceProgramCall class to pass parameter data to and
from an iSeries service program. You pass input data to the iSeries service
program with
setInputData().
You request the amount of output data you want returned with
setOutputDataLength(). You retrieve the output data after the service program
is finished running with
getOutputData(). In addition to the data itself, ServiceProgramCall needs
to know how to pass parameter data to the service program. The
setParameterType() method of ProgramParameter is used to supply this information.
The type indicates if the parameter is pass by value or pass by reference. In
either case, data is sent from the client to the server. Once the data is on
the iSeries, the server uses the parameter type to correctly call the service
program.
All parameters will be in the form of a byte array. Therefore, to convert between iSeries and Java formats, you use the data conversion and description classes.