The range of pages reserved for an area is defined by the FROM PAGE parameter in conjunction with the MAXIMUM SPACE parameter (or the PRIMARY SPACE parameter if you do not specify MAXIMUM SPACE). This page range must not overlap the page range for:
Page ranges within a segment can be, but do not have to be, contiguous with one another.
The highest page number for an area depends on the maximum number of records or rows that can fit on a single page. Use the table provided under "Usage" in 7.16, “SEGMENT Statements” to determine the highest page number.
The last page of a subarea that can be used to store CALC record occurrences depends on the type of offset specification:
calc-lastpage-of-subarea =
firstpage-of-subarea + percent * primary-page-count * .01
When you expand an area by using the EXTEND SPACE clause on the ALTER AREA command, the following occurs to the first page, last page, and CALC last page of a subarea:
Note: You must exercise care when expanding an area containing subarea definitions that use offset percentages because subareas can overlap after the EXTEND SPACE is performed. For example:
Given the following subarea allocations for an area containg 1000 pages, the page ranges are as follows:
Definition LoPage HiPage
SUB1 OFFSET 0% FOR 25% 1 250
SUB2 OFFSET 25% FOR 25% 251 500
SUB3 OFFSET 50% FOR 25% 501 750
SUB4 OFFSET 75% FOR 25% 751 1000
If an EXTEND SPACE is executed, and 1000 more pages are added to the area, the allocations are as follows:
Sub Area LoPage HiPage SUB1 1 500 SUB2 251 750 SUB3 501 1000 SUB4 751 1250
You can see that adding 1000 pages to the area did not significantly increase the space available in which to store records, nor did the additional space get used by any areas mapped to defined subarea definitions—only SUB4 benefits by the additional pages.
Percentage offset specifications are the most flexible in terms of database maintenance. As the database grows and must eventually be expanded, the areas of the database must also be expanded. If you use percentage offsets, CA IDMS/DB automatically assigns record occurrences to the appropriate percentage of the new area.
CA IDMS/DB constructs the db-key for a record in an RRDS native VSAM area in the following manner:
dbkey = low-dbkey-of-area + relative-record-number
Therefore, for an RRDS file, the number of pages specified by the page range must be calculated as follows (rounded up to the next integer):
number-of-pages = (number-of-vsam-records-in-file + 1) / (maximum-records-per-page + 1)
Note: Maximum-records-per-page is specified on the CREATE SEGMENT statement and determines the format of the database keys for records in areas that are contained in the segment.
CA IDMS/DB constructs the db-key for a record in a KSDS native VSAM area by randomizing the record's prime key to a database key in the database key range for the area. Therefore, for a KSDS file, a rule-of-thumb for calculating the page range is as follows (rounded up to the next integer):
number-of-pages = number-of-vsam-records-in-file / x
where x = 10 if number-of-vsam-records-in-file < 100,000
100 if number-of-vsam-records-in-file > 100,000
The idea is to specify a page range that minimizes the probability of constructing duplicate keys without specifying an excessive number of pages for the area.
CA IDMS/DB constructs the db-key for a record in an ESDS native VSAM area in the following manner:
dbkey = low-dbkey-of-area + relative-byte-address
Therefore, for an ESDS file, the number of pages specified by the page range must be calculated as follows (rounded up to the next integer):
number-of-pages = total-bytes-in-file / (maximum-records-per-page + 1)
Note: Maximum-records-per-page is specified on the CREATE SEGMENT statement and determines the format of the database keys for records in areas that are contained in the segment.
A database page is a fixed block. As a general rule, you should use pages that are an even fraction of the track size.
The following table lists the optimal page sizes by device type for five IBM disk drives. Manufacturers of other brands of direct access storage devices (DASD) should be able to provide similar information for their own equipment.
|
Per track |
3330 |
3340 |
3350 |
3375 |
3380 |
3390 |
|---|---|---|---|---|---|---|
|
1 |
13028 |
8368 |
19068 |
32764 |
32764 |
32764 |
|
2 |
6444 |
4100 |
9440 |
17600 |
23476 |
27996 |
|
3 |
4252 |
2676 |
6232 |
11616 |
15476 |
18452 |
|
4 |
3156 |
1964 |
4628 |
8608 |
11476 |
13680 |
|
5 |
2496 |
1540 |
3664 |
6816 |
9076 |
10796 |
|
6 |
2056 |
1252 |
3020 |
5600 |
7476 |
8904 |
|
7 |
1744 |
1052 |
2564 |
4736 |
6356 |
7548 |
|
8 |
1508 |
896 |
2220 |
4096 |
5492 |
6516 |
|
9 |
1324 |
780 |
1952 |
3616 |
4820 |
5724 |
|
10 |
1180 |
684 |
1740 |
3200 |
4276 |
5064 |
|
11 |
1060 |
608 |
1564 |
2880 |
3860 |
4564 |
|
12 |
960 |
544 |
1416 |
2592 |
3476 |
4136 |
|
13 |
876 |
488 |
1296 |
2368 |
3188 |
3768 |
|
14 |
804 |
440 |
1180 |
2176 |
2932 |
3440 |
|
15 |
740 |
400 |
1096 |
2016 |
2676 |
3172 |
|
|
|
|
|
|
|
|
Note: The bytes per page for FBA devices must be a multiple of 512.
Note: On z/VM, the size of a database page must be less than or equal to 4096 bytes.
Note: For VSAM database files the character-count must be at least 8 bytes larger than the page size.
If you expect frequent changes to the definitions of SQL tables, you should maintain synchronization stamps at the table level. If you do not expect frequent changes, you should maintain stamps at the area level.
When defining or altering an area for which area-level stamping is in effect, you can specify an explicit value for its synchronization stamp. This allows you to create databases that have identical physical attributes and can therefore be accessed through a single schema definition.
Since an area's synchronization stamp is updated each time any DDL statement affecting the area is issued, the synchronization stamp must be set after issuing the SQL DDL statements that define the database.
Care should be exercised when specifying a specific timestamp, since its purpose is to enable the detection of discrepancies between an entity and its definition. If explicitly specified, the timestamp should always be set to a new value following a definitional change so that the change is detectable to the run time system.
Block ranges within a file associated with more than one area must be contiguous.
To specify that all pages of the area map to all pages of the file, specify:
...from 1 for all
on the file specification.
If the file has multiple areas associated with it, the block range will overlap if both of the areas map to the file having this specification. You can map the first area using "FROM 1 FOR ALL", but you must map the second area "FROM last-block-of-the-file+1 FOR ALL".
Device Types or Access Methods May Limit the Number of File Blocks
Device types or access methods may further restrict the number of blocks allowed in a file. For example, a maximum of 65,535 tracks can be addressed in BDAM files.
Note: For more information about device types and access methods, see Allocating and Formatting Files.
An area that maps to native VSAM files has the following restrictions:
The following algorithms are used to calculate BLOCK CONTAINS key-count and the DISPLACEMENT page-count values for symbolic index parameters when the BASED ON clause is specified.
Index block:
Step 1: Assuming 3 SR8's per page, compute the following:
The maximum size of the variable portion of an SR8:
( (Page size - Page reserve - 32) / 3 ) - 40 = SR8-vsize
The maximum number of entries in an SR8:
Sorted index: (SR8-vsize / ( 8 + Keylen) ) - 2
Unsorted index: (SR8-vsize / 4 ) - 1
If the number of SR8 entries is less than 3, set it to 3; if
greater than 8180, set it to 8180.
Step 2: Establish the number of index entries: Use the FOR index-cnt
value, if specified, or 1000.
Step 3: Estimate the number of entries per SR8 for a 3-level index:
Find the first entry in the following table whose Number of
Entries column is greater than or equal to the value established
in Step 2.
Number of Number of
entries SR8 entries
1,000 10
15,625 25
125,000 50
512,000 80
1,000,000 100
2,000,376 126
3,375,000 150
5,359,375 175
8,000,000 200
15,625,000 250
-1 8180
Step 4: Determine the INDEX BLOCK value: Use the lesser of the Number
of SR8 entries from the table and the value from Step 1 as the
INDEX BLOCK (IBC) value in the remaining calculations.
Displacement:
For unsorted indexes, the displacement is set to 0; for sorted indexes, it is calculated as follows:
Step 1: Calculate the number of bottom level and higher level SR8s:
Set N = #-of-entries
High-level-SR8s = 0
Bottom-level-SR8s = 1
Repeat
N = (N + IBC - 1) / IBC (truncate)
If N = 1, exit
If High-level-SR8s = 0,
High-level-SR8s = 1
Bottom-level-SR8s = N
Else High-level-SR8s = High-level-SR8s + N
Set Total-SR8s = High-level-SR8s + Bottom-level-SR8s
Step 2: Determine the number of SR8s per page:
Calculate size of an SR8:
SR8-size = 32 + (IBC + 1) * (keylen + 8)
Calculate number of SR8s per page:
(Page-size - Page-reserve - 32) / (SR8-size + 8)
Step 3: Establish the INDEX DISPLACEMENT:
If Number of Higher Level SR8s is less than 2, set
the DISPLACEMENT = High-level-SR8s. (For a one or
two-level index, displacement will be 0 or 1
respectively.)
If Number of Higher Level SR8s is greater than 1,
compute the displacement:
(High-level-SR8s + SR8s-per-page - 1)
------------------------------------- + 1 (truncate)
SR8s-per-page
If the calculate displacement is greater than the number
of pages in the area containing the index, then:
Displacement = Number of pages in area / 2
|
Copyright © 2014 CA.
All rights reserved.
|
|