+ All Categories
Home > Documents > Adabas 201 for the Natural Programmer

Adabas 201 for the Natural Programmer

Date post: 23-Oct-2015
Category:
Upload: jorge-armas-ramirez
View: 121 times
Download: 10 times
Share this document with a friend
29
Efficient Adabas Access
Transcript
Page 1: Adabas 201 for the Natural Programmer

Efficient Adabas Access

Page 2: Adabas 201 for the Natural Programmer

2

ADABAS Access

• READ PHYSICAL• READ BY ISN (GET)• READ LOGICAL• FIND• HISTOGRAM

* Select the correct access method.

* Code it efficiently.

Page 3: Adabas 201 for the Natural Programmer

3

Natural CommandsREAD 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

• Restorability not a problem

• Safest to run when file not being updated

Page 4: Adabas 201 for the Natural Programmer

4

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* 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* Order of records returned: 2,1,14,3,5,12,4,6,7,8,11,9,20,21

Page 5: Adabas 201 for the Natural Programmer

5

Natural CommandsREAD by ISN

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

Address Converter

Page 6: Adabas 201 for the Natural Programmer

6

ADABAS Access - READ BY ISN

• Access to Address Converter & Data Storage• Records returned in ascending ISN order

125 125 126 127 126 127 127 127 128 0128 126 0 125 0 0 0 0 0 128128 …

Page 7: Adabas 201 for the Natural Programmer

7

Natural CommandsREAD Logical

Inverted List

Address Converter Data Storage

• 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

1

2

3

4

Page 8: Adabas 201 for the Natural Programmer

8

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

Page 9: Adabas 201 for the Natural Programmer

9

9

ADABAS Access - READ LOGICAL

2 1 4 1 2 2 4 1 3 00 0 0 0 0 0 0 0 0 00 …

LAST-NAME COUNTADAMS 3 2 5 9BAKER 1 4BROWN 2 1 6CARLSON 3 3 7 8

ISNS

4 BAKER 8 CARLSON FREE2 ADAMS PADDING1 BROWN 6 BROWN 5 ADAMS PADDING9 ADAMS FREE3 CARLSON 7 CARLSON FREE

* Access inverted list for ADAMS* Access Address Converter and pick up second entry (RABN of ISN 2)* Access block 125 of data storage.* Move across block to record with ISN 2 (first in block)* Access Address Converter and pick up seventh entry (RABN of ISN 7)* Access block 127 of data storage* Move across block to record with ISN 7 (3rd record)* Repeat Address Converter/data storage access for records with ISNs 9 and 12* Access Inverted List for Baker.* Access Address Converter and pick up 1st entry (RABN of ISN 1)* Continue as above for remaining BAKERs, CHARLES, DAVENPORT and DAVIS.

Page 10: Adabas 201 for the Natural Programmer

10

Natural CommandsFIND

Inverted List

Address Converter

Work

Data Storage

Memory1 or 1

2

3

4 or 4

Page 11: Adabas 201 for the Natural Programmer

11

Natural CommandsFIND

• 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

Page 12: Adabas 201 for the Natural Programmer

12

Natural CommandsFIND

• 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’

Page 13: Adabas 201 for the Natural Programmer

13

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

Page 14: Adabas 201 for the Natural Programmer

14

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

Page 15: Adabas 201 for the Natural Programmer

15

ADABAS Access - FINDFIND PERSONNEL WITH NAME = FIND PERSONNEL WITH NAME = ‘‘ADAMSADAMS’’

125 125 126 127 126 127 127 127 128 0128 126 0 125 0 0 0 0 0 128128 …

Value Count ----------------------ISNs---------------------------------------------------------------------------------- ADAMS 4 2 7 9 12 … BAKER 3 1 3 20 CHARLES 3 5 6 8 DAVENPORT 2 11 21 DAVIS 2 4 14

Page 16: Adabas 201 for the Natural Programmer

16

