Efficient Adabas Access ADABAS Access Select the correct
Efficient Adabas Access
ADABAS Access * Select the correct access method. * Code it efficiently. • • • 2 READ PHYSICAL READ BY ISN (GET) READ LOGICAL FIND HISTOGRAM
Natural Commands READ Physical Data Storage • Use when reading more than 20% of the records in a file • Generally least expensive method to read all records • Only update if • Potential double updates will not be a problem • Restartability not a problem • Safest to run when file not being updated 3
ADABAS Access READ PHYSICAL • Access to Data Storage only. • Records returned in the order they are stored physically in Data Storage * Can results in 4 I/Os (1 per block) & 14 ADABAS Calls * Order of records returned: 2, 1, 14, 3, 5, 12, 4, 6, 7, 8, 11, 9, 20, 21 4
Natural Commands READ by ISN Address Converter Data Storage • Use when reading more than 20% and some updating • ISN use ensures no double updates & no missed updates • ISN may be used as restart point • Second fastest access method • Used when updating file but not one for one with the outside loop 5
ADABAS Access READ BY ISN • Access to Address Converter & Data Storage • Records returned in ascending ISN order 6
Natural Commands READ Logical 1 2 4 Inverted List Address Converter Data Storage 3 • Use when reading 1 record or a small range of records • Returned in sorted order by index read • Be careful when updating read key fields 7
ADABAS Access READ LOGICAL • Returns records in sequence by Descriptor, Sub-, or Super-Descriptor • Accesses Inverted List, Address Converter, and Data Storage • Useful for reading small portion of a file • Consistent performance 8
ADABAS Access - READ LOGICAL 9
Natural Commands FIND Memory 1 or 1 Inverted List 4 or 4 Work Address Converter 2 3 10 Data Storage
Natural Commands FIND • Useful for accessing small groups of records with one or more selection criteria • Returns records in *ISN sequence • A FIND which selects a set of records > 51 will generate I/O to work part 3 • Complex FINDs can generate I/O to work part 2 11
Natural Commands FIND • Simple find (algorithm 1): LAST-NAME = ‘BROWN’ • Moderate complexity (algorithm 2): LAST-NAME = ‘BROWN’ OR ‘JONES’ • Complex FIND (algorithm 4): FIND PERSONNEL WITH AGE > #AGE AND SEX = #SEX AND VET-STATUS = ‘V’ 12
ADABAS Access - FIND • Selects a set of records & returns that set in ISN sequence • Access Inverted List & select set of records which meet search criteria • If number of ISNs > 51, ADABAS uses Work DS • Access Address Converter to obtain DS RABN 13
ADABAS Access - FIND • Read block from Data Storage & locate record • Repeat for each ISN in the list • FIND SORTED BY - avoid when possible • Non descriptor search criteria - ensure it is not primary criteria 14
ADABAS Access - FIND PERSONNEL WITH NAME = ‘ADAMS’ 15
ADABAS Access - FIND PERSONNEL WITH NAME = ‘ADAMS’ Access Inverted List for value ADAMS. Results in ISN list of 2, 7, 9, 12 16
ADABAS Access - FIND PERSONNEL WITH NAME = ‘ADAMS’ Access Address Converter to obtain RABN. 17
ADABAS Access - FIND PERSONNEL WITH NAME = ‘ADAMS’ Access Data Storage to retrieve record. 18
ADABAS Access - FIND IN PERSONNEL WITH LAST-NAME = ‘ADAMS’ THRU ‘DAVIS’ • Access Inverted List for ‘ADAMS’, ‘BAKER’, ‘CHARLES’, ‘DAVENPORT’, and ‘DAVIS’ • Form ISN list: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 20, 21. This merging is additional work not required by READ LOGICAL. • Access Address Converter and Data Storage. • Records NOT returned in name order! 19
ADABAS Access - FIND • Should only be used if no work file I/O is involved (<51 records). • Useful for multiple, non-contiguous values of descriptor (NAME = ‘SMITH’ OR = ‘CARROLL’ OR = ‘JONES’). • Trade offs between READ logical and FIND. 20
Natural Commands HISTOGRAM Inverted List • Use when only descriptor, sub-descriptor or super descriptor components needed • Use for validation of data 21
ADABAS Access HISTOGRAM • Only has Access to the Inverted Lists. • Returns two items: – Value of descriptor – Number of records which have that value • ISNs are NOT returned to Natural even though they’re in the inverted lists. 1. Returns value of ‘F’ and *NUMBER = 234 22
ADABAS Access HISTOGRAM • Beginning and Ending Values Usually Specified. • Efficient way to determine if a particular value exists for a descriptor. • Efficient way to determine how many records have a particular value for a descriptor. • If all data for requirements is available in Inverted List - Use HISTOGRAM or FIND NUMBER 23
Direct Calls How records are accessed by ADABAS 24 Direct Call Action Performed L 1 READ by ISN L 2 READ physical L 3 READ logical L 9 HISTOGRAM
Direct Calls How records are accessed by ADABAS 25 Direct Call Action Performed L 4 READ by ISN w/ hold L 5 READ physical w/ hold L 6 READ logical w/ hold
Direct Calls How records are accessed by ADABAS 26 Direct Call Action Performed S 1 FIND S 4 FIND w/ hold A 1/A 4 UPDATE N 1/N 4 STORE E 1/E 4 DELETE
ADABAS Access - SUMMARY • GET - Reread Record • HISTOGRAM - All required data available in Inverted List • READ PHYSICAL - More than 20% of file and no updates • READ BY ISN - More than 20% of file and updates • FIND - Multiple, non-contiguous values of descriptor; Small set of records; sequence not important • READ LOGICAL - Most others 27
Natural 4 and Adabas • Dynamic change of reading direction within an active READ or HISTOGRAM processing loop. • Dynamic repositioning within a READ processing loop. • New comparators LESS/GREATER THAN and LESS/GREATER EQUAL for READ and HISTOGRAM statements. • Support of Multi-Fetch in FIND, HISTOGRAM and READ statements. • New keyword TO that enables end of range condition (ENDING AT) to be controlled by the database itself. • Support of the Adabas Transaction Manager. 28
Questions ? 29
- Slides: 29