EntireX Version 9.7
 —  EntireX COBOL Wrapper  —

Client and Server Examples for BS2000/OSD

This document describes the examples provided for the COBOL Wrapper for BS2000/OSD. It covers the following topics:


Overview of Client and Server Examples for BS2000/OSD

The following examples are delivered for BS2000/OSD:

All examples here can be found in the EntireX directory examples/RPC under UNIX and Windows. If EntireX is installed under BS2000/OSD, the examples are also available on this platform.

CALC Example

Client

Element Type LMS Library Comment Notes
CREATE-CALC-CLIENT J EXP811.COBC S-procedure to generate the CALC COBOL sample client application. It makes use of RUN-COBOL-COMPILER and BIND-CALC-CLIENT. 2
BIND-CALC-CLIENT J EXP811.COBC S-procedure to bind the CALC COBOL sample client application.  
RUN-COBOL-COMPILER J EXP811.COBC S-procedure to run the COBOL2000 / COBOL85 compiler. 2
RUN-CALC-CLIENT J EXP811.COBC S-procedure to run the CALC COBOL sample client application.  
CALCCLT.COB S EXP811.COBC Main program source of the CALC COBOL example. 1
CALC.COB S EXP811.COBC COBOL RPC client interface object. 1
CALC S EXP811.COBC COBOL RPC interface copybook. 1
COBSRVI.COB S EXP811.COBC Generic RPC service. 1
ERXCOMM S EXP811.COBC Layout of the RPC communication area. See The RPC Communication Area (Reference). 1
CLIENT-ADAPARM S EXP811.COBC Adabas ADALNK IDTNAME parameter required when using the NET transport method. It is shared by all clients.  
CLIENT-INPARM-CALC S EXP811.COBC CALC client input parameters.  

Server

Element Type LMS Library Comment Notes
CREATE-CALC-SERVER J EXP811.COBS S-procedure to generate the CALC COBOL example server. It makes use of RUN-COBOL-COMPILER. 2
RUN-COBOL-COMPILER J EXP811.COBS S-procedure to run the COBOL2000 / COBOL85 compiler. 2
CALC.COB S EXP811.COBS Server program source of CALC COBOL example. 1

SQUARE Example

Client

Element Type LMS Library Comment Notes
CREATE-SQUARE-CLIENT J EXP811.COBC S-procedure to generate the SQUARE COBOL sample client application. It uses RUN-COBOL-COMPILER and BIND-SQUARE-CLIENT. 2
BIND-SQUARE-CLIENT J EXP811.COBC S-procedure to bind the SQUARE COBOL sample client application.  
RUN-COBOL-COMPILER J EXP811.COBC S-procedure to run the COBOL2000 / COBOL85 compiler. 2
RUN-SQUARE-CLIENT J EXP811.COBC S-procedure to run the SQUARE COBOL sample client application.  
SQRECLT.COB S EXP811.COBC Main program source of SQUARE COBOL example. 1
SQUARE.COB S EXP811.COBC COBOL RPC client interface object. 1
SQUARE S EXP811.COBC COBOL RPC interface copybook. 1
COBSRVI.COB S EXP811.COBC Generic RPC service. 1
ERXCOMM S EXP811.COBC Layout of the RPC communication area. See The RPC Communication Area (Reference). 1
CLIENT-ADAPARM S EXP811.COBC Adabas ADALNK IDTNAME parameter required when using the NET transport method. It is shared by all clients  
CLIENT-INPARM-SQUARE S EXP811.COBC SQUARE client input parameters.  

Server

Element Type LMS Library Comment Notes
CREATE-SQUARE-SERVER J EXP811.COBS S-procedure to generate the SQUARE COBOL sample server. It uses RUN-COBOL-COMPILER. 2
RUN-COBOL-COMPILER J EXP811.COBS S-procedure to run the COBOL2000 / COBOL85 compiler. 2
SQUARE.COB S EXP811.COBS Server program source of the SQUARE COBOL example. 1

SENDMAIL Reliable RPC Example

Client

Element Type LMS Library Comment Notes
CREATE-MAIL-CLIENT J EXP811.COBC S-procedure to generate the SENDMAIL reliable RPC COBOL sample client application. It uses RUN-COBOL-COMPILER and BIND-MAIL-CLIENT. 2
BIND-MAIL-CLIENT J EXP811.COBC S-procedure to bind the SENDMAIL reliable RPC COBOL sample client application.  
RUN-COBOL-COMPILER J EXP811.COBC S-procedure to run the COBOL2000 / COBOL85 compiler. 2
RUN-MAIL-CLIENT J EXP811.COBC S-procedure to run the SENDMAIL reliable RPC COBOL sample client application.  
MAILCLT.COB S EXP811.COBC Main program source of the SENDMAIL reliable RPC COBOL example. 1
SENDMAIL.COB S EXP811.COBC COBOL RPC client interface object. 1
SENDMAIL S EXP811.COBC COBOL RPC interface copybook. 1
COBSRVI.COB S EXP811.COBC Generic RPC service. 1
ERXCOMM S EXP811.COBC Layout of the RPC communication area. See The RPC Communication Area (Reference). 1
CLIENT-ADAPARM S EXP811.COBC Adabas ADALNK IDTNAME parameter required when using the NET transport method. It is shared by all clients.  
CLIENT-INPARM-MAIL S EXP811.COBC SENDMAIL reliable RPC client input parameters.  

Server

