I would like to post this question and start some discussion on everyone's view of the best way to accomplish the following: I have file A that is a "header" file (contains invoice header). I have file B that is a "detail" file (contains invoice line items). The key on file B is Invoice Number and Sequence Number When I read a record from file A, I then need to get all the detail records. This is the way I typically do it: I define a key list for file B as INVCNBR and SEQNBR. Then I set the INVCNBR and set the SEQNBR to *LOVAL. Then I perform a SETLL followed by a READ. Then I start a loop while the indicator from the READ is *OFF. Inside the loop I then check to see if the INVCNBR has gone out of key sequence, in which case I can drop out of the loop. If not, I process the record, perform a read and loop to the top. What are thoughts of doing a READE instead, or can you define a key list on just partial fields in the file's key list? (In this case, I mean defining a key list on just INVCNBR and performing a READE in my loop so I don't have to keep checking to see if the INVCNBR is different than the header file's INVCNBR field.) Any thoughts everyone? ==Scott==

Reply With Quote