![]() |
|
Natural Tip of Week of June 18, 2008 |
Next |
|
|
Subject:
Natural Performance Tip Communicating to Adabas How many Natual programs exist in your shop that have code that is like the following: Example #1 READ FILEX BY HYPER-KEY = #START-KEY THRU #END-KEY OR Example #2 READ FILEX BY SCALAR-KEY = #START-VALUE Thanks to enhancements in Natural V4 this is no longer necessary. And there is a performance benefit at the same time. The new option 'TO' allows Adabas and not Natural to determine when there are no additional records. This then cuts down on the amount of decompression necessary for Adabas to communicate data back to the invoking program. So for example 2, the code now looks like: READ FILEX BY SCALAR-KEY = #START-VALUE TO #START-VALUE There is no need for the IF test. Why is this important? Take the situation which is common in batch in which a number of records are retrieved based on work file matching for a key value. Also, let's assume the work file contains 500,000 values. The retrieval results in 2.5 million records from the Adabas file. Switching to using the the TO option allows for 500,000 records to not be retrieved since if you use the THRU option it is Natural and not Adabas that results in performing the check. NOTE: The calls are still generated; these are not saved. I believe this is a mistake on Adabas' part to not require a 'last' call to return RC=3. In addition, you can add MULTI-FETCH with impunity as opposed to Prefetch. There are quite a few incidences where I have seen Prefetch definitions attached to a batch job that use maximum buffers as part of the batch job stream. Imagine in example #1 that 100 records can fit into a Prefetch buffer using maximum sizing. If only 5 records qualify for a match, then the remaining 35 records are buffered and returned to ADAPRF - the module in Adabas land for handling Prefetch via Adarun parameters - needlessly. However, when using Natural's MULTI-FETCH capability, eg. READ MULTI-FETCH 10 FILEX even if there are only 5 records the buffers returned to Natural will not contain more than the 5 records that are available since Adabas is smart enough to know there are no more to retrieve and need not de-compress any more records! |
||
Here are three sponsors who have more materials on Natural & Adabas tips and techniques:
![]() |
![]() |
![]() |