Data set (IBM mainframe)

From HandWiki
Short description: Type of computer file existing on IBM mainframe operating systems

In the context of IBM mainframe computers in the S/360 line, a data set (IBM preferred) or dataset is a computer file having a record organization. Use of this term began with, e.g., DOS/360, OS/360, and is still used by their successors, including the current z/OS. Documentation for these systems historically preferred this term rather than file.

A data set is typically stored on a direct access storage device (DASD) or magnetic tape,[1] however unit record devices, such as punch card readers, card punches, line printers and page printers can provide input/output (I/O) for a data set (file).[2]

Data sets are not unstructured streams of bytes, but rather are organized in various logical record[3] and block structures determined by the DSORG (data set organization), RECFM (record format), and other parameters. These parameters are specified at the time of the data set allocation (creation), for example with Job Control Language DD statements. Within a running program they are stored in the Data Control Block (DCB) or Access Control Block (ACB), which are data structures used to access data sets using access methods.

Records in a data set may be fixed, variable, or “undefined” length.[4]

Data set organization

For OS/360, the DCB's DSORG parameter specifies how the data set is organized. It may be[5]

CQ
Queued Telecommunications Access Method (QTAM) in Message Control Program (MCP)
CX
Communications line group
DA
Basic Direct Access Method (BDAM)
GS
Graphics device for Graphics Access Method(GAM)
IS
Indexed Sequential Access Method (ISAM)
MQ
QTAM message queue in application
PO
Partitioned
PS
Physical Sequential

among others. Data sets on tape may only be DSORG=PS. The choice of organization depends on how the data is to be accessed, and in particular, how it is to be updated.

Programmers utilize various access methods (such as QSAM or VSAM) in programs for reading and writing data sets. Access method depends on the given data set organization.

Record format (RECFM)

Regardless of organization, the physical structure of each record is essentially the same, and is uniform throughout the data set. This is specified in the DCB RECFM parameter. RECFM=F means that the records are of fixed length, specified via the LRECL parameter. RECFM=V specifies a variable-length record. V records when stored on media are prefixed by a Record Descriptor Word (RDW) containing the integer length of the record in bytes and flag bits. With RECFM=FB and RECFM=VB, multiple logical records are grouped together into a single physical block on tape or DASD. FB and VB are fixed-blocked, and variable-blocked, respectively. RECFM=U (undefined) is also variable length, but the length of the record is determined by the length of the block rather than by a control field.

The BLKSIZE parameter specifies the maximum length of the block. RECFM=FBS[6] could be also specified, meaning fixed-blocked standard, meaning all the blocks except the last one were required to be in full BLKSIZE length. RECFM=VBS, or variable-blocked spanned, means a logical record could be spanned across two or more blocks, with flags in the RDW indicating whether a record segment is continued into the next block and/or was continued from the previous one.

This mechanism eliminates the need for using any "delimiter" byte value to separate records. Thus data can be of any type, including binary integers, floating-point, or characters, without introducing a false end-of-record condition. The data set is an abstraction of a collection of records, in contrast to files as unstructured streams of bytes.

Partitioned data set

A partitioned data set (PDS)[7] is a data set containing multiple members, each of which holds a separate sub-data set, similar to a directory in other types of file systems. This type of data set is often used to hold load modules (old format bound executable programs), source program libraries (especially Assembler macro definitions), ISPF screen definitions, and Job Control Language. A PDS may be compared to a Zip file or COM Structured Storage.

A Partitioned Data Set can only be allocated on a single volume and have a maximum size of 65,535 tracks.

Besides members, a PDS contains also a directory. Each member can be accessed indirectly via the directory structure. Once a member is located, the data stored in that member are handled in the same manner as a PS (sequential) data set.

Whenever a member is deleted, the space it occupied is unusable for storing other data. Likewise, if a member is re-written, it is stored in a new spot at the back of the PDS and leaves wasted “dead” space in the middle. The only way to recover “dead” space is to perform file compression.[8] Compression, which is done using the IEBCOPY utility,[9] moves all members to the front of the data space and leaves free usable space at the back. (Note that in modern parlance, this kind of operation might be called defragmentation or garbage collection; data compression nowadays refers to a different, more complicated concept.) PDS files can only reside on DASD, not on magnetic tape, in order to use the directory structure to access individual members. Partitioned data sets are most often used for storing multiple job control language files, utility control statements, and executable modules.

An improvement of this scheme is a Partitioned Data Set Extended (PDSE or PDS/E, sometimes just libraries) introduced with DFSMSdfp for MVS/XA and MVS/ESA systems. A PDS/E library can store program objects or other types of members, but not both. BPAM cannot process a PDS/E containing program objects.

PDS/E structure is similar to PDS and is used to store the same types of data. However, PDS/E files have a better directory structure which does not require pre-allocation of directory blocks when the PDS/E is defined (and therefore does not run out of directory blocks if not enough were specified). Also, PDS/E automatically stores members in such a way that compression operation is not needed to reclaim "dead" space.[8] PDS/E files can only reside on DASD in order to use the directory structure to access individual members.

