20031208-Adabas 201 for the Natural Programmer
-
Upload
tlotli-mabetwa -
Category
Documents
-
view
234 -
download
0
Transcript of 20031208-Adabas 201 for the Natural Programmer
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
1/29
Efficient Adabas Access
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
2/29
2
ADABAS Access
READ PHYSICAL
READ BY ISN (GET)
READ LOGICAL
FIND
HISTOGRAM
* Select the correct access method.* Code it efficiently.
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
3/29
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
Restartability not a problem
Safest to run when file not being updated
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
4/29
4
ADABAS Access -READ PHYSICAL
Access to Data Storage only.
Records returned in the order they arestored 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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
5/29
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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
6/29
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 0
128 126 0 125 0 0 0 0 0 128128
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
7/29
7
Natural CommandsREAD Logical
Inverted List
AddressConverter 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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
8/29
8
ADABAS Access -READ LOGICAL
Returns records in sequence byDescriptor, Sub-, or Super-Descriptor
Accesses Inverted List, AddressConverter, and Data Storage
Useful for reading small portion of a file
Consistent performance
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
9/29
9
ADABAS Access - READ LOGICAL
2 1 4 1 2 2 4 1 3 0
0 0 0 0 0 0 0 0 0 0
0
LAST-NAME COUNT
ADAMS 3 2 5 9BAKER 1 4
BROWN 2 1 6
CARLSON 3 3 7 8
ISNS
4 BAKER 8 CARLSON FREE2 ADAMS PADDING
1 BROWN 6 BROWN 5 ADAMS PADDING
9 ADAMS FREE3 CARLSO 7 CARLSON FREE
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
10/29
10
Natural CommandsFIND
Inverted List
AddressConverter
Work
Data Storage
Memory
1
or1
2
3
4or4
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
11/29
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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
12/29
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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
13/29
13
ADABAS Access - FIND
Selects a set of records & returns that setin 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 DSRABN
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
14/29
14
ADABAS Access - FIND
Read block from Data Storage & locaterecord
Repeat for each ISN in the list
FIND SORTED BY - avoid when possible Non descriptor search criteria - ensure it
is not primary criteria
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
15/29
15
ADABAS Access - FINDFIND PERSONNEL WITH NAME = ADAMS
125 125 126 127 126 127 127 127 128 0
128 126 0 125 0 0 0 0 0 128
128
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
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
16/29
16
ADABAS Access - FINDFIND PERSONNEL WITH NAME = ADAMS
125 125 126 127 126 127 127 127 128 0
128 126 0 125 0 0 0 0 0 128
128
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
List for value
ADAMS.
Results in ISN listof 2, 7, 9, 12
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
17/29
17
ADABAS Access - FINDFIND PERSONNEL WITH NAME = ADAMS
125 125 126 127 126 127 127 127 128 0
128 126 0 125 0 0 0 0 0 128
128
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
Converter to
obtain RABN.
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
18/29
18
ADABAS Access - FINDFIND PERSONNEL WITH NAME = ADAMS
125 125 126 127 126 127 127 127 128 0
128 126 0 125 0 0 0 0 0 128
128
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
Storage to
retrieve record.
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
19/29
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. Thismerging is additional work not required by
READ LOGICAL. Access Address Converter and Data Storage.
Records NOT returned in name order!
FIND IN PERSONNEL WITH LAST-NAME = ADAMSTHRU DAVIS
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
20/29
20
ADABAS Access - FIND Should only be used if no work file I/O is
involved (
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
21/29
21
Natural Commands
HISTOGRAM
Inverted List
Use when only descriptor, sub-descriptor or super
descriptor components needed
Use for validation of data
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
22/29
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 eventhough theyre 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 valueof F and
*NUMBER = 234
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
23/29
23
ADABAS Access -HISTOGRAM
Beginning and Ending Values UsuallySpecified.
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 inInverted List - Use HISTOGRAM or FINDNUMBER
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
24/29
24
Direct Calls
How records are accessed by ADABASDirect Call Action Performed
L1 READ by ISN
L2 READ physical
L3 READ logical
L9 HISTOGRAM
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
25/29
25
Direct Calls
How records are accessed by ADABASDirect Call Action Performed
L4 READ by ISN w/ hold
L5 READ physical w/ hold
L6 READ logical w/ hold
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
26/29
26
Direct Calls
How records are accessed by ADABASDirect Call Action Performed
S1 FIND
S4 FIND w/ hold
A1/A4 UPDATE
N1/N4 STORE
E1/E4 DELETE
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
27/29
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 ofdescriptor; Small set of records; sequence notimportant
READ LOGICAL - Most others
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
28/29
28
Natural 4 and Adabas Dynamic change of reading direction within an active
READ or HISTOGRAM processing loop.
Dynamic repositioning within a READ processingloop.
New comparators LESS/GREATER THAN and
LESS/GREATER EQUAL for READ andHISTOGRAM statements.
Support of Multi-Fetch in FIND, HISTOGRAM andREAD 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.
-
8/4/2019 20031208-Adabas 201 for the Natural Programmer
29/29
29
Questions
?