Using the COBOL Wrapper with Non-secure Natural RPC Server

This document explains how clients built with the COBOL Wrapper set the Natural library used to execute the RPC request programmatically when communicating to a non-secure Natural RPC Server (not running with Natural Security). If the Natural RPC Server is running with Natural Security, see Using RPC Authentication (Natural Security, Impersonation, Integration Server).

You will need the following components:

  • the Delivered Modules, which are provided to create and get a security token

  • the RPC communication area copybook ERXCOMM

The code you write depends on the interface type:


Call Interface

This interface type applies to the scenarios CICS | Batch | IMS.

Start of instruction setTo set the Natural library when communicating to a non-secure Natural RPC server

  1. Declare and initialize the RPC communication area with one of the approaches described under Step 1: Declare and Initialize the RPC Communication Area in section Writing Standard Call Interface Clients. Here you can use copybook ERXCOMM only, or both copybooks ERXCOMM and ERXVSTR.

  2. Set the library in RPC Communication Area and call generic RPC service module to create a security token with the function Create Security Token CT provided by the generic RPC services module, using the Call interface. The code snippet below illustrates the variant where only copybook ERXCOMM is used. If you are using both copybooks ERXCOMM and ERXVSTR, see Note 1.

      . . .
     MOVE "CT"   TO COMM-FUNCTION.
    * Set library in RPC Communication Area
     MOVE "NAT-LIB"   TO COMM-LIBRARY.
    * Call generic RPC service module to create security token (Note 1)
     CALL "COBSRVI" USING ERX-COMMUNICATION-AREA
    *   Perform error-handling
     NOT ON EXCEPTION
       IF (COMM-RETURN-CODE = 0) THEN
    *     Perform success-handling
       ELSE
    *     Perform error-handling (See Note 2)
       END-IF
     END-CALL.

After successful return from the generic RPC services module, the required fields in the RPC communication area are properly set, so the non-secure Natural RPC server executes the RPC request in the library set.

Notes:

  1. If both copybooks ERXCOMM and ERXVSTR are used, you need to pass both parameters:
      CALL "COBSRVI" USING ERX-COMMUNICATION-AREA
                           ERX-COMMUNICATION-VSTR.
  2. The field COMM-RETURN-CODE in the RPC communication area contains the error provided by the COBOL Wrapper. For the error messages returned, see Error Messages and Codes.

EXEC CICS LINK Interface

This interface type applies to the scenario Using the COBOL Wrapper for CICS with DFHCOMMAREA Calling Convention (z/OS and z/VSE).

Start of instruction setTo set the Natural library when communicating to a non-secure Natural RPC server

  1. Declare the RPC communication area as described under Step 1: Declare IDL Structures and RPC Communication Area in section Writing EXEC CICS LINK Clients.

  2. Initialize the RPC communication area as described under Step 2: Initialize the RPC Communication Area under Writing EXEC CICS LINK Clients.

  3. Set the library in RPC Communication Area and call generic RPC service module to create a security token with the function Create Security Token CT provided by the generic RPC services module, using EXEC CICS LINK.

      MOVE "CT"   TO COMM-FUNCTION. 
    * Set library in RPC Communication Area
      MOVE "NAT-LIB"   TO COMM-LIBRARY. 
      EXEC CICS LINK PROGRAM  ("COBSRVI")
                   RESP     (CICS-RESP1)
                   RESP2    (CICS-RESP2)
                   COMMAREA (ERX-COMMUNICATION-AREA)
                   LENGTH   (LENGTH OF ERX-COMMUNICATION-AREA)
      END-EXEC. 
      IF WORKRESP = DFHRESP(NORMAL)
         IF (COMM-RETURN-CODE = 0) THEN
    *       Perform success-handling
         ELSE
    *       Perform error-handling (See Note 1)
         END-IF
      ELSE
    *    Perform error-handling
      END-IF.

After successful return from the generic RPC services module, the required fields in the RPC communication area are properly set, so the non-secure Natural RPC server executes the RPC request in the library set.

Notes:

  1. The field COMM-RETURN-CODE in the RPC communication area contains the error provided by the COBOL Wrapper. For the error messages returned, see Error Messages and Codes.