Element Type LMS Library Comment Notes
CREATE-MAIL-SERVER J EXP811.COBS S-procedure to generate the SENDMAIL reliable RPC COBOL sample server. It makes use of RUN-COBOL-COMPILER. 2
RUN-COBOL-COMPILER J EXP811.COBS S-procedure to run the COBOL2000 / COBOL85 compiler. 2
SENDMAIL.COB S EXP811.COBS Server program source of the SENDMAIL reliable RPC COBOL example. 1

Notes

  1. When compiling the COBOL client and server sample source programs, the compiler may issue warnings depending on the compiler used. These warnings can be ignored.

  2. The default configuration expects a COBOL2000 environment. Depending on your installation it might be necessary to change the COMPILER parameter within the parameter declaration section of the procedures. The delivered procedures support both COBOL2000 and COBOL85 syntax.

Top of page

Creating the Sample COBOL Client Programs

To create the CALC, SQUARE and SENDMAIL clients, parametrize S-procedures CREATE-CALC-CLIENT, CREATE-SQUARE-CLIENT and CREATE-MAIL-CLIENT in EXP811.COBC and choose the compiler installed on your system.

For more details, see also see the procedure headers in the delivered job control.

Enter the following commands:

Procedure Parameter Description Default
EXP-COB-CLT COBOL client examples library EXP811.COBC
COMPILER The COBOL compiler to be used: COBOL2000 or COBOL85 COBOL2000

For more details, see also see the procedure headers in the delivered job control.

Enter the following commands:

/CALL-PROCEDURE *LIB(LIB=EXP811.COBC,ELE=CREATE-CALC-CLIENT)
/CALL-PROCEDURE *LIB(LIB=EXP811.COBC,ELE=CREATE-SQUARE-CLIENT)
/CALL-PROCEDURE *LIB(LIB=EXP811.COBC,ELE=CREATE-MAIL-CLIENT)

These procedures call the COBOL compiler and binder to generate corresponding L-elements stored in the EXP-COB-CLT library (the default is EXP811.COBC).

Top of page

Creating the Sample COBOL Server Programs

To create the CALC, SQUARE and SENDMAIL server programs, parametrize S-procedures CREATE-CALC-SERVER, CREATE-SQUARE-SERVER and CREATE-MAIL-SERVER in EXP811.COBS and choose the compiler installed on your system.

Procedure Parameter Description Default
EXP-SRV-LIB COBOL server examples library EXP811.COBS
COMPILER The COBOL compiler to be used: COBOL2000 or COBOL85 COBOL2000

For more details, see also see the procedure headers in the delivered job control.

Enter the following commands:

/CALL-PROCEDURE *LIB(LIB=EXP811.COBS,ELE=CREATE-CALC-SERVER)
/CALL-PROCEDURE *LIB(LIB=EXP811.COBS,ELE=CREATE-SQUARE-SERVER)
/CALL-PROCEDURE *LIB(LIB=EXP811.COBS,ELE=CREATE-MAIL-SERVER)

These procedures call the COBOL Compiler to generate three corresponding object modules stored as R-elements in EXP-SRV-LIB (the default is EXP811.COBS).

There is no need to link the object modules with the BS2000/OSD Common Runtime Environment (CRTE) library. The CRTE is loaded once dynamically in the corresponding worker task of the RPC server where the server program is executed.

Top of page

Running the Sample COBOL Client Programs

Running the CALC client is described below. Running the SQUARE and the SENDMAIL clients is similar.

Start of instruction setTo run the CALC client

  1. Adapt S-element CLIENT-INPARM-CALC in EXP811.COBC.

    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    *             Example CALC Client Input Parameter                 *
    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    BROKERID <ipaddr>:<port>:TCP                                      *
    * BROKERID ETB<nnnnn>::NET                                        *
    * USERID   <userid>                                               *
    * PASSWORD <password>                                             *
    CLASS    RPC                                                      *
    SERVER   SRV1                                                     *
    SERVICE  CALLNAT                                                  *
    LOGON                                                             *
    CALC     + 00012345 00067890                                      *
    CALC     - 00067890 00012345                                      *
    CALC     * 00001234 00005678                                      *
    CALC     / 00005678 00001234                                      *
    CALC     % 00005678 00001234                                      *
    LOGOFF                                                            *
    END

    Set up BROKERID in one of two formats, depending on the transport method:

  2. Adapt S-element CLIENT-ADAPARM.

    If "NET" is chosen as transport method, specify the name of the ID table to which the broker is connected:

    ADALNK IDTNAME=ADAxxxxx
    where xxxxx is any uppercase value.

    This parameter is shared between all sample clients.

  3. Make sure the RPC server runs as COBOL RPC server (refer to the RPC-CONFIG S-element in library EXP811.JOBS) and library EXP811.COBS is included as PROGRAM-LIB in the start up procedure START-RPC-SERVER.

  4. Enter the following command to run the CALC COBOL example client:

    /CALL-PROCEDURE *LIB(LIB=EXP811.COBC,ELE=RUN-CALC-CLIENT)
    
    
    CALCCLT : START
    OPEN  IN: -------- : <00>
            : BROKERID : ETB001
            : CLASS    : RPC
            : SERVER   : SRV1
            : SERVICE  : CALLNAT
    CALCCLT : BROKER LOGON.
    CALC called successfully: 000012345 + 000067890 = 000080235
    CALC called successfully: 000067890 - 000012345 = 000055545
    CALC called successfully: 000001234 * 000005678 = 007006652
    CALC called successfully: 000005678 / 000001234 = 000000004
    CALC called successfully: 000005678 % 000001234 = 000000742
    CALCCLT : BROKER LOGOFF.
    CLOSE IN: -------- : <00>
    CALCCLT : LEAVE

Top of page