Previous Topic: INDEX BLOCK CONTAINSNext Topic: Sample COBOL Table Procedure


DISPLACEMENT

Index Displacement

The following steps are used to calculate page-count for the DISPLACEMENT parameter of the CREATE INDEX statement:

  1. Calculate number of bottom-level and higher-level SR8s:
    Set N             = #-of-rows
    High-level-SR8s   = 0
    Bottom-level-SR8s = 1
    
    Repeat
    
      N = (N + IBC-key-count - 1) / IBC-key-count (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
    
  2. Determine the number of SR8s per page:
  3. Establish the INDEX DISPLACEMENT:
Table Displacement

Table displacement is the number of pages that the rows of a table are displaced from the index around which they are clustered. The table displacement is 0 if the table and index reside in different areas. It is calculated as described below if they reside in the same area: