Passing a "full" working list between a client and a server system using

Date:Archived
Product/Release:LANSA for Windows
Abstract:Passing a large list from the server to the client with SuperServer has to make allowance for the space limitation which will affect the maximum number of entries which can be passed.
Submitted By:LANSA Technical Support

The following is taken from the LANSA for Windows documentation:

"The aggregate byte length of a working list passed to (or from) a server cannot exceed 9975 bytes. The aggregate byte length is the entry byte length multiplied by the current number of entries."

If a large list is to be passed from the server to the client using SuperServer, the following technique can be used:

  1. Develop an AS/400 "server" function using the following as a model:

Server (AS/400) Function

FUNCTION (*DIRECT *HEAVYUSAGE *NOMESSAGES) RCV_LIST(#INTERCHG)
DEF_LIST #RESULTS FIELDS(…………….) COUNTER(#SVRCOUNT) TYPE(*WORKING) ENTRIES(9999)
DEF_LIST #INTERCHG FIELDS(….same as #RESULTS) COUNTER(#INTERCOUNT) 
	ENTRIES(10,20,30 etc)
EXCHANGE(#SRVCOUNT) OPTION(*ALWAYS)
IF (#CLTCOUNT) = 0)
CLR_LIST #RESULTS)
<<< fill list #RESULTS with the complete results set using whatever
logic is required  >>>
ENDIF
WHILE ((#INTERCOUNT < 10,20,30 etc) *AND (#CLTCOUNT < #SRVCOUNT))
CHANGE #CLTCOUNT (#CLTCOUNT + 1)
GET_ENTRY NUMBER(#CLTCOUNT) FROM_LIST(#RESULTS)
ADD_ENTRY #INTERCHG)
ENDWHILE
RETURN

Client (PC) Function

DEF_LIST #RESULTS FIELDS(…………) COUNTER(#CLTCOUNT) TYPE(*WORKING) ENTRIES(9999)
DEF_LIST #INTERCHG FIELDS(… same as #RESULTS…) COUNTER(#INTERCOUNT)
	 ENTRIES(10 OR 20 etc)
EXCHANGE (#CLTCOUNT) OPTION(*ALWAYS)
<<< whatever  >>>

EXECUTE SUBROUTINE(GET_RESULTS)
<<< list #RESULTS now contains the entire result set produced by the AS/400  >>>
<<< whatever  >>>
 
SUBROUTINE GET_RESULTS
CLR_LIST #RESULTS
  DOUNTIL ‘#CLTCOUNT = #SRVCOUNT'
        CLR_LIST #INTERCHG
        USE CALL_SERVER_FUNCTION (passing list #INTERCHG and use in and out exchanging)
        SELECTLIST #INTERCHG
             ADD_ENTRY #INTERCHG
        ENDSELECT
  ENDUNTIL
ENDROUTINE

Hopefully it is clear that:

  • By using the "interchange" list no significant structural/architectural change either end would be required in an existing application.
  • Up to 9999 list entries can be passed this way (the maximum allowed in a list)
  • The efficiency of the exchange is primarily governed by the number of entries in the "interchange2 list……………
  • The higher the value the higher the efficiency.
  • If a lot of these "list fillers" exist then the following code should be added to the end of the server (AS/400) function so that the function shuts down every time it completes sending and entire list, thus freeing the memory it is using.
IF ‘#CLTCOUNT = #SRVCOUNT'
     USE SET_FOR_LIGHT_USAGE
ENDIF

The #RESULTS list on the client (PC) side can, if required, be defined as a browselist, thus saving the tedious transfer of a working list into a browselist when the results must be subsequently displayed.