ADABAS Access - FINDFIND PERSONNEL WITH NAME = FIND PERSONNEL WITH NAME = ‘‘ADAMSADAMS’’

125 125 126 127 126 127 127 127 128 0128 126 0 125 0 0 0 0 0 128128 …

Value Count ----------------------ISNs---------------------------------------------------------------------------------- ADAMS 4 2 7 9 12 … BAKER 3 1 3 20 CHARLES 3 5 6 8 DAVENPORT 2 11 21 DAVIS 2 4 14

Access Inverted Access Inverted List for value List for value ADAMS.ADAMS.

Results in ISN list Results in ISN list of 2, 7, 9, 12of 2, 7, 9, 12

Page 17: Adabas 201 for the Natural Programmer

17

ADABAS Access - FINDFIND PERSONNEL WITH NAME = FIND PERSONNEL WITH NAME = ‘‘ADAMSADAMS’’

125 125 126 127 126 127 127 127 128 0128 126 0 125 0 0 0 0 0 128128 …

Value Count ----------------------ISNs---------------------------------------------------------------------------------- ADAMS 4 2 7 9 12 … BAKER 3 1 3 20 CHARLES 3 5 6 8 DAVENPORT 2 11 21 DAVIS 2 4 14

Access Address Access Address Converter to Converter to obtain RABN.obtain RABN.

Page 18: Adabas 201 for the Natural Programmer

18

ADABAS Access - FINDFIND PERSONNEL WITH NAME = FIND PERSONNEL WITH NAME = ‘‘ADAMSADAMS’’

125 125 126 127 126 127 127 127 128 0128 126 0 125 0 0 0 0 0 128128 …

Value Count ----------------------ISNs---------------------------------------------------------------------------------- ADAMS 4 2 7 9 12 … BAKER 3 1 3 20 CHARLES 3 5 6 8 DAVENPORT 2 11 21 DAVIS 2 4 14

Access Data Access Data Storage to Storage to retrieve record.retrieve record.

Page 19: Adabas 201 for the Natural Programmer

19

ADABAS Access - FIND

• 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!

FIND IN PERSONNEL WITH LASTFIND IN PERSONNEL WITH LAST--NAME = NAME = ‘‘ADAMSADAMS’’ THRU THRU ‘‘DAVISDAVIS’’

Page 20: Adabas 201 for the Natural Programmer

20

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.

Page 21: Adabas 201 for the Natural Programmer

21

Natural CommandsHISTOGRAM

Inverted List

• Use when only descriptor, sub-descriptor or super descriptor components needed

• Use for validation of data

Page 22: Adabas 201 for the Natural Programmer

22

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.

Sex Value Count -----------ISNs------------------------------------------------------------------------------------------------------------------ F 234 2 3 7 9 10 11 15 16 17 21 25 …

M 293 1 4 5 6 8 12 13 14 18 19 20 …

1. Returns value 1. Returns value of of ‘‘FF’’ and and *NUMBER = 234*NUMBER = 234

Page 23: Adabas 201 for the Natural Programmer

23

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

Page 24: Adabas 201 for the Natural Programmer

24

Direct CallsHow records are accessed by ADABAS

Direct Call Action Performed

L1 READ by ISN

L2 READ physical

L3 READ logical

L9 HISTOGRAM

Page 25: Adabas 201 for the Natural Programmer

25

Direct CallsHow records are accessed by ADABAS

Direct Call Action Performed

L4 READ by ISN w/ hold

L5 READ physical w/ hold

L6 READ logical w/ hold

Page 26: Adabas 201 for the Natural Programmer

26

Direct CallsHow records are accessed by ADABAS

Direct Call Action Performed

S1 FIND

S4 FIND w/ hold

A1/A4 UPDATE

N1/N4 STORE

E1/E4 DELETE

Page 27: Adabas 201 for the Natural Programmer

27

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

Page 28: Adabas 201 for the Natural Programmer

28

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.

Page 29: Adabas 201 for the Natural Programmer

29

Questions

?


Recommended