Previous Topic Next topic Print topic


Connecting Your Server Program to mfserver

The mfclient and mfserver modules pass information to each other via a parameter block described in the mfclisrv.cpy copyfile. The modules use the same parameter block to pass information to any user programs.

Your server program must include the copyfile, mfclisrv.cpy in the Linkage Section. You must also modify the Procedure Division header to include the parameter block, LNK-PARAM-BLOCK, which is used to pass parameters from mfserver.

This is shown below in the example server code:

 LINKAGE SECTION.

 01 INPUT-REC                 PIC X(32767).

 COPY "MFCLISRV.CPY".*--- lnk-param-block is the record definition in mfclisrv.cpy

 PROCEDURE DIVISION USING LNK-PARAM-BLOCK.

 CONTROLLING SECTION.

*-----------------------------------------------------------*
*  associate the user data area with the pointer in
*  lnk-parm-block.
*-----------------------------------------------------------*

     SET ADDRESS OF INPUT-AREA TO LNK-DBLOCK-PTR.

     EVALUATE TRUE

      WHEN START-CONNECTION
         PERFORM PROGRAM-INITIALIZE

      WHEN OTHER
         PERFORM PROGRAM-BODY

     END-EVALUATE.
     EXIT PROGRAM.

 PROGRAM-INITIALIZE SECTION.

*--- This code would include the initialization code
*--- for your server program eg. opening your application
*--- data files.

     ......

 PROGRAM-BODY SECTION.

*--- This section would include your application
*--- processing code eg. read and writing of data
*--- files.

     ......

If you choose to handle error message displays yourself, you will need to add code similar to the following to your program's initial EVALUATE statement:

           WHEN COMMS-ERROR
              PERFORM SHOW-ERROR

           ......

 SHOW-ERROR SECTION.
     DISPLAY LNK-ERROR-LOC AT 2201
     DISPLAY LNK-ERROR-MSG AT 2301 WITH SIZE LNK-ERROR-MSG-LEN.
     EXIT.
Previous Topic Next topic Print topic