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:
$set ans85 WORKING-STORAGE SECTION. 01 w-prog-id pic x(30) value '"@(#) nodscli.cbl 1.1.1"'. copy "mfclisrv.cpy". 01 ws-scrn-pos. 03 ws-line pic 99 value 07. 03 ws-col pic 99 value 1. LINKAGE SECTION. 01 ds-control-block pic x(6). 01 NODS-DATA-BLOCK. 03 NODS-PARAM PIC 99. 03 NODS-DATA PIC X(120). procedure division. 000-control section. * Make initial contact with the server call lnk-client using lnk-param-block if start-connection set address of ds-control-block to lnk-cblock-ptr set address of nods-data-block to lnk-dblock-ptr end-if display spaces at 0101 "Starting Test Session" at 0510 perform 010-run-test until nods-param = 10 * Send disconnect request set client-ending to true call lnk-client using lnk-param-block display "Test Session Completed" at 2010 stop run. 010-run-test section. * Get data from server call lnk-client using lnk-param-block add 1 to ws-line display nods-data(1:80) at ws-scrn-pos exit.
$set ans85 working-storage section. 01 w-prog-id pic x(30) value '"@(#) nodssrv.cbl 1.1.1"'. 01 dummy-cntrl-block pic x(6) value high-values. 01 NODS-DATA-BLOCK. 03 NODS-PARAM PIC 99. 03 NODS-DATA PIC X(120). copy "mfclisrv.cpy". 01 ws-sub pic 99. 01 ws-table. 03 ws-letts pic x occurs 10. procedure division. controlling section. move "ABCDEFGHIJ" to ws-table move 0 to nods-param * * Establish contact with the client. * This needs to be done as early as possible to stop the * Client timing out and 'polling' the network looking for * the server. * call "mfserver" using dummy-cntrl-block nods-data-block * * You must ensure that you don't call 'mfserver' after the * client has issued a shutdown request. In this system * nods-param = 10 causes to client to issue the shutdown * request and ends the driving loop in this program. * perform varying nods-param from 1 by 1 until nods-param > 10 perform varying ws-sub from 1 by 1 until ws-sub > 80 move ws-letts(nods-param) to nods-data(ws-sub:1) end-perform call "mfserver" using dummy-cntrl-block nods-data-block end-perform stop run.
********************************************************* * Micro Focus - Client Server Module Configuration File * ********************************************************* [mf-clisrv] srvtier=nodssrv cblksize=6 dblksize=122 servername=nods
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.