02 - Vsam Structure And Processing

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 02 - Vsam Structure And Processing as PDF for free.

More details

  • Words: 1,183
  • Pages: 38
VSAM KSDS Structure and Processing

Department of Computer Science Northern Illinois University August 2005

Some of the illustrations are from VSAM: Access Method Services and Programming Techniques by James Martin

KSDS Structure • Index component – maintains a list of the key values with pointers into the data component

• Data component – records • have a unique key field • may be fixed or variable length

2

KSDS Structure • Index component – maintains a list of the key values with pointers into the data component

• Data component – records • have a unique key field • may be fixed or variable length

3

KSDS Structure • VSAM uses the index component to locate records stored in the data component • Records can be accessed – sequentially in order on key value – OR directly by supplying the key value of the desired record 4

KSDS Structure

KSDS Index Component Data Component Rec 1

Rec 2

Rec 3

………….

Rec n

5

Control Interval • Control Interval – the unit of data that is transferred in I/O – contains • records • control information • free space (possibly) Record

Record

Record

Free

Control

A

B

C

Space

Info 6

KSDS Control Interval • VSAM loaded – control intervals created – records written into CIs

7

KSDS Control Interval • KSDS Free Space – on load free space left in each CI – when creating the percentage of free space in each CI is determined based upon volatility – too much free space wastes direct access space – too little free space result in maintenance inefficiencies 8

KSDS Control Interval KSDS Index Component Data Component Rec

Rec

Rec

Free

Cont

A

B

C

Space

Info

Rec

Rec

Rec

Free

Cont

D

E

F

Space

Info

Rec

Rec

Free

Cont

G

H

Space

Info

9

KSDS Control Interval • KSDS Control Information – One or more Record Descriptor Fields (RDFs) • Fixed Length Records has 2 RDFs – 1st RDF contains length of record – 2nd RDF contains number of records currently stored in the CI

10

KSDS Control Interval • KSDS Control Information – Control Interval Descriptor Field (CIDF) • information about the CI as a whole – free space - yes/no – number of RDFs (variable length records)

11

KSDS Control Area • CIs are grouped into Control Areas (CA) • As VSAM data set is loaded – control areas created – control intervals written into them

• KSDS – some CAs contain only free space 12

KSDS Control Area KSDS Control Area Rec

Rec

Rec

Free

A

B

C

Space

Rec

Rec

Rec

Free

D

E

F

Space

Rec

Rec

Free

G

H

Space Free Space

R R R C I D D D D F F F F R R R C I D D D D F F F F R R C I D D D F F F C I D F

13

KSDS Indexes • Sequence Set – lowest level of the index – one sequence set record for each control area in data component – one entry in each sequence set record for each control interval within the corresponding control area

14

KSDS Sequence Set

Sequence Set Record Format Header

Free Space

Free

Index

Entries

Space

Entries

15

KSDS Sequence Set • Header – contains • control information for the sequence set record • pointer to the next sequence set record

• Free Space Entry – points to each control interval in the control area that contains free space

16

KSDS Sequence Set • Unused Space – used to expand either the free space portion or the index entries portion of the sequence set record

• Index Entry – point to each control interval in the control area that contains records – contains highest key value in CI – pointer to beginning of that CI in CA 17

KSDS Index

18

KSDS Index Entries

19

KSDS Processing • Records can be accessed – sequentially in ascending or descending order on key value – directly by supplying a key value

20

KSDS Loading • Loading via – AMS utility program – User-written application program

• Loaded sequentially on key value

21

KDSD Loading Space Allocation • VSAM handles space upon load – 1st dynamically obtaining a CA from the space allocated to the data set – 2nd loads records into CIs in that CA – additional space is allocated as required until data set is completely loaded

22

KDSD Loading Index Processing • VSAM – automatically creates all required index entries – sequence set entry contains • highest key value • direct RBA pointer to beginning of that CI

23

Completed KSDS Cluster

24

KSDS Retrieval • Sequentially – via a series of READs or GETs – records presented in order on key value – can be ascending or descending – starting point specified in program – VSAM uses sequence set to get records in key sequence 25

KSDS Retrieval • Directly – a READ or GET is executed passing a key value – VSAM • reads the entire CI into memory • extracts requested record • passes to application program

26

KSDS Retrieval

27

KSDS Retrieval • VSAM – begins at top of index set – locates first index record whose key is greater than the requested key – follows pointer in index entry down to the sequence set record for the CA – searches sequence set records for the first index entry whose key value is greater than requested one 28

KSDS Retrieval • VSAM – reads the found CI that was pointed to by the index entry point into virtual storage – uses the information in the CI’s RDFs to search sequentially through the records in the CI to locate the logical record that has the requested key value – record is then moved to work area 29

KSDS Updating Sequentially • Updating can be sequential or direct • Sequentially Modify – retrieve a record – issue a REWRITE or PUT – key field cannot be changed

• Sequentially Delete – retrieve a record – issue an ERASE 30

KSDS Updating Sequentially • Updating can be sequential or direct • Sequentially Insert – build a record in work area – issue a WRITE or PUT – VSAM inserts the new record between two existing records – uses key value and sequence set to locate CI 31

KSDS Updating Direct • Direct Modify and/or Delete – in Assembler Language a record must be retrieved first – in COBOL or PL/1 a record can be updated or deleted without being previously retrieved – VSAM automatically updated the index as needed 32

KSDS Direct Insertion • Use a WRITE or PUT • VSAM – searches index to determine CI where new record is to go – inserts record in proper place in CI – updates index

33

KSDS Control Interval Split

Control Area Before

34

KSDS Control Interval Split

Control Interval Split

35

KSDS Control Interval Split Control Interval After Insertion of New Record

36

KSDS Control Area Split

37

KSDS Control Area Split

38

Related Documents

Vsam
November 2019 17
03 - Vsam Ksds And Cobol
November 2019 4
04 - Vsam Esds And Rrds
November 2019 4
Vsam Programs
November 2019 25
Processing
May 2020 35