Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1798300
  • 博文数量: 335
  • 博客积分: 4690
  • 博客等级: 上校
  • 技术积分: 4341
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-08 21:38
个人简介

无聊之人--除了技术,还是技术,你懂得

文章分类

全部博文(335)

文章存档

2016年(29)

2015年(18)

2014年(7)

2013年(86)

2012年(90)

2011年(105)

分类: 其他平台

2013-03-17 23:56:52

http://blog.chinaunix.net/uid-22334392-id-3516134.htm里面我们介绍了一下VTOC,以及对VSAM文件进行了简单的介绍,知道,VSAM是有CA组成,而CA有有CI组成,CI是VSAM文件操作的基本单位,也是IO读取的基本单位,这一点要知道。
但是仅仅知道这些是不够的,VSAM 文件主要有四种基本类型:
Three types of data set organizations
?KSDS: key-sequenced data set
?ESDS: entry-sequenced data set
?RRDS: relative record data set
.LSDS: LINEAR-SEQUECED DATA SET
为了以后研究catalog方便,今天我们只研究最常见的ksds
研究的思路为定义,语法,然后具体的实现,最后给出例子
A record is identified for access by specifying its key value
A key is an imbedded field that is used to uniquely identify a particular record
Cluster - a VSAM data set
KSDS cluster 
index component
data component
Use Access Method Services (AMS)
IDCAMS
Requires JCL statements
SYSPRINT - to produce a listing
SYSIN - contains AMS commands
AMS DEFINE command is used to create VSAM objects
clusters
alternate indexes
user catalogs
DEFINE CLUSTER (subparam [subparm] …. [subparm] )
[ DATA (subparm [subparm] …. [subparm] ) ]
[ INDEX (subparm [subparm] …. [subparm] ) ]
[ CATALOG (subparm [subparm] …. [subparm] ) 
CLUSTER sub-parameters
assign attributes to the cluster as a whole
DATA and INDEX sub-parameters
assign attributes to the data component of ONLY KSDS clusters 
CATALOG sub-parameters
specify the name and optional password of the catalog where the catalog entries of the cluster are placed
example

点击(此处)折叠或打开

  1. //SYSIN DD *
  2. DEFINE CLUSTER ( - /* DEFINE A CLUSTER */
  3. NAME(KSDSCLUS) - /* CLUSTER NAME IS KSDSCLUS */
  4. INDEXED - /* TYPE OF CLUSTER IS KSDS */
  5. VOLUMES(ACA301) - /* VOLUME IDENTIFICATION */
  6. TRACKS(1 1) ) - /* SPACE ALLOCATION */
  7. DATA ( - /* DATA COMPONENT */
  8. NAME(KSDSDATA) - /* NAME OF DATA COMP */
  9. KEYS(9 0) -     /* KEY LEN = 9 OFFSET = 0 */
  10. RECORDSIZE(90 90) - /* FIXED LEN RECORD = 90 */
  11. FREESPACE(10 5) ) - /* 10% FREE IN CI, 5% IN CA */
  12. INDEX ( -     /* INDEX COMPONENT */
  13. NAME(KSDSNDX) ) /* NAME OF INDEX COMP */

 
key  words:
DEFINE CLUSTER subparmeters
NAME(cluster name)
used to assign a unique name to the cluster
standard 1 - 44 character 
start with your znumber 
INDEXED
specifies a KSDS
VOLUMES (volser)
volume and serial number of the new cluster
use ACA301
TRACKS (primary secondary)
primary - primary allocation (use 1)
secondary - secondary allocation (use 1)
will be done up to 122 times
RECORDSIZE (average maximum)
average - average number of bytes in the record
maximum - same as average for fixed length records otherwise the maximum number of bytes of the record
KEYS (length position)
length - length of the key of the KSDA
position - beginning position of key (starting with 0)
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

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
VSAM loaded
control intervals created
records written into CIs
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

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
Control Interval Descriptor Field (CIDF)
information about the CI as a whole
free space - yes/no
number of RDFs (variable length records)
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
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



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 
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
KSDS Index


KSDS Index Entries

Records can be accessed
sequentially in ascending or descending order on key value
directly by supplying a key value
Loading via
AMS utility program
User-written application program
Loaded sequentially on key value
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
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
Completed KSDS Cluster(as a whole)
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
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


VSAM---------KSDSRetrieval
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
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
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
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
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 
VSAM 
searches index to determine CI where new record is to go
inserts record in proper place in CI
updates index
常见的应用:
KSDS Control Interval Split


KSDS Control Area Split



阅读(1757) | 评论(0) | 转发(0) |
0

上一篇:KSDS OF VSAM 详解

下一篇:CATALOG详解

给主人留下些什么吧!~~