Virtual Storage Access Method: Difference between revisions

Content deleted Content added
Merge from Linear data set following unopposed March proposal; short text and context; see Talk:Virtual Storage Access Method#Merge suggestion
used -> supported
 
(6 intermediate revisions by 3 users not shown)
Line 1:
{{Short description|IBM disk file programming interface}}
{{merge from|Linear data set|Entry-sequenced data set|Key-sequenced data set|Relative record data set|discuss=Talk:Virtual_Storage_Access_Method|date=February 2025}}
'''Virtual Storage Access Method''' ('''VSAM''')<ref>{{cite magazine |magazine=[[Datamation]]
|url=https://www.datamation.com/netsys/article.php/3677001/New-Life-for-Legacy-Systems-at-LaBarge.htm
Line 22 ⟶ 21:
 
==Files==
The physical organization of VSAM data sets differs considerably from the organizations usedsupported by other access methods, as follows.
 
A VSAM file is defined as a cluster of VSAM components, e.g., for KSDS a DATA component and an INDEX component.
Line 36 ⟶ 35:
 
===Sequential organization===
An '''entry-sequenced data set''' ('''ESDS''') is a type of [[data set (IBM mainframe)|data set]] organization supported by VSAM.<ref name="demystified"/>{{rp|5}} Records are accessed based on their sequential order, that is, the order in which they were written to the file;<ref>{{cite web|url=https://walton.uark.edu/enterprise/IBM/systemZ/downloads/module3/VSAM-Introductory.ppt|title=VSAM: introductory}}</ref><ref>{{cite web |title=Server Functionality |url=https://supportline.microfocus.com/documentation/books/tps62/mafunc.htm |quote=Sequential (VSAM ESDS – Entry Sequenced Dataset)}}</ref><ref>{{cite web|url=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.469.8853&rep=rep1&type=pdf|quote=An ESDS VSAM data set contains records in the order in which they were entered|title=ABCs of z/OS System Programming Volume 3|citeseerx=10.1.1.469.8853}}</ref> which means that accessing a particular record involves searching all the records [[Sequential access|sequentially]] until it is located, or by using a relative physical address (''Relative byte address'', RBA), i.e. the number of bytes from the beginning of the file to start reading.<ref name="demystified"/>{{rp|28}}
{{further|entry-sequenced data set}}
 
}}</ref> Records are loaded irrespective of their contents and their byte addresses cannot be changed.
An ESDS may have an index defined to it to enable access via keys, by defining an Alternate Index. Records in ESDS are stored in order in which they are written by address access.<ref>{{cite web
 
|url=https://walton.uark.edu/enterprise/IBM/systemZ/downloads/module3/VSAM-Introductory.ppt
While an ESDS has no key), alternate indexes (AIXs) may be defined to permit the use of fields as keys.<ref>{{cite book
|title=VSAM: introductory}}</ref><ref>{{cite web |title=Server Functionality |url=https://supportline.microfocus.com/documentation/books/tps62/mafunc.htm |quote=Sequential (VSAM ESDS – Entry Sequenced Dataset)}}</ref><ref>{{cite web
| title |title= ABCs of z/OS/390 System Programming - Volume 3|citeseerx=10.1.1.469.8853
|url=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.469.8853&rep=rep1&type=pdf
| id id = GC20SG24-17525653-000
|quote=An ESDS VSAM data set contains records in the order in which they were entered
| first1 = P.
|title=ABCs of z/OS System Programming Volume 3|citeseerx=10.1.1.469.8853
| last1 = Rogers
}}</ref> Records are loaded irrespective of their contents and their byte addresses cannot be changed.
| first2 = G.
| last2 = Capobianco
| first3 = D.
| last3 = Carey
| first4 = N.
| last4 = Davies
| first5 = L.
| last5 = Fadel
| first6 = K.
| last6 = Hewitt
| first7 = J.
| last7 = Oliveira
| first8 = F.
| last8 = Pita
| first9 = A.
| last9 = Salla
| first10 = V.
| last10 = Sokal
| first11 = Y. F.
| last11 = Tay
| first12 = H.
| last12 = Timm
| date id = SA23-1368-50April 2000
| page = 108
| section = 1.19.11 Entry sequenced data set (ESDS)
| section-url = https://www.redbooks.ibm.com/redbooks//pdfs/sg245653.pdf#page=128
| quote = Although an entry-sequenced data set does not contain an index component, alternate indexes are allowed. You can build an alternate index to keep track of these RBAs.
| ISBN = 9780738416182
| publisher = International Technical Support Organization [[IBM]]
| series = Redbooks
| url = https://www.redbooks.ibm.com/redbooks//pdfs/sg245653.pdf
| access-date = July 6, 2025
}}
</ref>  An alternate index is itself a KSDS.
<!-- Replace with most recent? LCCN? OCLC? -->
 
===Indexed organization===
A '''key-sequenced data set''' (KSDS) is a type of [[data set (IBM mainframe)|data set]] supported by VSAM.<ref name="demystified"/>{{rp|5}} Each record in a KSDS data file is embedded with a unique key.<ref name="demystified"/>{{rp|20}} A KSDS consists of two parts, the data component and a separate [[index file]] known as the index component which allows the system to physically locate the record in the data file by its key value.<ref name="demystified"/>{{rp|13}} Together, the data and index components are called a cluster.<ref name="demystified"/>{{rp|15}}
{{further|key-sequenced data set}}
 
A KSDS has two parts: the index component and the data component. These may be stored on separate disk volumes.
Records can be accessed randomly or in sequence and can be variable-length.
 
As a [[VSAM]] data set, the KSDS data and index components consist of control intervals<ref name="demystified"/>{{rp|10}} which are further organized in control areas.<ref name="demystified"/>{{rp|12}} As records are added at random to a KSDS, control intervals fill and need to be split into two new control intervals, each new control interval receiving roughly half of the records. Similarly, as the control intervals in a control area are used up, a control area will be split into two new control areas, each new control area receiving roughly half the control intervals.<ref name="demystified"/>{{rp|17}}
 
While a basic KSDS only has one key (the primary key), alternate indices may be defined to permit the use of additional fields as secondary keys.<ref name="demystified"/>{{rp|15}} An alternate index (AIX) is itself a KSDS.<ref name="demystified"/>{{rp|16}}
 
The data structure used by a KSDS is nowadays known as a [[B+ tree]].<ref>{{cite web|url=https://patents.justia.com/patent/9043295|title=US Patent for Providing record-level alternate-index upgrade locking}}</ref><ref>{{cite web|url=https://www.wisegeek.com/what-is-vsam.htm|quote=This index is called a B+ tree.|title=What is VSAM?}}</ref>
|url=https://patents.justia.com/patent/9043295
|title=US Patent for Providing record-level alternate-index upgrade locking}}</ref><ref>{{cite web
|url=https://www.wisegeek.com/what-is-vsam.htm
|quote=This index is called a B+ tree.
|title=What is VSAM?}}</ref>
 
===Relative organization===
A '''relative record data set''' (RRDS) is a type of [[data set (IBM mainframe)|data set]] organization supported by VSAM.<ref name="demystified"/>{{rp|5}} Records are accessed based on their ordinal position in the file (''relative record number'', RRN).<ref name="demystified"/>{{rp|29}} For example, the desired record to be accessed might be the 42nd record in the file out of 999 total. The concept of RRDS is similar to [[sequential access]] method, but it can access with data in [[random access]] and dynamic access.{{huh|date=April 2021}}
{{further|relative record data set}}
 
An RRDS consists of data records in sequence, with the record number indicating the record's logical position in the data set.<ref name="demystified"/>{{rp|29}} A program can access records randomly using this positional number or access records sequentially.<ref name="demystified"/>{{rp|30}} But unlike a [[Key Sequenced Data Set]], an RRDS has no keys, so the program cannot access records by key value.
An RRDS may have an index defined to it to enable access via keys, by defining an Alternate Index.
 
=== Linear organization ===
A '''linear data set''' (LDS) is a type of [[data set (IBM mainframe)|data set]] organization usedsupported by VSAM.<ref name="demystified"/>{{rp|5}} The LDS has a control interval size of 4096 bytes to 32768 bytes<ref>{{cite manual|title = z/OS 2.5 DFSMS Using Data Sets|id = SC23-6855-50| section = Linear Data sets| section-url = https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sc236855/$file/idad400_v2r5.pdf#page=126|page = 91|date = September 30, 2021|url = https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sc236855/$file/idad400_v2r5.pdf|publisher = IBM}}</ref> in increments of 4096.<ref name="demystified"/>{{rp|31}} A LDS does not have embedded control information, because it does not contain control information, the LDS cannot be accessed as if it contained individual records.<ref>{{Cite web|title=IBM Knowledge Center|url=https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.idad400/d4261.htm|access-date=2021-02-07|website=www.ibm.com| date=27 March 2014 |language=en-US}}</ref>
 
Addressing within an LDS is by Relative Byte Address (RBA), which allows it to be used by systems such as [[IBM Db2]] or the Operating system.{{huh|date=April 2021}} The benefit of this is that systems such as the OS can access multiple disk spindles and view it as a single storage implementation. The limitations of this, though, is that this does not make this particularly useful to higher level abstraction levels.{{or|date=April 2021}} Data In Virtual{{sfn|ASMGUIDE|loc=Chapter 14. Data-in-virtual|pp=[https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sa231368/$file/ieaa600_v2r5.pdf#page=253 225-248]}} (DIV) and Window services{{sfn|ASMGUIDE|loc=Chapter 17. Window Services|pp=[https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sa231368/$file/ieaa600_v2r5.pdf#page=321 293-310]}} provide an alternative method to direct use of VSAM to access an LDS with a CI size of 4096.
Line 88 ⟶ 120:
 
==History==
VSAM was introduced as a replacement for older access methods<ref>{{cite manual|title = OS/Virtual Storage 1 Features Supplement |id = GC20-1752-0| date = August 1972|edition = First|url = http://bitsavers.org/pdf/ibm/370/OS_VS1/GC20-1752-0_OS_VS1_Features_Supplement_Aug72.pdf| publisher = IBM}}
| title = OS/Virtual Storage 1 Features Supplement
| id = GC20-1752-0
| date = August 1972
| edition = First
| url = http://bitsavers.org/pdf/ibm/370/OS_VS1/GC20-1752-0_OS_VS1_Features_Supplement_Aug72.pdf
| publisher = IBM
}}
</ref> and was intended to add function, to be easier to use and to overcome problems of performance and device-dependence. VSAM was introduced in the 1970s when IBM announced [[virtual memory|virtual storage]] operating systems (DOS/VS, OS/VS1 and OS/VS2) for its new System/370 series, as successors of the [[DOS/360 and successors|DOS/360]] and [[OS/360 and successors|OS/360]] operating systems running on its System/360 computer series. While backwards compatibility was maintained, the older access methods suffered from performance problems due to the address translation required for virtual storage.
 
Line 122 ⟶ 147:
 
==Further reading==
*{{cite manual|title = z/OS 2.5 MVS Programming: Assembler Services Guide|id = SA23-1368-50|date = September 30, 2021|url = https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sa231368/$file/ieaa600_v2r5.pdf|ref = {{sfnref|ASMGUIDE}}| publisher = IBM}}
;ASMGUIDE
*{{cite web|url=http://www.mvsforums.com/techfaqsvsam.html|title=MVS Forums - Technical FAQ's - VSAM|website=Mvsforums.com|accessdate=12 December 2017}}
:{{cite manual
 
| title = z/OS 2.5 MVS Programming: Assembler Services Guide
==External links==
| id = SA23-1368-50
*[https://web.archive.org/web/20051023212932/http://www.lascon.co.uk/d002303.htm Lascon.co.uk]
| date = September 30, 2021
*[https://web.archive.org/web/20070311021954/http://www.redbooks.ibm.com/redbooks/SG246105/wwhelp/wwhimpl/js/html/wwhelp.htm Redbooks.ibm.com]
| url = https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5sa231368/$file/ieaa600_v2r5.pdf
*https://web.archive.org/web/20051013071230/http://www.jaymoseley.com/hercules/vstutor/vstutor.htm
| ref = {{sfnref|ASMGUIDE}}
*http://www.mvsforums.com/techfaqsvsam.html
| publisher = IBM
*https://web.archive.org/web/20070311021954/http://www.redbooks.ibm.com/redbooks/SG246105/wwhelp/wwhimpl/js/html/wwhelp.htm
}}
 
{{Mainframe I/O access methods}}