Generation Data Group

A Generation Data Group[10] (GDG)[11] is a group of non-VSAM data sets[12] that are successive generations of historically-related data[13] stored on an IBM mainframe (running OS or DOS/VSE).[14]

A GDG is usually cataloged.[13]

An individual member of the GDG collection is called a "Generation Data Set."[13][15] The latter may be identified by an absolute number, ACCTG.OURGDG(1234), or a relative number: (-1) for the previous generation, (0) for the current one, and (+1) the next generation.[16]

GDG JCL & features

Generation Data Groups are defined using either the BLDG statement[17] of the IEHPROGM utility or the DEFINE GENERATIONGROUP statement[18] of the newer IDCAMS utility,[19] which allows setting various parameters.

  • LIMIT(10) would limit the number of generations limit to 10.
  • SCRATCH FOR (91) would retain each member, up to the limited#generations, at least 91 days.

IDCAMS can also delete (and optionally uncatalog) a GDG.[20]

References

  1. "What is a catalog?". https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconcepts_172.htm. "Cataloging of data sets on magnetic tape ..." 
  2. "IBM Knowledge Center - Home of IBM product documentation". http://publib.boulder.ibm.com/infocenter/zvm/v5r4/index.jsp?topic=/com.ibm.zvm.v54.hcpa7/hcse7b3050.htm. 
  3. "What is a data set?". https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_datasetintro.htm. "data set .. a file that contains one or more records." 
  4. "Data set record formats". https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconcepts_159.htm. "Records are either fixed length or variable length in a given data set." 
  5. IBM System/3S0 Operating System: Job Control Language Reference - OS Release 21.7. IBM Systems Reference Library. IBM. pp. 138–139. GC28-6704-4. http://bitsavers.org/pdf/ibm/360/os/R21.7_Apr73/GC28-6704-4_OS_JCL_Aug76.pdf. 
  6. "Example: Record format VBS". https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/rzatb/rbfvbs.htm. "Variable-length, blocked, spanned (VBS)" 
  7. z/OS DFSMS Using Data Sets Version 2 Release 3. October 2, 2018. SC23-6855-30. https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc236855/$file/idad400_v2r3.pdf. 
  8. 8.0 8.1 Stephens, David (Oct 2008). What On Earth is a Mainframe?. Lulu.com. p. 52. ISBN 978-1-4092-2535-5. https://books.google.com/books?id=1NMYOOW3gHMC. Retrieved May 11, 2018. 
  9. z/OS DFSMSdfp Utilities Version 2 Release 3. IBM Corporation. July 17, 2017. SC23-6864-30. https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc236864/$file/idau100_v2r3.pdf. "A partitioned data set will contain unused areas (sometimes called gas) where a deleted member or the old version of an updated member once resided. This unused space is only reclaimed when a partitioned data set is copied to a new data set, or after a compress-in-place operation successfully completes. It has no meaning for a PDSE and is ignored if requested." 
  10. "Generation Data Groups (GDG's), an Introduction with Examples". http://www.simotime.com/gdgone01.htm. "create and process a Generation Data Group or GDG on ..." 
  11. "JCL TUTORIAL REFERENCE - Generation Data Groups". http://www.mainframegurukul.com/srcsinc/drona/programming/languages/jcl/jcl.chapter9.html. "Generation Data Groups (GDG)" 
  12. "What is a generation data group?". https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconcepts_175.htm. "... non-VSAM ..." 
  13. 13.0 13.1 13.2 "Generation data sets". https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.ieab500/iea3b5_Generation_data_sets_.htm. "successive, historically related," 
  14. "VSE/VSAM Commands". http://ftp.www.ibm.com/s390/zos/vse/pdf3/zvse31/doc/iesvoe10.pdf. 
  15. "A generation data set is one of ...
  16. "What is a GDG?". http://mainframewizard.com/content/what-gdg. 
  17. OS Utilities. IBM Systems Reference Library (Sixteenth ed.). IBM. April 1973. p. 269. GC28-6586-15. http://bitsavers.org/pdf/ibm/360/os/R21.7_Apr73/GC28-6586-15_OS_Utilities_Rel_21.7_Apr73.pdf. Retrieved May 19, 2022. 
  18. OS/VS Access Method Services (Second ed.). IBM. May 1974. pp. 107–110. GC26-3836-1. http://bitsavers.org/pdf/ibm/370/OS_VS2/Release_2_1973/GC26-3836-1_OS_VS_Access_Method_Services_May1974.pdf. Retrieved May 19, 2022. 
  19. "IBM How to create and use Generation Data Groups (GDG)". 2 March 2012. https://www.ibm.com/support/docview.wss?uid=swg21422334. "Create a GDG... IDCAMS will do it" 
  20. "IDCAMS – Create and delete GDG base using JCL". http://code.xmlgadgets.com/2011/05/16/idcams-create-and-delete-gdg-base/comment-page-1.