A simple RDML program to list off the transactions file and also show full transaction and state descriptions fields might be coded like this:
GROUP_BY NAME(#TRANS) FIELDS(#TRANNUM #TRANDATE #TRANTIME
#TRANTYPE #TRANDESC #TRANUSER #TRANSTATE #STATDESC)
SELECT FIELDS(#TRANS) FROM_FILE(TRANS)
FETCH FIELDS(#TRANS) FROM_FILE(STATES)
WITH_KEY(#TRANSTATE)
FETCH FIELDS(#TRANS) FROM_FILE(TRNTYP)
WITH_KEY(#TRANTYPE)
UPRINT FIELDS(#TRANS)
ENDSELECT
If file TRANS contained 10,000 records this RDML program would do (10,000 + 10,000 + 10,000) = 30,000 database accesses.
However, by using a working list, or the KEEP_LAST parameter on the FETCH commands, the speed of this program can be improved considerably.