Wednesday, December 14, 2011

VSAM File Organization


   The physical organization of VSAM data sets differs considerably from
   those used by other access methods.  VSAM data sets are held in control
   intervals and control areas; the size of these is normally determined by
   the access method, and the way in which they are used is not visible to
   you.
   There are three types of file organization you can use with VSAM 
   VSAM sequential file organization
       Also referred to as VSAM ESDS (Entry-Sequenced Data Set) organization.

   VSAM indexed file organization
       Also referred to as VSAM KSDS (Key-Sequenced Data Set) organization.

   VSAM relative file organization
      Also referred to as VSAM RRDS (Relative-Record Data Set) organization.

  Note:  Throughout this book, the term VSAM relative-record data set (or
  RRDS) is used to mean both relative-record data sets with fixed-length
  records and with variable-length records, unless they need to be
  differentiated.

   For all VSAM data set processing, you can use either fixed- or
  variable-length record formats without any special coding.  If you cannot
  or choose not to use VSAM variable-length RRDS, you can use "COBOL
  simulated variable-length relative data sets."  For information on using
  simulated variable-length relative data sets, see Appendix C, "Processing
  Simulated Variable-Length RRDS".

    ________________________________________________________________________ 
   | Figure     Comparison of VSAM Data Sets                                |
   |_______________________ ________________________ _______________________|
   | Entry-Sequenced       | Key-Sequenced          | Relative-Record       |
   | Data Set              | Data Set               | Data Set              |
   |_________________      |________________________|_______________________|
   | Records are in order  | Records are in         | Records are in        |
   | in which they are     | collating sequence     | relative record       |
   | written.              | key field.             | number order.         |
   |_______________________|________________________|_______________________|
   | Access is sequential. | Access is by key       | Access is by relative
   |                       | through an index.      | record number, which 
   |                       |                        | is treated like a key.                                                                                                    
     
   |_______________________|________________________|_______________________|
   | May have one or more  | May have one or more   | May not have          |
   | alternate indexes,    | alternate indexes.     | alternate indexes.    |
   | though not supported                                                 
   | in COBOL.                                    
   |_______________________|________________________|_______________________|
   | A record's RBA        | A record's RBA can     | A record's relative   |
   | (relative byte        | change.                | record number cannot  |
   | address) cannot       |                        | change.               |
   | change.               |                        |                       |
   |_______________________|________________________|_______________________|
   | Space at the end of   | Distributed free space | For fixed-length      |
   | the data set is used  | is used for inserting  | RRDS, empty slots in  |
   | for adding records.   | records and changing   | the data set are used |
   |                       | their lengths in       | for adding records.   |
   |                       | place.                 | For variable-length   |
   |                       |                        | RRDS, distributed     |
   |                       |                        | free space is used    |
   |                       |                        | for adding records    |
   |                       |                        | and changing their    |
   |                       |                        | lengths in place.     |
   |_______________________|________________________|_______________________|
   | A record cannot be    | Space given up by a    | Space given up by a   |
   | deleted, but you can  | deleted or shortened   | deleted record can be |
   | reuse its space for a | record is              | reused.               |
   | record of the same    | automatically          |                       |
   | length.               | reclaimed within a     |                       |
   |                       | control interval.      |                       |
   |_______________________|________________________|_______________________|
   | Can have spanned      | Can have spanned       | Cannot have spanned   |
   | records.              | records.               | records.              |
   |_______________________|________________________|_______________________|
   | Can be reused as a    | Can be reused as a     | Can be reused as a    |
   | work file unless it   | work file unless it    | work file.            |
   | has an alternate      |  has an alternate      |                       |
   | index, is associated  | index, is associated   |                       |
   | with key ranges, or   | with key ranges, or    |                       |
   | exceeds 123 extents   | exceeds 123 extents    |                       |
   | per volume.           | per volume.            |                       |
   |_______________________|________________________|_______________________|

No comments:

Post a Comment