Previous Topic Next topic Print topic


The Reduced Data Transfer Facility

The Client/Server Binding assigns a buffer large enough to hold the data blocks defined in the configuration file. This buffer is transferred back and forth whenever control is shifted between the client and server programs. This can impose a load on the network which some users may find unacceptable. Imagine you have a buffer of 24K which contains a 22K record area. If the file which holds these records has a 10-byte key, sending the key from client to server uses 24K when only 10 bytes are actually required. In reality, you do need one or two bytes more than the size of the data, but much less than the size of the entire buffer. This is what Reduced Data Transfer (RDT) provides, a way for you to control the amount of data being passed across the network and for you to limit this data to the absolute minimum required. When Client/Server Binding is used with AAI, the RDT functions are ignored.

Reduced Data Transfer requires a contol flag (use-rdt) and three parameters:

lnk-usr-fcode The user function indicator. This indicates to the receiver what to do with the data that has just arrived.
lnk-usr-retcode The buffer start point. This indicates which of the four data areas will be used as the start point for the transfer. Valid values are: 1=cblock, 2=dblock, 3=eblk, and 4=ublk. The numbers 11 through 14 can also be used to indicate the same address areas but using data compression. Data compression must have been enabled via a configuration file entry or the base (un-compressed) option will be used. A value of zero results in nothing being transferred. This allows you to have a NULL operation without changing the flow of your code by adding various IF statements. This is useful if you choose to process certain functions locally in order to further reduce network traffic.
lnk-data-length The length of data to be transferred.

Consider an application which allows you to add, delete, and load customer details to/from an index file. The record key for the customer details file is a customer code. The application also has an option to clear all customer information from the interface. The code extract below is based on this example application and uses the user-data-block area to hold the record key which is six bytes long. The data block area (dblksize) used by the application to pass the customer record details between the client and the server is called customer-data-block. The data item customer-c-code is a 6-byte data item within customer-data-block and is used to store the record key.

On the client, the code would be similar to:

     EVALUATE TRUE

      WHEN customer-load-flg-true

*--- User has entered customer code and selected the "LOAD"
*--- option on the interface to read and display the customer
*--- details relating to that code.

          MOVE customer-c-code TO user-data-block
          SET use-rdt TO TRUE
          MOVE 1 TO lnk-usr-fcode
          MOVE 4 TO lnk-usr-retcode
          MOVE 6 TO lnk-data-length

       WHEN customer-del-flg-true

*--- User has entered a customer code selected the DELETE
*--- option to delete the customer record from the file.

          MOVE customer-c-code TO user-data-block
          SET use-rdt TO TRUE
          MOVE 2 TO lnk-usr-fcode
          MOVE 4 TO lnk-usr-retcode
          MOVE 6 TO lnk-data-length
          initialize customer-data-block

       WHEN customer-clr-flg-true

*--- User has selected the CLEAR option to clear the current
*--- customer details from the screen.

          SET use-rdt TO TRUE
          MOVE 0 TO lnk-usr-retcode
          initialize customer-data-block
          PERFORM Set-Up-For-Refresh-Screen
      END-EVALUATE  

The clear option uses a NULL operation because clearing the record is done locally so there is no need to contact the server. Below is an extract from the server program showing the code required to process Reduced Data Transfer. The Client/Server Binding sets the flag send-via-rdt so that you can check the values of lnk-usr-fcode. On the server, the code would be similar to:

       WHEN send-via-rdt
          EVALUATE lnk-usr-fcode
           WHEN 1

*--- For the LOAD function the server program reads the 
*--- customer details from the data file and sends the data
*--- back to the client using the data area customer-data-
*--- block rather using the RDT faclity.  Unless the RDT 
*--- flag is set the client/server bindings will always pass
*--- the complete data area (defined by dblksize in the 
*--- configuration file) between the client and the server.
              MOVE user-data-block TO customer-c-code
              SET customer-load-flg-true TO TRUE
              PERFORM ....... rest of program.......
           WHEN 2
              MOVE user-data-block TO customer-c-code
              SET customer-del-flg-true TO TRUE
              PERFORM ....... rest of program.......
          END-EVALUATE

The Csbind demonstration application uses the Reduced Data Transfer facility.

Previous Topic Next topic Print topic