Patrick, Allocating a new area and copying the existing area is going to create significant performance issues, as well as fragmenting storage, which is very bad in an online environment.
Is there an architected upper limit to the number of entries? You said in a subsequent post that you are NOT using CICS. Can you tell us what the environment is? John P. Baker -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Patrick Roehl Sent: Monday, August 23, 2010 10:46 AM To: [email protected] Subject: Efficient Memory List I’m looking for advice on how to handle a potentially large list of data. The list is comprised of 4-byte entries and the application needs to know if an incoming item is already present or is new to the list. This is the approach that is currently in use and that I’d like to improve upon: 1) Perform a binary search and process no further if the item is already present 2) If there is not enough room to add a new entry, allocate a new storage area 1.5 times the size of the old area, MVCL the existing data to the new area, and free the old area. 3) The binary search from step 1 indicates where the new entry should be inserted. To add the entry to the list, individual entries are moved one at a time (to avoid overlapping moves) to open a spot in the list for the new entry. This old process has worked well for fairly small lists but I’d like opinions on how to improve this process for large lists (say, a million or more). Using SORT is not an option because of the multi-threaded online environment (it’s running in CICS). The list is only used by a single process that handles data as it arrives. To process correctly, it must be able to determine immediately if the data being presented has already been processed. When all of the incoming data for that process has been handled the list is discarded. Speed and efficiency are important. All suggestions regarding logic and coding techniques are appreciated!
