Presentation is loading. Please wait.

Presentation is loading. Please wait.

VSAM KSDS Structure and Processing Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access.

Similar presentations


Presentation on theme: "VSAM KSDS Structure and Processing Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access."— Presentation transcript:

1 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

2 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 3 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

4 4 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

5 5 KSDS Structure KSDS Index Component Data Component Rec 1 Rec 2 Rec 3 Rec n ………….

6 6 Control Interval –the unit of data that is transferred in I/O –contains records control information free space (possibly) Record A Record B Record C Free Space Control Info

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

8 8 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

9 9 KSDS Control Interval KSDS Index Component Data Component Rec A Rec B Rec C Free Space Cont Info Rec D Rec E Rec F Free Space Cont Info Rec G Rec H Free Space Cont Info

10 10 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

11 11 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)

12 12 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

13 13 KSDS Control Area Rec A Rec B Rec C Free Space Rec D Rec E Rec F Free Space Rec G Rec H Free Space Free Space RDFRDF RDFRDF RDFRDF CIDFCIDF RDFRDF RDFRDF RDFRDF CIDFCIDF RDFRDF RDFRDF CIDFCIDF CIDFCIDF

14 14 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

15 15 KSDS Sequence Set HeaderFree Space Entries Free Space Index Entries Sequence Set Record Format

16 16 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

17 17 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

18 18 KSDS Index

19 19 KSDS Index Entries

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

21 21 KSDS Loading Loading via –AMS utility program –User-written application program Loaded sequentially on key value

22 22 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

23 23 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

24 24 Completed KSDS Cluster

25 25 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

26 26 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

27 27 KSDS Retrieval

28 28 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

29 29 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

30 30 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

31 31 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

32 32 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

33 33 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

34 34 KSDS Control Interval Split Control Area Before

35 35 KSDS Control Interval Split Control Interval Split

36 36 KSDS Control Interval Split Control Interval After Insertion of New Record

37 37 KSDS Control Area Split

38 38 KSDS Control Area Split


Download ppt "VSAM KSDS Structure and Processing Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access."

Similar presentations


Ads by Google