	include'dix_def.inc'
c
cdec$	options /noalign/warn=noalign
c
	integer*4 block_size
	parameter (block_Size = 512)
c
	integer*4  max_seq_rec
	parameter (max_seq_rec=4)		!max seq servers
c
c Maximum transfer size
c
	integer*4  max_block_count
	parameter (max_block_count=16384)	!max block size
c
	integer*4  max_segments			!key has max 8 segments
	parameter (max_segments = 8)
c
	integer*4  max_buf_size			!no record has more than 32k bytes
	parameter (max_buf_size=32768)
c
	integer*4  max_key_size			!no key is longer than 255 bytes
	parameter (max_key_size=255)
c
	integer*4 max_prev_buckets
	parameter (max_prev_buckets=3)		!if 3 random buckets in the same block 
						!start another sequential read
c
c Definition of key record
c
	integer*4  key_flag_dup
	parameter (key_flag_dup=1)
	integer*4  key_flag_chg
	parameter (key_flag_chg = 2)
	integer*4  key_flag_nul
	parameter (key_flag_nul = 4)
	integer*4  key_flag_idx_compr
	parameter (key_flag_idx_compr=8)
	integer*4  key_flag_init_idx
	parameter (key_flag_init_idx=16)
	integer*4  key_flag_key_compr
	parameter (key_flag_key_compr=64)
	integer*4  key_flag_rec_compr
	parameter (key_flag_rec_compr=128)
c
	
c
	structure /keydef/
	  integer*4 flink
	  integer*2 offset
	  byte idx_area
	  byte level_1_area
	  byte data_area
	  byte root_level
	  byte index_bucket_size
	  byte data_bucket_size
	  integer*4 root_vbn
	  byte flags
	  byte data_type
	  byte key_segments
	  byte nullchar
	  byte key_size
	  byte key_of_ref
	  integer*2 min_rec_length
	  integer*2 index_fill
	  integer*2 data_fill
	  integer*2 keypos(8)
	  byte keysize(8)
	  character*32 keyname
	  integer*4 first_data_bucket
	  byte keytype(8)
	end structure
c
c definition of prologue block
c
	structure /prologue/
	  union
	    map
	      record /keydef/ key
	      integer*4 spare1
	      integer*2 spare2
	      byte area_vbn
	      byte area_count
	      integer*4 spare3
	      integer*4 max_recnr
	      integer*4 eof_block
	      integer*2 prologue_version
	    end map
	    map
	      byte data(block_size)
	    end map
	  end union
	end structure
c
c Definition of area block
c
	structure /area/
	  byte reserved
	  byte flags
	  byte area_number
	  byte bucket_size
	  integer*2 rel_volnr
	  byte align_opt
	  byte alloc_opt
	  integer*4 reclaim
	  integer*4 start_block
	  integer*4 count
	  integer*4 used
	  integer*4 first_free
	  integer*4 next_extend
	  integer*4 nblok_next
	  integer*2 def_extend
	  integer*2 reserved1
	  integer*4 starting_lbn
	  integer*2 rfi(3)
	  integer*4 total_alloc
	  integer*2 reserved2(4)
	  integer*2 checksum
	end structure	  
c
c Bucket header
c
	structure /bucket_header/
	  byte check
	  byte area_number
	  integer*2 check_vbn
	  integer*2 first_free_byte
	  byte next_record_id
	  byte last_record_id
	  integer*4 next_bucket
	  byte bucket_level
	  byte flag
	end structure
c
	integer*4  bhdr_flag_last
	parameter (bhdr_flag_last=1)
	integer*4  bhdr_flag_root
	parameter (bhdr_flag_root=2)
c
c Data header
c
	structure /data_header/
	  byte flag
	  byte record_id
	  byte rrv_id
	  integer*2 rfa_byte
	  integer*4 rfa_block
	end structure
	integer*4  dhdr_ps_mask
	parameter (dhdr_ps_mask=3)
	integer*4  dhdr_rec_deleted
	parameter (dhdr_rec_deleted=4)
	integer*4  dhdr_rec_rrv
	parameter (dhdr_rec_rrv=8)
c
c Definition of a bucket
c
        structure /bucket/
          union
            map
              byte data(max_buf_size)   !max transfer size
            end map
            map
              record /bucket_header/ hdr
            end map
          end union
        end structure
c
c fastio control block
c
	structure /rec_buf/
	  integer*4 start_block
	  integer*4 end_block
	  integer*4 hit_rate
	  integer*4 nb_read
	  integer*4 address
	end structure
c
	structure /fastio_header/
c
c Header part
c
	  integer*4 channel	!channel to use
	  integer*4 n_seq_buf
	  record /rec_buf/ seq(max_seq_rec)
	  record /rec_buf/ ran
	  integer*4 ran_block_count
	  integer*4 seq_block_count
	  integer*4 bucket_size
	  integer*4 read_count
 	  integer*4 file_size
	  integer*4 eof_size
	  integer*4 ffbyte
	  integer*4 nbuckets_read
	  integer*4 nblocks_read
	  integer*4 nreads_seq
	  integer*4 nreads_ran
	  integer*4 n_rereads
	  integer*4 record_length
	  integer*4 prev_buckets(max_prev_buckets)
	  integer*4 rel_recsiz		!total record size for relative files
	  integer*4 rel_nrecbuck	!#records/bucket
	  integer*4 rel_bperbucket	!#bytess/bucket
	  integer*4 hit_count
	  integer*4 recnr		!
	  integer*4 nb_read
	  integer*4 vfc_size
	  integer*4 max_recnr
	  logical*4 skip
	  integer*4 iosb(2)
	  integer*2 iosbw(4)
	  integer*4 p_bucket
	  integer*4 data_offset
	  integer*4 type		!seq/rel/idx
	  character*4 typasc		!ascii name
	  logical*4 blk			!do records cross block boundaries
	  logical*4 msb			!record length msb
	  integer*4 rfm			!record format
	  integer*4 nb_key
	  record /keydef/ prim_key
	  record /rfa/ cur_rfa
	  byte keyval(0:max_key_size)
	end structure
c
        structure /rec_attributes/
          byte rtype
          byte rattr
          integer*2 recsiz
          integer*4 hiblk
          integer*4 eofblk
          integer*2 ffbyte
          byte bktsize
          byte vfcsize
          integer*2 maxrec
          integer*2 defext
          integer*2 gblcnt
          integer*2 res1
          integer*2 res2
          integer*2 res3
          integer*2 res4
          integer*2 version
        end structure
c
        structure /data_rec/
          record /data_header/ hdr
          integer*2 recsiz
          byte data(10)
        end structure
c
	integer*4  rel_deleted
	parameter (rel_deleted = 4)
	integer*4  rel_record
	parameter (rel_record = 8)
c
cdec$	end options 
