First Improved Example
From Visual LANSA
First Improved Example
The first method of improving the performance of this RDML program by using working lists involved loading the entire STATES file into a list when the program first starts and then replacing the FETCH command with a LOC_ENTRY command:
GROUP_BY NAME(#TRANS) FIELDS(#TRANNUM #TRANDATE #TRANTIME
#TRANTYPE #TRANDESC #TRANUSER #TRANSTATE #STATDESC)
DEF_LIST NAME(#STATES) FIELDS(#STATCODE #STATDESC)
TYPE(*WORKING) ENTRYS(10)
SELECT FIELDS(#STATES) FROM_FILE(STATES)
ADD_ENTRY TO_LIST(#STATES)
ENDSELECT
SELECT FIELDS(#TRANS) FROM_FILE(TRANS)
LOC_ENTRY IN_LIST(#STATES) WHERE('#STATCODE = #TRANSTATE')
FETCH FIELDS(#TRANS) FROM_FILE(TRNTYP)
WITH_KEY(#TRANTYPE)
UPRINT FIELDS(#TRANS)
ENDSELECT
In the case where file TRANS contained 10,000 records and file STATES contained 6 records, this program would now do (10,000 + 6 + 10,000) = 20,006 database accesses, a net improvement of 9,994 less I/Os. The run time would probably be about 2/3 of the original version of the program.