OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

1.2.2 Creating stubs

UAPs used with the OpenTP1 require libraries for fulfilling inter-UAP service requests. One of these libraries is called a stub.

Organization of this subsection
(1) UAPs requiring stubs
(2) Stub creation procedure
(3) Creation of RPC interface definition file
(4) Name of RPC interface definition file

(1) UAPs requiring stubs

Of all UAPs used with OpenTP1, UAPs having service programs (SPP, MHP) require a stub. However, a stub is not required when all service functions are put in the UAP shared library from where they are dynamically loaded. The UAP shared library is a shared library created by linking the UAP object files compiled from UAP source files.

Note that neither UAPs that handle offline work nor SUPs require a stub because they do not have a service function.

(2) Stub creation procedure

Before creating a stub, create a file (RPC interface definition file) in which UAP service programs are defined. Execute the stbmake command with this file as the argument.

When the stbmake command is executed, a source file (C-language source file) for the stub is created. Compile this file with the C-language compiler and link it to the object file of the UAP.

When modifying the stub, create the UAP from scratch. Modify the RPC interface definition file, recreate the stub, and link it to the object file of the recompiled UAP.

The figure below shows the stub creation procedure.

Figure 1-7 Stub creation procedure

[Figure]

(3) Creation of RPC interface definition file

When creating a stub, create a file which defines program IDs to the SPP and MHP services. What is defined here is called the RPC interface definition. The file containing this definition is called the RPC interface definition file.

Create an RPC interface definition file for each executable file of the SPP or MHP.

(a) Format of RPC interface definition

Write the RPC interface definition in the following format:

Format
entry "program-ID"["program-ID"...];

Description
This statement specifies the names of the program-IDs to the SPP and MHP service programs. Each program ID name must be a COBOL program name. Use 20 characters or fewer to specify each program ID.
The program IDs must correspond to the service names as specified in the user service definition.
Comments can be added to the RPC interface definition. Begin each comment with a forward slash asterisk combination (/*) and terminate it with an asterisk forward-slash combintaion (*/). Comments cannot be nested. Comments cannot be written within a keyword, identifier, or other character string.
More than one entry statement can be written in one file. An example of RPC interface definition is given below.

Example
Specification of RPC interface definition for a UAP which has service programs with their program IDs identified by sv01 and sv02 (use either format below)
entry "sv01";
entry "sv02";
 
entry "sv01" "sv02";

(4) Name of RPC interface definition file

The name of an RPC interface definition file must be appended with a suffix.def which indicates that the file is an RPC interface definition file. The RPC interface definition file may be placed under any directory that the stbmake command can search.

The name of an RPC interface definition file is up to 255 characters long. Note, however, that a lower upper limit is used under some OSs.

After the stbmake command is executed, stub source files are created under names different from those in the RPC interface definition file. Therefore, the RPC interface definition file will not be used when the OpenTP1 is active.