Using an existing Dialog System program as the server module

When used with CCI, the Client/Server Binding has the ability to use an existing Dialog System program as the user server module. It does this when srvtier=your-program (for details, see Configuration File Parameters).

In this instance, mfserver expects to be called with a set of parameters which conform to the Dialog System API. When used in this way, the user program makes calls to mfserver to transfer data to the client and so becomes the controlling element on the server. It is possible to have other programs perform the same function, as long as they conform to the API used by Dialog System.

The Client/Server Binding normally checks certain items within the first parameter of the API, and performs particular functions based on the value found. This behaviour can be prevented by setting these items to HIGH-VALUES. You need to call mfserver with two parameters:

The size of both these items needs to be defined in the configuration file used to run the application. A pair of demo programs and the necessary configuration file have been provided here as an example, they are:

When compiled and run, the server program passes data to the client without losing its position which would occur if it was a called program and had to use an 'EXIT PROGRAM' each time data needed to be passed to the client. If your existing program is unable to conform to the required Dialog System API, you can still use the above method by introducing a small bridge program as decribed below.

 WORKING-STORAGE SECTION.

 01  dummy-control-block          PIC X(6) VALUE HIGH-VALUES.
 01  grouped-data-block.
   03  ws-param-1                PIC X(50).
    03  ws-param-2                PIC X(120).
    03  ws-param-3                PIC X(18).
    03  ws-param-4                PIC X(48).

 LINKAGE SECTION.

 01  lnk-param-1                  PIC X(50).
 01  lnk-param-2                  PIC X(120).
 01  lnk-param-3                  PIC X(18).
 01  lnk-param-4                  PIC X(48).

 PROCEDURE DIVISION USING
         lnk-param-1 lnk-param-2
         lnk-param-3 lnk-param-4.

     MOVE lnk-param-1 TO ws-param-1
     MOVE lnk-param-2 TO ws-param-2
     MOVE lnk-param-3 TO ws-param-3
     MOVE lnk-param-4 TO ws-param-4

     CALL "mfserver" USING dummy-control-block
                            grouped-data-block

     MOVE ws-param-1 TO lnk-param-1
     MOVE ws-param-2 TO lnk-param-2
     MOVE ws-param-3 TO lnk-param-3
     MOVE ws-param-4 TO lnk-param-4

     EXIT PROGRAM.