Version 4.2.6 for Mainframes
 —  Natural Remote Procedure Call (RPC)  —

Terminating a Natural RPC Server

This section describes how to terminate a Natural RPC server. Several methods exist.


Using SYSRPC

Use the TE (Terminate Server) command of the SYSRPC utility as described in Terminating a Server in the SYSRPC Utility documentation.

A Natural RPC server can only be terminated if the server is currently neither executing a remote CALLNAT nor waiting for the next CALLNAT request in a conversation.

Top of page

Using EntireX System Management Hub

Use the Deregister button in the Server subtree of the EntireX System Management Hub.

Top of page

Using Application Programming Interface USR2073N

The Application Programming Interface (API) USR2073N enables you to ping or terminate a Natural RPC server.

The interface sends a ping or terminate command to an RPC server specified by node name and server name. The returned message contains the following information:

Start of instruction setTo make use of USR2073N

  1. Copy the subprogram USR2073N from libray SYSEXT to the library SYSTEM or to the steplib library or to any application in the server environment.

  2. Using a DEFINE DATA statement in structured mode or a RESET statement in reporting mode, specify the following parameters:

    Parameter Format I/O Description
    FUNCTION A10 I PING Asks the RPC server for its version.
    TERMINATE Initiates the finishing of the Natural RPC server task.
    SRVNODE A192 I Specify the node name or * if the server name represents a Location Transparency of EntireX or a logical broker node name as LOGBROKER=nodename). See the keyword subparameter SRVNODE of profile parameter RPC or parameter macro NTRPC.
    SRVNAME A192 I Server name or EntireX Location Transparency. See the keyword subparameter SRVNAME of profile parameter RPC or parameter macro NTRPC.
    LOGON A1 I

    The logon flag Y (yes) indicates that logon data must be transmitted to the Natural RPC server.

    USER-ID A8 I

    If LOGON=Y, then user ID and password are the logon data for Natural Security.

    If the client does not run under Natural Security (NSC) and the logon flag is set, the user ID and password have to be specified unless the data have been entered via Application Programming Interface USR1071N. See Using Security, Using Natural RPC with Natural Security.

    PASSWORD
    MSG A79 O Message returned.
    RC I2 O Response code; possible values are:
    0 MSG contains a normal message from RPC server or Broker.
    1 MSG contains an error message from RPC server or Broker.
    2 MSG contains an error message from the interface.
    3 Natural Security error.
  3. Before invoking the API, fill the input variables listed above.

Top of page

User Exit NATRPC99

This exit is called after the Natural RPC server has deregistered and logged off from the server node.

NATRPC99 is called with a FETCH statement without any parameters, that is, no data is put on the Natural stack before NATRPC99 has been called.

You may add any coding to NATRPC99, including transfer control statements (FETCH, CALLNAT, PERFORM) and statements that terminate the program (STOP, ESCAPE, TERMINATE).

If NATRPC99 is terminated with a RETURN or STOP statement, Natural returns to the NEXT prompt. If the NEXT prompt is not supported in the environment used (profile paramter CM=OFF, asynchronous Natural session, etc.) the session terminates. Otherwise, the session tries to read the next command from the primary input file/dataset for Natural commands and INPUT data (CMSYNIN).

Important Notes:

  1. NATRPC99 must be a Natural program.

  2. NATRPC99 must be located in the library SYSTEM on system file FUSER. The steplib concatenation of the library to which the server currently is logged on is not evaluated to find NATRPC99.

  3. NATRPC99 is currently only called if the server is terminated with a TE (Terminate Server) command issued using the SYSRPC utility as described in Terminating a Server in the SYSRPC Utility documentation. The exit is not called if the server is terminated via the EntireX System Management Hub.

  4. Natural objects that are called by NATRPC99 (FETCH, CALLNAT, PERFORM) must be located either in the library to which the server is logged on or in one of its steplibs (including SYSTEM on system file FUSER).

Top of page

Server Termination When Using an Attach Manager

The keyword subparameter SRVTERM of profile parameter RPC or parameter macro NTRPC influences the termination behavior of a Natural RPC server. By default, a server is never terminated (SRVTERM=NEVER) unless one of the termination methods described before is applied.

If you use an Attach Manager to dynamically start Natural RPC servers on request, you should set SRVTERM to TIMEOUT. With this parameter setting, a Natural RPC server is automatically terminated if the wait time for the next client request outside of an RPC conversation is exceeded.

Top of page