AS/400 Toolbox for Java \ Access classes \ Service program call

Service program call

The ServiceProgramCall class allows you to call an AS/400 service program. ServiceProgramCall is a subclass of the ProgramCall class that you use to call AS/400 programs. If you want to call an AS/400 program, use the ProgramCall class.

The ServiceProgramCall class makes it possible for you to call an AS/400 service program, pass data to an AS/400 service program through input parameters, and access data the AS/400 service program returns through output parameters. Using ServiceProgramCall causes the AS/400 object to connect to the AS/400. See managing connections for information about managing connections.

Using the ServiceProgramCall class

In order to use the ServiceProgramCall class, you must be sure to meet the following requirements:

Working with ProgramParameter objects

The ProgramParameter class works with the ServiceProgramCall class to pass parameter data to and from an AS/400 service program. You pass input data to the AS/400 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 AS/400 server. Once the data is on the AS/400, 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 AS/400 and Java formats, you use the data conversion and description classes.


[ Information Center Home Page | Feedback ] [ Legal | AS/400 Glossary ]