z/OS: z/OS DFSMS Using Data SetsDFSMS Using Data Sets
IBM
SC23-6855-40
Note
Before using this information and the product it supports, read the
information in “Notices” on page 585.
This edition applies to Version 2 Release 4 of z/OS (5650-ZOS) and
to all subsequent releases and modifications until otherwise
indicated in new editions.
Last updated: 2020-02-24 © Copyright International Business
Machines Corporation 1987, 2020. US Government Users Restricted
Rights – Use, duplication or disclosure restricted by GSA ADP
Schedule Contract with IBM Corp.
Contents
Multivolume VSAM data
sets..........................................................................................................39
Multivolume non-VSAM data
sets..................................................................................................
39 Extended-format data
sets.............................................................................................................39
Extension to another DASD
volume.....................................................................................................43
Multiple volume considerations for sequential data
sets...................................................................
43 Extended address
volumes..................................................................................................................44
Additional information on space
allocation.........................................................................................46
Structure of an exported data
set..................................................................................................
49 EXPORT and IMPORT
commands..................................................................................................
49
Handling an abnormal
termination................................................................................................
51 Using VERIFY to process improperly closed data
sets..................................................................51
Chapter 6. Organizing VSAM data
sets......................................................................................................75
VSAM data
formats...............................................................................................................................75
Naming a
cluster...........................................................................................................................102
Specifying cluster
information.....................................................................................................
103 Using access method services
parameters.................................................................................
104 Allocating space for VSAM data
sets............................................................................................106
Calculating space for the data component of a
KSDS.................................................................
109 Calculating space for the index
component................................................................................
109 Using ALTER to modify attributes of a
component......................................................................110
Using ALTER to rename data
sets................................................................................................
110
Copying and merging data
sets.........................................................................................................
113 Defining alternate
indexes.................................................................................................................
115
Examples of defining alternate indexes and
paths...........................................................................
124 JCL
statements.............................................................................................................................
124
Commands....................................................................................................................................124
Requesting access to a data
set........................................................................................................
132 Inserting and adding
records.......................................................................................................
133 Retrieving
records........................................................................................................................
134 Updating
records..........................................................................................................................
136 Deleting
records...........................................................................................................................
136 Deferring and forcing buffer
writing.............................................................................................137
Retaining and positioning data
buffers........................................................................................
137 Processing multiple
strings..........................................................................................................
137 Making concurrent
requests.........................................................................................................138
Using a path to access
records....................................................................................................
139 Making asynchronous
requests....................................................................................................139
Ending a
request...........................................................................................................................140
vii
Management of I/O Buffers for Shared
Resources...........................................................................
195 Deferring Write
Requests.............................................................................................................
195 Relating Deferred Requests by Transaction
ID...........................................................................
196 Writing Buffers Whose Writing is Deferred:
WRTBFR..................................................................196
Accessing a Control Interval with Shared
Resources..................................................................197
Chapter 14. Using VSAM record-level
sharing........................................................................................201
Controlling Access to VSAM Data
Sets..............................................................................................
201 Accessing data sets using DFSMStvs and VSAM record-level
sharing.............................................201
Record-Level Sharing CF
Caching................................................................................................
202 VSAM Record-Level Sharing Multiple Lock
Structure..................................................................203
Using VSAM RLS with
CICS...........................................................................................................203
Non-CICS Use of VSAM
RLS.........................................................................................................
205 Using 64-Bit Addressable Data
Buffers.......................................................................................
206 Read Sharing of Recoverable Data
Sets.......................................................................................207
Read-Sharing Integrity across KSDS CI and CA
Splits................................................................
207 Read and Write Sharing of Nonrecoverable Data
Sets................................................................
207 Using Non-RLS Access to VSAM Data
Sets..................................................................................
208 RLS Access
Rules..........................................................................................................................208
Comparing RLS Access and Non-RLS
Access..............................................................................
209 Requesting VSAM RLS
Run-Mode................................................................................................
211 Using VSAM RLS Read Integrity
Options.....................................................................................
211
Types of data
sets.........................................................................................................................215
EXAMINE
users.............................................................................................................................215
Chapter 16. Coding VSAM User-Written Exit
Routines...........................................................................221
Guidelines for Coding Exit
Routines..................................................................................................
221 Programming
Guidelines...................................................................................................................
222
ix
Chapter 20. Selecting record formats for Non-VSAM data
sets.............................................................265
Format
Selection................................................................................................................................
265 Fixed-length record
formats..............................................................................................................266
RELSE—Release an Input
Buffer..................................................................................................
317 TRUNC—Truncate an Output
Buffer.............................................................................................317
MB
line...........................................................................................................................................328
Planning to use BSAM, BPAM, QSAM and OCE support for XTIOT,
uncaptured UCBs, and
UCBs, and DSAB above the
line..............................................................................................
329 Coding the LOC=ANY DCBE
option..............................................................................................
333 Coding the DEVSUPxx
option.......................................................................................................
333 Diagnosing problems with BSAM, BPAM, QSAM and OCE support for
XTIOT, uncaptured
UCBs, and DSAB above the
line..............................................................................................
334
Setting Up the Enhanced Data Integrity
Function.......................................................................
338 Synchronizing the Enhanced Data Integrity Function on Multiple
Systems............................... 339 Using the START IFGEDI
Command............................................................................................
339 Bypassing the Enhanced Data Integrity Function for
Applications.............................................340
Diagnosing Data Integrity Warnings and
Violations....................................................................
340
PDSEs.................................................................................................................................................
342 Direct Data Sets
(BDAM)....................................................................................................................
342 Factors to Consider When Opening and Closing Data
Sets...............................................................342
Control of checkpoint data sets on shared DASD
volumes..............................................................
343 System use of search direct for input
operations.............................................................................
344
Determining the length of a block when reading with BSAM, BPAM, or
BDAM................................361 Writing a Short Format-FB
Block with BSAM or
BPAM.....................................................................
362 Using
Hiperbatch................................................................................................................................363
Processing Extended-Format Sequential Data
Sets.........................................................................
363
Processing Large Format Data
Sets...................................................................................................369
Characteristics of Large Format Data
Sets..................................................................................
369 Allocating Large Format Data
Sets...............................................................................................369
Opening and Closing Large Format Data
Sets.............................................................................
370 Migrating to Large Format Data
Sets............................................................................................370
Processing a Member of a
PDSE........................................................................................................409
Establishing Connections to
Members.........................................................................................409
Using the BLDL Macro to Construct a Directory Entry
List.......................................................... 410
Using the BSP Macro to Backspace a Physical
Record...............................................................
410 Using the Directory Entry
Services...............................................................................................410
Using the FIND Macro to Position to the Beginning of a
Member...............................................417 Using
ISITMGD to Determine Whether the Data Set Is System
Managed................................. 417 Using the NOTE Macro
to Provide Relative
Position....................................................................418
Using the POINT Macro to Position to a
Block.............................................................................419
Switching between
Members.......................................................................................................419
Using the STOW Macro to Update the
Directory..........................................................................420
Retrieving a Member of a
PDSE.........................................................................................................
421 Sharing
PDSEs....................................................................................................................................
422
Using HFS Data
Sets...........................................................................................................................439
Creating HFS Data
Sets................................................................................................................
439 Creating Additional
Directories....................................................................................................
440
Naming Generation Data Groups for ISO/ANSI Version 3 or Version 4
Labels................................ 461 Creating a New
Generation................................................................................................................461
Allocating a Generation Data
Set.................................................................................................
461 Passing a Generation Data
Set.....................................................................................................
463 Rolling In a Generation Data
Set..................................................................................................464
Controlling Expiration of a Rolled-Off Generation Data Set
....................................................... 464
Chapter 31. Using non-VSAM user-written exit
routines.......................................................................
473 General
Guidance...............................................................................................................................473
Example: Converting a data
set.........................................................................................................
559 Example: Issuing a SYNADAF
macro.................................................................................................559
xvii
7. Data set with spanned
records...................................................................................................................
78
8. Entry-sequenced data
set...........................................................................................................................80
10. Record of a key-sequenced data
set........................................................................................................83
11. Inserting records into a key-sequenced data
set....................................................................................
83
12. Inserting a logical record into a
CI...........................................................................................................
84
13. Fixed-length relative-record data
set.......................................................................................................86
16. Control interval in a control
area..............................................................................................................
90
20. VSAM macro
relationships......................................................................................................................142
21. Skeleton VSAM
program.........................................................................................................................143
23. Determining free
space..........................................................................................................................
150
30. VSAM RLS address and data spaces and requester address
spaces....................................................202
31. CICS VSAM non-RLS
access...................................................................................................................
204
33. Example of a JRNAD exit Part 1 of
2......................................................................................................
228
34. Example of a JRNAD exit Part 2 of
2......................................................................................................
229
35. Example of a SYNAD exit
routine...........................................................................................................
238
37. Relation of index entry to data control
interval.....................................................................................
254
38. Levels of a prime
index...........................................................................................................................
255
41. Format of an index
record......................................................................................................................
259
47. Spanned format-V records for direct data
sets.....................................................................................
273
49. Fixed-length records for ISO/ANSI
tapes..............................................................................................
276
50. Nonspanned format-D Records for ISO/ANSI tapes as seen by the
program......................................278
51. Spanned variable-length (format-DS) records for ISO/ANSI tapes
as seen by the program...............279
52. Reading a sequential data
set................................................................................................................
290
54. Sources and sequence of operations for completing the
DCB..............................................................292
55. Record Processed when LEAVE or REREAD is Specified for CLOSE
TYPE=T........................................304
56. Constructing a buffer pool from a static storage
area...........................................................................
313
57. Constructing a buffer pool using GETPOOL and
FREEPOOL..................................................................314
58. Simple buffering with MACRF=GL and
MACRF=PM...............................................................................315
59. Simple buffering with MACRF=GM and
MACRF=PM..............................................................................316
60. Simple buffering with MACRF=GL and
MACRF=PL................................................................................
316
61. Simple buffering with MACRF=GL and MACRF=PM-UPDAT
mode.......................................................
316
62. Parallel processing of three data
sets....................................................................................................326
63. JCL, macros, and procedures required to share a data set using
multiple DCBs.................................336
64. Macros and procedures required to share a data set using a
single DCB.............................................337
65. Creating a Sequential Data Set—Move Mode, Simple
Buffering............................................................348
66. Retrieving a Sequential Data Set—Locate Mode, Simple
Buffering.......................................................349
67. Like Concatenation Read through
BSAM...............................................................................................
353
68. Reissuing a READ or GET for unlike concatenated data
sets................................................................
354
69. One method of determining the length of a record when using
BSAM to read undefined-length or blocked
records.......................................................................................................................................
362
70. A partitioned data set
(PDS)...................................................................................................................
374
xxi
75. Creating Members of a PDS Using
STOW...............................................................................................380
76. BLDL list
format.......................................................................................................................................381
78. DESERV GET by PDSDE control block
structure....................................................................................
383
79. DESERV GET_ALL control block
structure.............................................................................................
384
80. Retrieving several members and subgroups of a PDS without
overlapping I/O time and CPU time... 387
81. Reading a member of a PDS or PDSE using asynchronous
BPAM.........................................................388
82. Updating a member of a
PDS..................................................................................................................390
83. A partitioned data set extended
(PDSE).................................................................................................394
84. TTRs for a PDSE member (unblocked
records)......................................................................................397
85. TTRs for two PDSE members (LRECL=80,
BLKSIZE=800)....................................................................
397
86. Example of how PDSE records are
reblocked........................................................................................400
87. Example of reblocking when the block size has been
changed............................................................
400
88. Creating one member of a
PDSE............................................................................................................
406
90. Adding PDSE members
serially..............................................................................................................
408
92. DESERV GET by NAME_LIST control block
structure............................................................................412
93. DESERV GET by PDSDE control block
structure....................................................................................
413
97. DESERV
UPDATE.....................................................................................................................................417
xxii
99. Using NOTE and FIND to Switch Between Members of a Concatenated
PDSE.................................... 420
100. STOW INITIALIZE
Example.................................................................................................................
420
103. UNIX directories and files in a file
system...........................................................................................
438
104. Edit-Entry
panel....................................................................................................................................448
106. ISPF shell
panel....................................................................................................................................
449
107. Using OPUT to copy members of a PDS or PDSE to a UNIX
file..........................................................
450
108. A partitioned concatenation of PDS extents, PDSEs, and UNIX
directories.......................................455
109. Status Indicators—BDAM, BPAM, BSAM, and
QSAM...........................................................................479
110. Parameter List Passed to DCB Abend Exit
Routine.............................................................................
490
111. Recovery Work
Area.............................................................................................................................
493
114. IECOENTE Macro Parameter
List.........................................................................................................
501
115. IECOEVSE macro parameter
list..........................................................................................................
503
119. Creating a Direct Data Set
(Tape-to-Disk)...........................................................................................
518
125. Sequentially updating an indexed sequential data
set.......................................................................
536
126. Directly Updating an Indexed Sequential Data
Set.............................................................................
539
127. Directly updating an indexed sequential data set with
variable-length records................................ 541
128. Adding records to an indexed sequential data
set..............................................................................
543
129. Deleting records from an indexed sequential data
set........................................................................544
130. Use of ISAM processing
programs.......................................................................................................
550
4. Data set activity for non-system-managed and system-managed data
sets............................................28
5. Differences between stripes in sequential and VSAM data
sets...............................................................
39
6. CSFSERV resource required for data set
encryption..................................................................................60
7. SMS allocation processing based on system levels and allocation
request (z/OS V2R2 with
OA50569)...................................................................................................................................................
62
8. SMS allocation processing based on system levels and allocation
request (z/OS V2R2 with
OA50569)...................................................................................................................................................
63
9. SMS allocation processing based on system levels and allocation
request (z/OS V2R1 with
OA50569)...................................................................................................................................................
63
10. Entry-sequenced data set
processing......................................................................................................81
14. Comparison of ESDS, KSDS, fixed-length RRDS, variable-length
RRDS, and linear data sets............... 87
15. Parameters provided by access method
services.................................................................................
104
17. Effect of RPL options on data buffers and
positioning...........................................................................137
18. Controlling CA
reclaim............................................................................................................................
152
21. RLS open rules, for recoverable or non-recoverable data
sets.............................................................
208
22. VSAM user-written exit
routines............................................................................................................
222
24. Contents of registers at entry to EODAD exit
routine............................................................................
225
25. Contents of registers at entry to EXCEPTIONEXIT
routine...................................................................
226
26. Contents of registers at entry to JRNAD exit
routine.............................................................................227
27. Contents of parameter list built by VSAM for the JRNAD
exit...............................................................229
28. Contents of registers at entry to LERAD exit
routine.............................................................................
234
29. Contents of registers for RLSWAIT exit
routine.....................................................................................
235
31. Conditions when exits to UPAD routines are
taken...............................................................................
239
32. Contents of registers at entry to UPAD exit
routine...............................................................................239
33. Parameter list passed to UPAD
routine..................................................................................................240
34. Communication with user-security-verification
routine........................................................................241
35. 31-bit address keyword
parameters......................................................................................................244
37. Segment control
codes...........................................................................................................................271
39. Optimum and maximum block size
supported......................................................................................
297
40. Rules for setting block sizes for tape data sets or compressed
format data sets................................298
41. Buffering technique and GET/PUT processing
modes..........................................................................
317
43. Different conditions for data integrity
violations...................................................................................
342
44. Types of sequential data sets on DASD – characteristics and
advantages.......................................... 348
45. PDSE and PDS
differences......................................................................................................................395
xxvi
48. OPEN for UPDAT and Positioning to a Member Decision Table
............................................................424
49. Access methods that UNIX files
use......................................................................................................
439
51. DCB exit
routines....................................................................................................................................
474
57. Exception code
bits—QISAM..................................................................................................................
481
58. Register contents on entry to SYNAD routine—BDAM, BPAM, BSAM,
and QSAM................................ 482
59. Register contents on entry to SYNAD
routine—BISAM..........................................................................483
60. Register contents on entry to SYNAD
routine—QISAM.........................................................................
483
61. DCB exit list format and
contents...........................................................................................................486
62. Option mask byte
settings......................................................................................................................491
63. Conditions for which recovery can be
attempted..................................................................................
492
65. System response to a user label exit routine return
code.....................................................................499
66. Saving and restoring general
registers...................................................................................................501
67. Requests for indexed sequential data
sets............................................................................................530
68. QISAM error
conditions..........................................................................................................................
551
69. BISAM error
conditions..........................................................................................................................
552
72. ABEND codes issued by the ISAM
interface..........................................................................................
554
75. Output
DISP=NEW,OLD..........................................................................................................................
576
77.
Input........................................................................................................................................................578
xxviii
About this document
This document is intended for system and application programmers.
This document is intended to help you use access methods to process
virtual storage access method (VSAM) data sets, sequential data
sets, partitioned data sets (PDSs), partitioned data sets extended
(PDSEs), z/OS® UNIX files, and generation data sets in the DFSMS
environment. This document also explains how to use access method
services commands, macro instructions, and JCL to process data
sets.
For information about the accessibility features of z/OS, for users
who have a physical disability, see Appendix G, “Accessibility,” on
page 581.
Major divisions of this document This document is divided into
these major parts:
• Part 1 covers general topics for all data sets. • Part 2 covers
the processing of VSAM data sets. • Part 3 covers the processing of
non-VSAM data sets and UNIX files. • Appendixes cover the following
topics:
– Using direct-access labels. – Copying and printing Kanji
characters by using the double-byte character set. – Processing
direct data sets. – Processing indexed sequential data sets. –
Using ISAM programs with VSAM data sets. – Converting character
sets.
Required product knowledge To use this document effectively, you
should be familiar with the following information:
• IBM support and how it is structured • Assembler language • Job
control language (JCL) • Diagnostic techniques
You should also understand how to use access method services
commands, catalogs, and storage administration, which the following
documents describe.
Topic Document
Access method services commands
z/OS DFSMS Access Method Services Commands describes the access
method services commands used to process virtual storage access
method (VSAM) data sets.
Catalogs z/OS DFSMS Managing Catalogs describes how to create
master and user catalogs.
Storage administration z/OS DFSMSdfp Storage Administration and
z/OS DFSMS Implementing System-Managed Storage describe storage
administration.
Macros z/OS DFSMS Macro Instructions for Data Sets describes the
macros used to process VSAM and non-VSAM data sets.
© Copyright IBM Corp. 1987, 2020 xxix
Topic Document
z/OS UNIX System Services
z/OS UNIX System Services User's Guide describes how to process
z/OS UNIX files.
Referenced documents For a complete list of DFSMS documents and
related z/OS documents referenced by this document, see the z/OS
Information Roadmap. You can obtain a softcopy version of this
document and other DFSMS documents from sources listed here.
This document refers to the following additional documents:
Document Title Description
Character Data Representation Architecture Reference and
Registry
Document that includes information about coded character set
identifiers in the character data representation architecture
repository.
z/OS information This information explains how z/OS references
information in other documents and on the web.
When possible, this information uses cross document links that go
directly to the topic in reference using shortened versions of the
document title. For complete titles and order numbers of the
documents for all products that are part of z/OS, see z/OS
Information Roadmap.
To find the complete z/OS library, go to IBM Knowledge Center
(www.ibm.com/support/ knowledgecenter/SSLTBW/welcome).
xxx z/OS: z/OS DFSMS Using Data Sets
How to send your comments to IBM
We invite you to submit comments about the z/OS product
documentation. Your valuable feedback helps to ensure accurate and
high-quality information.
Important: If your comment regards a technical question or problem,
see instead “If you have a technical problem” on page xxxi.
Submit your feedback by using the appropriate method for your type
of comment or question: Feedback on z/OS function
If your comment or question is about z/OS itself, submit a request
through the IBM RFE Community
(www.ibm.com/developerworks/rfe/).
Feedback on IBM® Knowledge Center function If your comment or
question is about the IBM Knowledge Center functionality, for
example search capabilities or how to arrange the browser view,
send a detailed email to IBM Knowledge Center Support at
[email protected].
Feedback on the z/OS product documentation and content If your
comment is about the information that is provided in the z/OS
product documentation library, send a detailed email to
[email protected]. We welcome any feedback that you have,
including comments on the clarity, accuracy, or completeness of the
information.
To help us better process your submission, include the following
information:
• Your name, company/university/institution name, and email address
• The following deliverable title and order number: z/OS DFSMS
Using Data Sets, SC23-6855-40 • The section title of the specific
information to which your comment relates • The text of your
comment.
When you send comments to IBM, you grant IBM a nonexclusive
authority to use or distribute the comments in any way appropriate
without incurring any obligation to you.
IBM or any other organizations use the personal information that
you supply to contact you only about the issues that you
submit.
If you have a technical problem If you have a technical problem or
question, do not use the feedback methods that are provided for
sending documentation comments. Instead, take one or more of the
following actions:
• Go to the IBM Support Portal (support.ibm.com). • Contact your
IBM service representative. • Call IBM technical support.
© Copyright IBM Corp. 1987, 2020 xxxi
Summary of changes
This information includes terminology, maintenance, and editorial
changes. Technical changes or additions to the text and
illustrations for the current edition are indicated by a vertical
line to the left of the change.
Summary of changes for z/OS Version 2 Release 4 (V2R4)
New
• Information regarding zHyperLink I/O was added. For more
information, see “zHyperLink I/O” on page 164.
• “Advantages of PDSEs” on page 393 was updated with an advantage.
• “Virtual storage access method” on page 6 was updated as part of
VSAM/zHyperLink functionality
that was added from OA52876.
Changed
• The appendix "Converting data sets" was renamed to "Converting
character sets for ISO/ANSI V4 tapes" for clarity.
Summary of changes for z/OS Version 2 Release 3 (V2R3) The
following changes are made for z/OS Version 2 Release 3
(V2R3).
New
• Added information for developers of programs that run in
supervisor state or system protection key (0 - 7), in “Using access
methods in system key programs” on page 306.
• Added information for DADSM partial release for compressed format
sequential data sets in “Characteristics of Compressed Format Data
Sets” on page 366.
• Added information about new support for accessing read-only data
sets, in “Processing data sets on read-only devices” on page
20.
• Added information about new support for z/OS data set encryption,
in “Data set encryption” on page 57.
Updated
• “Setting IGDSMSxx PARMLIB values for VSAM RLS data buffering” on
page 206 has been updated. • “Using VERIFY to process improperly
closed data sets” on page 51 has been updated. • Improved
description of SYNAD processing in “Basic Access Methods” on page
485, and “Returning
from the SYNAD routine” on page 485. • Updated information related
to 3380 DASD devices, to reflect 3390 DASD information as
appropriate.
Removed
• Removed section for 'Building a Generation Data Group' from
Chapter 29, “Processing generation data groups,” on page 457.
© Copyright IBM Corp. 1987, 2020 xxxiii
Summary of changes for z/OS Version 2 Release 2 (V2R2) The
following changes are made for z/OS Version 2 Release 2
(V2R2).
New
• Added information on using a non-SMS managed VSAM linear data set
with extended addressability as a zFS version root, in “Using a
non-SMS managed data set for a zFS version root larger than four
gigabytes” on page 438.
• Added information on using hiperspace caching for PDSEs, in
“Hiperspace caching for PDSE” on page 433.
Changed
• VSAM information was updated in “Acquiring buffers” on page 164,
“Using Hiperspace Buffers with LSR” on page 191, and “Deciding the
Size of a Virtual Resource Pool” on page 192.
• Space constraint attributes for a data class may now apply to the
secondary quantity during allocation, as well as the primary
quantity, resulting in more efficient use of space. For more
information, refer to “Allocation of data sets with the space
constraint relief attributes” on page 41.
Moved
“Using BSAM, BPAM, and QSAM support for XTIOT, uncaptured UCBs, and
DSAB above the 16 MB line” on page 328 was moved into this
information from a previous edition of DFSMS Using the New
Functions.
Deleted
No content was removed from this information.
xxxiv z/OS: z/OS DFSMS Using Data Sets
Part 1. All data sets This topic provides information on general
topics for all data sets.
© Copyright IBM Corp. 1987, 2020 1
2 z/OS: z/OS DFSMS Using Data Sets
Chapter 1. Working with data sets
This chapter covers the following topics.
Topic
“Access methods” on page 4
“Direct Access Storage Device (DASD) volumes” on page 8
“Magnetic tape volumes” on page 11
“Data management macros” on page 14
“Data set processing” on page 15
“Distributed Data Management (DDM) attributes” on page 23
“Virtual I/O for temporary data sets” on page 23
“Data set names” on page 24
“Catalogs and volume table of contents” on page 25
A data set is a collection of logically related data and can be a
source program, a library of macros, or a file of data records used
by a processing program. Data records are the basic unit of
information that is used by a processing program. By placing your
data into volumes of organized data sets, you can save and process
the data. You can also print the contents of a data set or display
the contents on a terminal.
Exception: z/OS UNIX files are different from the typical data set
because they are byte-oriented rather than record-oriented.
Data storage and management You can store data on secondary storage
devices, such as a direct access storage device (DASD) or magnetic
tape volume. The term DASD applies to disks or to a mass storage
medium on which a computer stores data. A volume is a standard unit
of secondary storage. You can store all types of data sets on DASD
but only sequential data sets on magnetic tape. Mountable tape
volumes can reside in an automated tape library. For information
about magnetic tape volumes, see z/OS DFSMS Using Magnetic Tapes.
You can also direct a sequential data set to or from spool, a UNIX
file, a TSO/E terminal, a unit record device, virtual I/O (VIO), or
a dummy data set.
Each block of data on a DASD volume has a distinct location and a
unique address, making it possible to find any record without
extensive searching. You can store and retrieve records either
directly or sequentially. Use DASD volumes for storing data and
executable programs, including the operating system itself, and for
temporary working storage. You can use one DASD volume for many
different data sets, and reallocate or reuse space on the
volume.
Data management is the part of the operating system that organizes,
identifies, stores, catalogs, and retrieves all the information
(including programs) that your installation uses. Data management
does these main tasks:
• Sets aside (allocates) space on DASD volumes. • Automatically
retrieves cataloged data sets by name. • Mounts magnetic tape
volumes in the drive. • Establishes a logical connection between
the application program and the medium. • Controls access to
data.
Working with Data Sets
• Transfers data between the application program and the
medium.
System-managed data sets The Storage Management Subsystem (SMS) is
an operating environment that automates the management of storage.
Storage management uses the values that are provided at allocation
time to determine, for example, on which volume to place your data
set, and how many tracks to allocate for it. Storage management
also manages tape data sets on mountable volumes that reside in an
automated tape library. With SMS, users can allocate data sets more
easily.
The data sets allocated through SMS are called system-managed data
sets or SMS-managed data sets. For information about allocating
system-managed data sets, see Chapter 2, “Using the Storage
Management Subsystem,” on page 27. If you are a storage
administrator, also see z/OS DFSMSdfp Storage Administration for
information about using SMS.
Distributed FileManager With Distributed FileManager (DFM) target
server, applications running on a processor with the DFM source
server can create or access certain types of SMS-managed data sets.
They can also access certain types of non-SMS-managed data sets on
an System/390® processor running DFSMS, with the DFM target server.
See z/OS DFSMS DFM Guide and Reference for details about the
supported data set types and a discussion of considerations in
making them available for remote access. Also, see “Distributed
Data Management (DDM) attributes” on page 23.
Access methods An access method defines the technique that is used
to store and retrieve data. Access methods have their own data set
structures to organize data, macros to define and process data
sets, and utility programs to process data sets.
Access methods are identified primarily by the data set
organization. For example, use the basic sequential access method
(BSAM) or queued sequential access method (QSAM) with sequential
data sets. However, there are times when an access method
identified with one organization can be used to process a data set
organized in a different manner. For example, a sequential data set
(not extended- format data set) created using BSAM can be processed
by the basic direct access method (BDAM), and vice versa. Another
example is UNIX files, which you can process that uses BSAM, QSAM,
basic partitioned access method (BPAM), or Virtual Storage Access
Method (VSAM).
Basic Direct Access Method BDAM arranges records in any sequence
your program indicates, and retrieves records by actual or relative
address. If you do not know the exact location of a record, you can
specify a point in the data set where a search for the record is to
begin. Data sets organized this way are called direct data
sets.
Optionally, BDAM uses hardware keys. Hardware keys are less
efficient than the optional software keys in virtual sequential
access method (VSAM).
Related reading: See the following material:
• “Track format” on page 8 • Appendix C, “Processing direct data
sets,” on page 515
Basic Partitioned Access Method Basic partitioned access method
(BPAM) arranges records as members of a partitioned data set (PDS)
or a partitioned data set extended (PDSE) on DASD. You can use BPAM
to view a UNIX directory and its files as if it were a PDS. You can
view each PDS, PDSE, or UNIX member sequentially with BSAM or QSAM.
A PDS or PDSE includes a directory that relates member names to
locations within the data set. Use the PDS, PDSE, or UNIX directory
to retrieve individual members. For program libraries (load modules
and program objects), the directory contains program attributes
that are required to load and rebind the
Working with Data Sets
4 z/OS: z/OS DFSMS Using Data Sets
member. Although UNIX files can contain program objects, program
management does not access UNIX files through BPAM.
The following describes some of the characteristics of PDSs, PDSEs,
and UNIX files: Partitioned data set
PDSs can have any type of sequential records. Partitioned data set
extended
A PDSE has a different internal storage format than a PDS, which
gives PDSEs improved usability characteristics. You can use a PDSE
in place of most PDSs, but you cannot use a PDSE for certain system
data sets.
z/OS UNIX files UNIX files are byte streams and do not contain
records. BPAM converts the bytes in UNIX files to records. You can
use BPAM to read but not write to UNIX files. BPAM access is like
BSAM access.
Basic Sequential Access Method BSAM arranges records sequentially
in the order in which they are entered. A data set that has this
organization is a sequential data set. The user organizes records
with other records into blocks. This is basic access. You can use
BSAM with the following data types:
• basic format sequential data sets (before z/OS 1.7 these were
known as sequential data sets or more accurately as
non-extended-format sequential data sets)
• large format sequential data sets • extended-format data sets •
z/OS UNIX files
Extended-format data sets have an internal storage format that is
different from data sets that are not extended format. The internal
storage format for extended-format data sets provides more
usability characteristics, and can have better performance if the
data set is striped. You can choose for an extended-format data set
to be any combination of:
• striped • encrypted • compressed format • or none of those.
Extended-format data sets must be SMS-managed.
Data-in-Virtual (DIV) The data-in-virtual (DIV) macro provides
access to VSAM linear data sets. For more information, see z/OS MVS
Programming: Assembler Services Guide. You can also use window
services to access linear data sets, as described in that
information.
Indexed Sequential Access Method ISAM refers to two access methods:
basic indexed sequential access method (BISAM) and queued indexed
sequential access method (QISAM). Data sets processed by ISAM are
called indexed sequential data sets. Starting in z/OS V1R7, you
cannot create, open, copy, convert, or dump indexed sequential
(ISAM) data sets. You can delete or rename them. You can use an
earlier release of z/OS to convert them to VSAM data sets.
Important: Do not use ISAM. You should convert all indexed
sequential data sets to VSAM data sets. See Appendix D, “Using the
Indexed Sequential Access Method,” on page 523.
Object Access Method Object access method (OAM) processes very
large, named byte streams (objects) that have no record boundary or
other internal orientation. These objects can be recorded in a Db2
database, file system,
Working with Data Sets
Chapter 1. Working with data sets 5
optical storage volume, or tape storage volume. OAM uses SMS
policies to provide information lifecycle management for these
objects. For information about OAM, see z/OS DFSMS OAM Application
Programmer's Reference and z/OS DFSMS OAM Planning, Installation,
and Storage Administration Guide for Object Support.
Queued Sequential Access Method QSAM arranges records sequentially
in the order that they are entered to form sequential data sets,
which are the same as those data sets that BSAM creates. The system
organizes records with other records. QSAM anticipates the need for
records based on their order. To improve performance, QSAM reads
these records into storage before they are requested. This is
called queued access. You can use QSAM with the following data
types:
• sequential data sets • basic format sequential data sets (before
z/OS 1.7 these were known as sequential data sets or more
accurately as non-extended-format sequential data sets) • large
format sequential data sets • extended-format data sets • z/OS UNIX
files
Extended-format data sets have an internal storage format that is
different from data sets that are not extended format. The internal
storage format for extended-format data sets provides more
usability characteristics, and can have better performance if the
data set is striped. You can choose for an extended-format data set
to be any combination of:
• striped • encrypted • compressed format • or none of those.
Extended-format data sets must be SMS-managed.
Virtual storage access method VSAM arranges records by an index
key, relative record number, or relative byte addressing. VSAM is
used for direct or sequential processing of fixed-length and
variable-length records on DASD. Data that is organized by VSAM is
cataloged for easy retrieval and is stored in one of five types of
data sets.
• Entry-sequenced data set (ESDS). Contains records in the order in
which they were entered. Records are added to the end of the data
set and can be accessed.
• Key-sequenced data set (KSDS). Contains records in ascending
collating sequence. Records can be accessed by a field, called a
key, or by a relative byte address.
• Linear data set (LDS). Contains data that has no record
boundaries. Linear data sets contain none of the control
information that other VSAM data sets do. Linear data sets must be
cataloged in a catalog.
• Relative record data set (RRDS). Contains records in relative
record number order, and the records can be accessed only by this
number. There are two types of relative record data sets.
Fixed-length RRDS: The records must be of fixed length.
Variable-length RRDS: The records can vary in length.
Throughout this document, the term RRDS refers to both types of
relative record data sets, unless they need to be
differentiated.
• z/OS UNIX files. A UNIX file can be accessed as if it were a VSAM
entry-sequenced data set (ESDS). Although UNIX files are not stored
as entry-sequenced data sets, the system attempts to simulate the
characteristics of such a data set. To identify or access a UNIX
file, specify the path that leads to it.
Any type of VSAM data set can be in extended format.
Extended-format data sets have a different internal storage format
than data sets that are not extended. This storage format gives
extended-format data sets
Working with Data Sets
6 z/OS: z/OS DFSMS Using Data Sets
additional usability characteristics and possibly better
performance due to striping. You can choose for an extended-format
key-sequenced data set to be in the compressed format or encrypted
format or both. Extended-format data sets must be SMS managed. You
cannot use an extended-format data set for certain system data
sets.
Requirement: Do not use BISAM or QISAM. Use VSAM instead.
VSAM data set performance can benefit from using the IBM DS888x
zHyperlink technology, also known as synchronous I/O. zHyperLink
can achieve significant I/O latency improvements for read requests
when using non-linear VSAM data sets. When zHyperLink is enabled on
the system and a control unit (CI) of data is in the control unit
cache, a VSAM read request stays synchronous while the CI is
retrieved with a latency time of 20 to 30 microseconds,
significantly better than the more than 100-microsecond latency of
traditional DASD I/O. While zHyperLink improves latency time, it
also incurs small additional CPU utilization. VSAM and VSAM RLS
users should monitor the tradeoff, as well as the SMF42 subtypes 5
and 6 counts that are related to zHyperLink ('syncIO')
zHyperLink I/O is disabled system-wide by default. To do zHyperLink
I/O for a read request, all of the following conditions must be met
and checked by VSAM and VSAM RLS before they issue a zHyperLink I/O
request:
• The user has issued the SETIOS ZHYPERLINK OPER=[ALL|READ]
command, or SYS1.PARMLIB(IECIOSxx) specifies
ZHYPERLINK,OPER=[ALL|READ]. NONE is the default in z/OS 2.1 through
z/OS 2.3. ALL is the default.
• SYS1.PARMLIB(IGDSMSxx) or the SETSMS command specifies
VSAM_ZHYPERLINK(YES), where NO is the default.
• The data sets must be set to be zHyperLink eligible. This is done
by specifying zHyperLink Eligible for Read: YES in the storage
class for the data sets.
• V SMS,DSNAME(datasetname) ZHLREAD=YES is issued to make read I/O
for the specified data set synchronous, overriding the
specification in the storage class for that data set. Default is
not to override the storage class specification.
• The RLS or VSAM-built buffer, or the VSAM user-provided buffer
(such as VSAM user buffering) that receives the CI must on a
quadword boundary.
• zHyperLink I/O needs to have the internal Bypass Extent
Serialization set ON. RLS and VSAM set it.
When all of those conditions are met and VSAM or VSAM RLS initiates
a zHyperLink I/O request, the I/O driver can still do asynchronous
I/O because the CI is larger than 4 KB, or the CI is not found in
control unit cache. In that situation, VSAM RLS accumulates the
suspend elapsed time for the asynchronous DASD I/O for the data
set. The counts are recorded in SMF42 subtype 6 fields
S42SNAvgARDelay S42SNARDelayCount to help the users understand the
potential performance benefits of enabling zHyperLink reads for
VSAM RLS data sets. Non-RLS VSAM does not do such count.
Access to z/OS UNIX files Programs can access the information in
UNIX files through z/OS UNIX System Services (z/OS UNIX) calls,
such as open(pathname), read(file descriptor), and write(file
descriptor). Programs can also access the information in UNIX files
through the BSAM, BPAM, QSAM, and VSAM access methods. When you use
BSAM or QSAM, a UNIX file is simulated as a single-volume
sequential data set. When you use VSAM, a UNIX file is simulated as
an ESDS. When you use BPAM, a UNIX directory and its files are
simulated as a partitioned data set directory and its
members.
You can use the following types of UNIX files with the access
methods:
• Regular files, including files accessed through Network File
System (NFS), temporary file system (TFS), HFS, or z/OS File System
(zFS)
• Character special files • First-in-first-out (FIFO) special files
• Symbolic links
You cannot use the following types of UNIX files with the access
methods:
Working with Data Sets
• UNIX directories, except indirectly through BPAM • External
links
Files can reside on other systems. The access method user can use
NFS to access them.
Selection of an access method In selecting an access method for a
data set, consider the organization of the data set, what you need
to specify through macros, and the device type:
• VSAM data sets, PDSEs, PDSs, extended-format data sets, direct
data sets, and UNIX files must be stored on DASD volumes.
• Sequential data sets can be on DASD or tape volumes, or these
data sets can be read from or written to a unit record device or
TSO/E terminal. They can be spooled data sets. Spooled data sets
named SYSOUT can be directed over a network. Sequential data sets
also can be dummy data sets.
In addition, you should select a data organization according to the
type of processing you want to do: sequential or direct. For
example, RRDSs or key-sequenced data sets are best for applications
that use only direct access, or both direct and sequential access.
Sequential or VSAM entry-sequenced data sets are best for batch
processing applications and for sequential access.
Restriction: You cannot process VSAM data sets with non-VSAM access
methods, although you can use DIV macros to access linear data
sets. You cannot process non-VSAM data sets except for UNIX files
with VSAM.
See z/OS TSO/E Command Reference for information about using BSAM
and QSAM to read from and write to a TSO/E terminal in line
mode.
Direct Access Storage Device (DASD) volumes Although DASD volumes
differ in physical appearance, capacity, and speed, they are
similar in data recording, data checking, data format, and
programming. The recording surface of each volume is divided into
many concentric tracks. The number of tracks and their capacity
vary with the device.
DASD labels The operating system uses groups of labels to identify
DASD volumes and the data sets they contain. Application programs
generally do not use these labels directly. DASD volumes must use
standard labels. Standard labels include a volume label, a data set
label for each data set, and optional user labels. A volume label,
stored at track 0 of cylinder 0, identifies each DASD volume.
A utility program initializes each DASD volume before it is used on
the system. The initialization program generates the volume label
and builds the volume table of contents (VTOC). The VTOC is a
structure that contains the data set labels.
See Appendix A, “Using direct access labels,” on page 507 for
information about direct access labels.
Track format Information is recorded on all DASD volumes in a
standard format. This format is called count-key data (CKD) or
extended count-key data (ECKD).
Each track contains a record 0 (also called track descriptor record
or capacity record) and data records. Historically, S/390® hardware
manuals and software manuals have used inconsistent terminology to
refer to units of data written on DASD volumes. Hardware manuals
call them records. Software manuals call them blocks and use
“record” for something else. The DASD sections of this document use
both terms as appropriate. Software records are described in
Chapter 6, “Organizing VSAM data sets,” on page 75 and Chapter 20,
“Selecting record formats for Non-VSAM data sets,” on page
265.
For these data formats, one or more of the following is true:
Working with Data Sets
8 z/OS: z/OS DFSMS Using Data Sets
• Each VSAM control interval consists of one or more contiguous
blocks. Control intervals are grouped into control areas.
• Each non-VSAM block contains part of a record or one or more
records. Examples of these programming interfaces are BSAM, BDAM,
and EXCP.
• Each VSAM record occupies multiple control intervals or all or
part of a control interval. Each non-VSAM record occupies multiple
blocks or all or part of a block. An example is QSAM.
• The application program might regard byte streams as being
grouped in records. The program does not see blocks. Examples of
such programs include UNIX files and OAM objects.
The process of grouping records into blocks is called blocking. The
extraction of records from blocks is called unblocking. Blocking or
unblocking might be done by the application program or the
operating system. In z/OS UNIX, blocking means suspension of
program execution.
Under certain conditions, BDAM uses the data area of record zero to
contain information about the number of empty bytes following the
last user record on the track. This is called the track descriptor
record.
The following figure shows the two different data formats,
count-data and count-key-data, only one of which can be used for a
particular data set. An exception is PDSs that are not PDSEs. The
directory blocks are in count-key-data format, and the member
blocks normally are in count-data format.
Count Data Count Data Count Data
Count Data Count DataKey Count DataKey. . .
. . .
Figure 1. DASD volume track formats
In Count-Data Format, records are formatted without keys. The key
length is 0. The count area contains 8 bytes that identify the
location of the block by cylinder, head, and record numbers, and
its data length.
In Count-Key-Data Format, the blocks are written with hardware
keys. The key area (1 - 255 bytes) contains a record key that
specifies the data record, such as the part number, account number,
sequence number, or some other identifier.
In data sets, only BDAM, BSAM, EXCP, and PDS directories use blocks
with hardware keys. Outside data sets, the VTOC and the volume
label contain hardware keys.
Tip: The use of hardware keys is less efficient than the use of
software keys (which VSAM uses).
Track overflow The operating system no longer supports the track
overflow feature. The system ignores any request for it.
VSAM record addressing You identify VSAM records by their key,
record number, or relative byte address in the data set. See
“Selection of VSAM data set types” on page 79.
Working with Data Sets
Chapter 1. Working with data sets 9
Actual and relative addressing with non-VSAM access methods With
certain access methods, you can access data non-sequentially. You
can use addresses to identify block locations. Use two types of
addresses to store and retrieve data on DASD volumes: actual
addresses and relative addresses. When sequentially processing a
multiple volume data set with a BSAM DCB, except for
extended-format data sets, you can refer to only records of the
current volume.
Actual addresses
When the system returns the actual address of a block on a direct
access volume to your program, it is in the form MBBCCHHR, in which
the characters represent the following values: M
1-byte binary number that specifies the relative extent number.
Each extent is a set of consecutive tracks that are allocated for
the data set.
BBCCHH Three 2-byte binary numbers that specify the cell (bin),
cylinder, and head number for the block (its track address). The
cylinder and head numbers are recorded in the count area for each
block. All DASDs require that the bin number (BB) be zero.
R 1-byte binary number that specifies the relative block number on
the track. The block number is also recorded in the count
area.
If your program stores actual addresses in your data set, and you
refer to those addresses, the data set must be treated as
unmovable. Data sets that are unmovable cannot reside on
system-managed volumes.
If you store actual addresses in another data set, those addresses
become nonvalid if the first data set is moved or migrated.
Although you can mark the data set with the unmovable attribute in
DSORG that prevents the data set from being SMS-managed.
Relative addresses
BDAM, BSAM, and BPAM optionally use relative addresses to identify
blocks in the data set.
BSAM and BPAM relative addresses are relative to the data set on
the current volume. BDAM relative addresses are relative to the
data set and go across all volumes.
BDAM relative block addresses. The relative block address is a
3-byte binary number that shows the position of the block, starting
from the first block of the data set. Allocation of noncontiguous
sets of blocks does not affect the number. The first block of a
data set always has a relative block address of 0.
BDAM, BSAM, and BPAM Relative Track Addresses. With BSAM, you can
use relative track addresses in basic or large format data sets.
With BPAM, you can use relative track addresses in PDSs. The
relative track address has the form TTR or TTTR: TT or TTT
An unsigned two-byte or three-byte binary number specifying the
position of the track starting from the first track that is
allocated for the data set. It always is two bytes with BDAM and it
is two bytes with BSAM and BPAM when you do not specify the
BLOCKTOKENSIZE=LARGE parameter on the DCBE macro. It is three bytes
with BSAM and BPAM when you specify the BLOCKTOKENSIZE=LARGE
parameter on the DCBE macro. The value for the first track is 0.
Allocation of noncontiguous sets of tracks does not affect the
relative track number.
R 1-byte binary number specifying the number of the block starting
from the first block on the track TT or TTT. The R value for the
first block of data on a track is 1.
With most DASD devices, a data set can contain more than 32 767
tracks. That is X'7FFF'. Therefore, assembler halfword instructions
operating on two-byte numbers could result in non-valid data being
processed.
Relative Block Addresses for Extended-Format Data Sets. For
extended-format data sets, block locator tokens (BLTs) provide
addressing capability. You can use a BLT transparently, as if it
were a relative track record (TTR). The NOTE macro returns a 4-byte
value. If you do not code BLOCKTOKENSIZE=LARGE on
Working with Data Sets
10 z/OS: z/OS DFSMS Using Data Sets
the DCBE macro, then the three high-order bytes are the BLT value
and the fourth byte is a zero. If you code BLOCKTOKENSIZE=LARGE on
the DCBE macro, then the four bytes are the BLT value. Your program
uses the value from the NOTE macro as input to the POINT macro,
which provides positioning within a sequential data set through
BSAM. The BLT is essentially the relative block number (RBN) within
each logical volume of the data set (where the first block has an
RBN of 1). For compressed format data sets, the relative block
numbers represent uncompressed simulated blocks, not the real
compressed blocks.
A multistriped data appears to the user as a single logical volume.
Therefore, for a multistriped data set, the RBN is relative to the
beginning of the data set and incorporates all stripes.
Relative Track Addresses for PDSEs. For PDSEs, the relative track
addresses (TTRs) do not represent the actual track and record
location. Instead, the TTRs are tokens that define the record's
position within the data set. See “Relative track addresses (TTR)”
on page 397 for a description of TTRs for PDSE members and blocks.
Whether the value is three bytes or four bytes depends on whether
you specify BLOCKTOKENSIZE=LARGE on the DCBE macro.
Relative Track Addresses for UNIX files. For UNIX files, the
relative track addresses (TTRs) do not represent the actual track
and record location. Instead, the TTRs are tokens that define a
BPAM logical connection to a UNIX member or the record's position
within the file. Whether the value is three bytes or four bytes
depends on whether you specify BLOCKTOKENSIZE=LARGE on the DCBE
macro.
Magnetic tape volumes This topic discusses using tape labels and
specifying the file sequence number for data sets that are stored
on magnetic tape volumes.
Because data sets on magnetic tape devices must be organized
sequentially, the procedure for allocating space is different from
allocating space on DASD. All data sets that are stored on a given
magnetic tape volume must be recorded in the same density. See z/OS
DFSMS Using Magnetic Tapes for information about magnetic tape
volume labels and tape processing.
For information about nonstandard label processing routines, see
z/OS DFSMS Installation Exits.
Using magnetic tape labels The operating system uses groups of
labels to identify magnetic tape volumes and the data sets that
they contain. Application programs generally do not use these
labels directly. Magnetic tape volumes can have standard or
nonstandard labels, or they can be unlabeled. DASD volumes must use
standard labels. Standard labels include a volume label, a data set
label for each data set, and optional user labels. A volume label,
which is stored at track 0 of cylinder 0, identifies each DASD
volume.
International Organization for Standardization (ISO) and the
American National Standards Institute (ANSI) tape labels are
similar to IBM standard labels. ASCII permits data on magnetic tape
to be transferred from one computer to another, even though the two
computers can be products of different manufacturers. IBM standard
labels are coded in the extended binary-coded-decimal interchange
code (EBCDIC). ISO/ANSI labels are coded in the American National
Standard Code for Information Interchange (ASCII).
Specifying the file sequence number When a new data set is to be
placed on a magnetic tape volume, you must specify the file
sequence number if the data set is not the first one on the reel or
cartridge. The maximum value of the file sequence number of a data
set on a tape volume is 65535 for the following tapes:
• Standard label (SL) tapes • Standard user label (SUL) tapes •
Leading tape mark (LTM) tapes • Unlabeled (NL) tapes • Bypass label
processing (BLP) tapes
Working with Data Sets
Chapter 1. Working with data sets 11
Restriction: The ISO/ANSI (AL) labeled tapes do not allow a file
sequence number greater than 9999.
For additional information about using file sequence numbers, see
z/OS DFSMS Using Magnetic Tapes.
You can specify the file sequence number in one of the following
ways:
• Code the file sequence number as the first value of the LABEL
keyword on the DD statement or using the DYNALLOC, macro for
dynamic allocation.
• Catalog each data set using the appropriate file sequence number
and volume serial number. Issue the OPEN macro because the catalog
provides the file sequence number.
OPEN uses the file sequence number from the catalog if you do not
specify it on the DD statement or dynamic allocation.
• You can use the RDJFCB macro to read the job file control block
(JFCB), set the file sequence number in the JFCB, and issue the
OPEN, TYPE=J macro for a new or uncataloged data set. The maximum
file sequence number is 65535. This method overrides other sources
of the file sequence number.
For more information on the OPEN macro, see z/OS DFSMS Macro
Instructions for Data Sets. For more information on the RDJFCB and
OPEN, TYPE=J macros, see z/OS DFSMSdfp Advanced Services. For more
information on IEHPROGM, see z/OS DFSMSdfp Utilities.
Example of creating a tape data set with a file sequence number
greater than 9999
The following example shows how to use the OPEN,TYPE=J and RDJFCB
macros to create a cataloged tape data set with a file sequence
number of 10011. The file sequence number is stored in the JFCB. In
the JCL statement, specify the LABEL=(1,labeltype) parameter, where
labeltype is the type of tape label such as SL or NL. This example
works with any file sequence number from 1 to 65535 if the previous
file exists on the specified tape or on a volume that is named in
the JFCB or JFCB extension. When the system unallocates the data
set, it creates an entry for the data set in the catalog.
Example:
//* STEP05 //* Create a tape data set with a file sequence number
of 10011. //* Update the file sequence number (FSN) in JFCB using
OPEN TYPE=J macro.
//*--------------------------------------------------------------------
//STEP05 EXEC ASMHCLG //C.SYSIN DD * . . . L 6,=F'10011' CREATE FSN
10011 RDJFCB (DCBAD) READ JFCB STCM 6,B'0011',JFCBFLSQ STORE NEW
FSN IN JFCB OPEN (DCBAD,(OUTPUT)),TYPE=J CREATE FILE PUT
DCBAD,RECORD WRITE RECORD DCBAD CLOSE CLOSE FILE . . . DCBDCB
DDNAME=DD1,DSORG=PS,EXLST=LSTA,MACRF=PM,LRECL=80,RECFM=FB LSTA DS
0F RJFCB EXIT LIST DC AL1(EXLLASTE+EXLRJFCB) CODE FOR JFCB (X'87')
DC AL3(JFCBAREA) POINTER TO JFCB AREA JFCBAREA EQU * 176 bytes for
copy of JFCB * The IEFJFCBN does not define a DSECT. This continues
the CSECT. IEFJFCBN DEFINE THE JFCB FIELDS RECORD DC
CL80'RECORD10011' RECORD AREA IHAEXLST , Define symbols for DCB
exit list END //* JCL FOR ALLOCATING TAPE DATA SET //DD1 DD
DSN=DATASET1,UNIT=TAPE,VOL=SER=TAPE01,DISP=(NEW,CATLG), //
LABEL=(1,SL)
The output displays information about the new tape data set with a
file sequence number of 10011:
IEC205I DD1,OCEFS005,G.STEP05,FILESEQ=10011, COMPLETE VOLUME LIST,
DSN=DS10011,VOLS=TAPE01,TOTALBLOCKS=1
Working with Data Sets
12 z/OS: z/OS DFSMS Using Data Sets
Example of creating a tape data set using any file Sequence
number
The following example shows how to use the OPEN macro to create
several tape data sets with file sequence numbers ranging from 1 to
10010. In the JCL statement, specify the LABEL=(fsn,labeltype)
parameter, where fsn is the file sequence number and labeltype is
the type of tape label such as SL or NL.
Example:
//* STEP06 //* Create files 1 through 10010 on a single volume.
//*--------------------------------------------------------------
//STEP06 EXEC ASMHCLG //C.SYSIN DD * . . . L 6,=F'10010' CREATE
10010 FILES LA 5,1 START AT FILE 1 AND DS1 RDJFCB (DCBAD) READ JFCB
MVC JFCBAREA(44),=CL44'DS' DSNAME IS 'DSfsn' WHERE * fsn IS FSN 1
TO 10010 *
------------------------------------------------------------- *
This loop creates file sequence numbers from 1 to 10010. *
------------------------------------------------------------- LOOP
EQU * STCM 5,B'0011',JFCBAREA+68 STORE NEW FSN IN JFCB CVD
5,WORKAREA UPDATE DSNAME UNPK JFCBAREA+2(5),WORKAREA(8) LOAD JFCB
OI JFCBAREA+6,X'F0' SET DSfsn MVC RECORD+6(5),JFCBAREA+2 MOVE FSN
INTO RECORD * RECORD FORMAT IS 'RECORDfsn' OPEN (DCBAD,
(OUTPUT)),TYPE=J CREATE FILE NUMBER PUT DCBAD,RECORD WRITE RECORD
CLOSE (DCBAD,LEAVE) CLOSE FILE NUMBER CONTIN EQU * RDJFCB (DCBAD)
READ JFCB SR 5,5 ICM 5,B'0011',JFCBAREA+68 GET CURRENT FSN LA
5,1(5) INCREMENT FSN BCT 6,LOOP CONTINUE PROCESSING UNTIL DONE . .
. * DEFINITIONS DS 0D SAVE DC 18F'0' DCBAD DCB
DDNAME=DD1,DSORG=PS,EXLST=LSTA,MACRF=PM,BLKSIZE=80,RECFM=F LSTA DS
0F RJFCB EXIT LIST DC X'87' DC AL3(JFCBAREA) JFCBAREA DC 50F'0'
JFCB AREA RECORD DC CL80'RECORD' RECORD AREA DS 0D WORKAREA DC
2F'0' WORK AREA END /* * JCL FOR ALLOCATING TAPE DATA SET
This excerpt from the output shows information about the tape data
set with a file sequence number of 9999:
IEC205I DD1,OCEFS001,G.STEP06,FILESEQ=09999, COMPLETE VOLUME LIST,
DSN=DS09999,VOLS=TAPE01,TOTALBLOCKS=1
Identifying unlabeled tapes When you want to store a data set on
unlabeled tape volumes, the system needs a volume serial number to
identify each volume. If the data set is in an automatic tape
library, the system uses the volume serial number that is encoded
in the bar code on the outside of each cartridge. If the data set
is not in an automatic tape library, it is advisable to specify
enough volume serial numbers to contain the data set. If you do not
specify any volume serial numbers or do not specify enough of them,
the system or a tape management system assigns a serial number to
each unidentified volume. If the system assigns a serial number,
the serial number is in the form Lxxxyy, in which xxx is the data
set sequence number and yy is the volume sequence number for the
data set.
If you want to catalog or pass data sets that reside on unlabeled
volumes, specify the volume serial numbers for the required
volumes. Specifying the volume serial numbers ensures that data
sets residing
Working with Data Sets
Chapter 1. Working with data sets 13
on multiple volumes are not cataloged or passed with duplicate
volume serial numbers. Retrieving such data sets can give
unpredictable errors.
Using tape marks A tape mark must follow each data set and data set
label group. Tape marks cannot exist within a data set. When a
program writes data on a standard labeled or unlabeled tape, the
system automatically reads and writes labels and tape marks. Two
tape marks follow the last trailer label group on a standard-label
volume. On an unlabeled volume, the two tape marks appear after the
last data set.
When a program writes data on a nonstandard labeled tape, the
installation must supply routines to process labels and tape marks
and to position the tape. If you want the system to retrieve a data
set, the installation routine that creates nonstandard labels must
write tape marks. Otherwise, tape marks are not required after
nonstandard labels because installation routines manage positioning
of the tape volumes.
Data management macros You can use macros to process all the data
set types supported by the access methods just described. Macros
control data set allocation, input and output, the buffering
techniques used, and data security. See z/OS DFSMS Macro
Instructions for Data Sets for information about data management
macros. See z/OS DFSMSdfp Advanced Services for information about
system programming macros.
Table 1 on page 14 contains a summary of data management access
methods:
Table 1. Data management access methods
Data Set Organization Basic Queued VSAM
Direct BDAM
ESDS VSAM
KSDS VSAM
Partitioned (see Note 2) BPAM, BSAM (see Note 3)
QSAM
Sequential (see Note 5) BSAM QSAM
z/OS UNIX file (see Note 6) BSAM (see Note 7) QSAM (see Note 7)
VSAM (see Note 8)
Note:
1. The data-in-virtual (DIV) macro, which is used to access a
linear data set, is described in z/OS MVS Programming: Assembler
Services Guide.
2. PDSs and PDSEs are both partitioned organization data sets. 3.
BSAM and QSAM cannot be used to create or modify user data in
directory entries. 4. Refers to fixed-length and variable-length
RRDSs. 5. Sequential data sets and extended-format data sets are
both sequential organization data sets. 6. A UNIX file can be in
any type of z/OS UNIX file system such as HFS, NFS, TFS, or zFS. 7.
When you access a UNIX file with BSAM or QSAM, the file is
simulated as a single-volume sequential
data set. 8. When you access a UNIX file with VSAM, the file is
simulated as an ESDS.
Data sets can also be organized as PDSE program libraries. PDSE
program libraries can be accessed with BSAM, QSAM, or the program
management binder. The first member written in a PDSE library
determines the library type, either program or data.
Working with Data Sets
14 z/OS: z/OS DFSMS Using Data Sets
Data set processing To process a data set, first allocate it
(establish a link to it), then access the data using macros for the
access method that you have chosen. For information about accessing
UNIX files, see “Processing UNIX files with an access method” on
page 19.
Allocating data sets Allocate means either or both of two
things:
• To set aside (create) space for a new data set on a disk. • To
establish a logical link between a job step and any data set.
You can use any of the following methods to allocate a data
set.
For information about these methods, see Chapter 2, “Using the
Storage Management Subsystem,” on page 27.
Access method services
You can define data sets and establish catalogs by using a
multifunction services program called access method services. Use
the following commands with all data sets.
Table 2. Access method services commands
Command Description
ALTER Change the attributes of a data set
DEFINE NONVSAM Catalog a data set
DELETE Delete a data set
LISTCAT List catalog entries
PRINT Print a data set
For information about access method services commands see z/OS
DFSMS Access Method Services Commands.
ALLOCATE command
You can issue the ALLOCATE command either through access method
services or TSO/E to define VSAM and non-VSAM data sets.
For information about TSO commands, see z/OS TSO/E Command
Reference.
Dynamic allocation
You can allocate VSAM and non-VSAM data sets using the DYNALLOC
macro with the SVC 99 parameter list.
For information about dynamic allocation, see z/OS MVS Programming:
Authorized Assembler Services Guide.
JCL
All data sets can be defined directly through JCL.
Related reading: For information about using JCL, see z/OS MVS JCL
Reference and z/OS MVS JCL User's Guide.
Working with Data Sets
Chapter 1. Working with data sets 15
Processing data sets through programs Programs process data sets in
the following sequence:
1. Allocate the data set to establish the logical link between a
program and a data set. You can do this either outside the program
with JCL or the TSO ALLOCATE command or inside the program with
dynamic allocation.
2. Open the data set, identifying it with a DDNAME. 3. Do reads and
writes using an access method. 4. Close the data set. 5. Deallocate
the data set. There are three ways to do this:
• For non-VSAM data sets only, specifying FREE=CLOSE when closing
the data set. (The FREE=CLOSE parameter is ignored for VSAM data
sets.)
• Your program can call dynamic deallocation. • During the step
termination process, the operating system automatically deallocates
any remaining
allocated data sets.
Using access methods All the access methods described in this
document allow you to do the following:
• Share a data set among different systems, different jobs in a
single system, multiple access method control blocks (ACBs) or data
control blocks (DCBs) in a task, or different subtasks in an
address space. See Chapter 12, “Sharing VSAM data sets,” on page
177 for information about sharing a VSAM data set. See Chapter 23,
“Sharing non-VSAM data sets,” on page 335 for information about
sharing a non-VSAM data set.
• Share buffers and control blocks among VSAM data sets. See
Chapter 13, “Sharing resources among VSAM data sets,” on page
191.
• Provide user exit routines to analyze logical and physical
errors, and to perform end-of-data processing. See Chapter 31,
“Using non-VSAM user-written exit routines,” on page 473 and
Chapter 16, “Coding VSAM User-Written Exit Routines,” on page
221.
• Back up and recover data sets. See Chapter 4, “Backing up and
recovering data sets,” on page 47. • Maintain data security and
integrity. See Chapter 5, “Prot