DOCUMENTATION NTi

CallServiceProgramProcedure() method

Description

The CallServiceProgramProcedure method is used to call an existing procedure in a service program using the QZRUCLSP API.
It returns an object of type NTiProgramParameter containing the result of the call.

Syntax

NTiProgramParameter CallServiceProgramProcedure(
    string library,
    string program,
    string procedure,
    List parms,
    List parmsType,
    ServiceProgramReturnType returnFormat
)

Parameters

Name Type Description
library string Library containing the service program.
program string Name of the service programme.
procedure string Name of the service programme procedure.
parms List<NTiProgramParameter> Parameters to be transferred to the service programme procedure.
parmsType List<ServiceProgramParameterType> Types of each parameter, in the same order as parms:
- Integer : The parameter is a 32-bit integer BINARY(4) passed by value
- Pointer :The parameter value is passed by reference (pointer)
returnFormat ServiceProgramReturnType Format of the expected return value:
- NoReturn :No value is returned (the "Return Value" parameter is ignored).
- Integer : Returns a BINARY(4) integer.
- Pointer :Returns a 16-byte pointer.
- IntegerErrno : Returns a BINARY(4) integer and the code errno.

Return

Returns an object of type NTiProgramParameter which contains the return value of the procedure. The value can be accessed via the OutputData property or the Get...() methods of NTiProgramParameter. Procedure parameters passed to parms are also modified and their values can be accessed after the call.

Exceptions

Raises an ArgumentException if the parms and parmsType lists do not have the same length.

Examples of use

call the dlpar_get_info() procedure from QSYS/QPMLPMGT.

var conn = new NTiConnection("...");
conn.Open();

// Procedure parameters
var parms = new List() {
    new NTiProgramParameter("", 368),   //Receiver variable
    new NTiProgramParameter(1),         //Format
    new NTiProgramParameter(368)        //Receiver length
};

// Type of parameter value
var parmsType = new List() {
    ServiceProgramParameterType.Pointer,
    ServiceProgramParameterType.Integer,
    ServiceProgramParameterType.Integer
};

// Call procedure
var result = conn.CallServiceProgramProcedure("QSYS", "QPMLPMGT", "dlpar_get_info", parms, parmsType, ServiceProgramReturnType.Integer);

// Results recovery
var lparNumber = parms[2].GetInt(40);
var lparName = Encoding.UTF8.GetString(parms[2].GetBytes(88, 8));

References

For more information on the QZRUCLSP API, see the official IBM documentation.