Performance READ + FIND NUMBER vs. READ + IF ARRAY(*)

  1. Hezi, accessing a 20-record file (FIND) a million times (parent loop) in a single program is bad design. Those million FINDs impact system throughput and every Adabas user. Even for a 20000-record file, you would be executing 50 Adabas commands, on average, for each record. Still not acceptable.

  2. Calling an external routine (subprogram, function, external subroutine) incurs lots of overhead. This increases with more parameters, including array entries.

  3. A colleague, George Vidacovich, demonstrated the speed of binary searches (your copycode) a decade ago and I have used them several times since. They are great.

  4. Compute #OCC = *OCC (#ARRAY) only once, rather than within the REPEAT.

  5. Because both parent and child files are sorted by the same value, replace the binary search with sequential match logic. At the beginning of the program, write the child file to a WORK file. That way you will access each record (parent and child) only once. And no array processing is needed. You will find a sample program attached as a zip file in the link, above.