by Sandy Zimmer » Mon Nov 24, 2008 6:35 pm
Is this the FINAL input file layout?
Hmmm - well, you need an external sort of your input file prior to your insert program. Sort on airport - airline - then whatever designates arrival/depart - arrival key - depart key. The logic being that if you are positioned on a particular airline/airport in your database, then will not need to issue another "GET" to insert the next record - you are already positioned where you should be. Remember that IMS is positional and to be efficient, think about making your program as efficient as possible.
Set up a couple of areas in working storage called WS-CURR-Key and WS-PREV-Key. Initialize both to spaces - that way you know that you are at the beginning of the file - on your first read, move the key values of your input record to both. On your next input file read, move only to WS-CURR and then compare to WS-PREV. If they are equal, then you do not issue your "GET" on the database - you are correctly positioned.