chapter05 working with data sets · pdf fileintroduction to the new mainframe how data sets...

25
Introduction to the new mainframe Chapter 5: Working with data sets © Copyright IBM Corp., 2006. All rights reserved.

Upload: ngodan

Post on 06-Feb-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Chapter 5: Working with data sets

© Copyright IBM Corp., 2006. All rights reserved. py g p , g

Page 2: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Chapter 5 objectives

B bl tBe able to: • Explain what a data set is• Describe data set naming conventionsDescribe data set naming conventions

and record formats• List some access methods for managing

data and programsdata and programs• Explain what catalogs and VTOCs are

used forCreate delete and modify data sets• Create, delete, and modify data sets

• Explain the differences between UNIX file systems and z/OS data sets

• Describe the z/OS UNIX file systems’ use of data sets.

© Copyright IBM Corp., 2006. All rights reserved. 2

Page 3: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Key terms in this chapter

bl k i b• block size• catalog• data set

• member • PDS and PDSE• record format or RECFM

• high level qualifier or HLQ• library• logical record length or LRECL

• system managed storage or SMS

• virtual storage access method• logical record length or LRECL virtual storage access method or VSAM

• volume table of contents or VTOCVTOC

© Copyright IBM Corp., 2006. All rights reserved. 3

Page 4: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

What is a data set?

A data set is a collection of logically related data records stored on one disk storage volume or a set of volumes.

A d t t bA data set can be:• a source program• a library of macros• a library of macros• a file of data records used by a processing program.

You can print a data set or display it on a terminal. The ou ca p t a data set o d sp ay t o a te a elogical record is the basic unit of information used by a program running on z/OS.

© Copyright IBM Corp., 2006. All rights reserved. 4

Page 5: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

How data is stored in a z/OS system

D i d di d i (DASD)• Data is stored on a direct access storage device (DASD), magnetic tape volume, or optical media.

• You can store and retrieve records either directly or sequentially. y q y• You use DASD volumes for storing data and executable

programs, including the operating system itself, and for temporary working storagetemporary working storage.

• You can use one DASD volume for many different data sets, and reallocate or reuse space on the volume.

© Copyright IBM Corp., 2006. All rights reserved. 5

Page 6: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Data management in z/OS

Data management involves all of the following tasks: • allocation, placement, monitoring, migration, backup, recall,

recovery and deletionrecovery, and deletion.Storage management is done either manually or through

automated processes (or through a combination or p ( gboth).

In z/OS, Data Facility: System-Managed Storage (DFSMS) y y g g ( )is used to automate storage management for data sets.

© Copyright IBM Corp., 2006. All rights reserved. 6

Page 7: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

What an access method is

D fi h h i d d i d• Defines the technique used to store and retrieve data. • Includes system-provided programs and utilities to define and

process data sets. p• Commonly used access methods include the following:

o VSAM, QSAM, BSAM, BDAM, and BPAM.

© Copyright IBM Corp., 2006. All rights reserved. 7

Page 8: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

DASD: Use and terminology

Direct Access Storage Device (DASD) is another name for a disk drive.

DASD l d f t i d t d t blDASD volumes are used for storing data and executable programs.

Data sets in a z/OS system are organized on DASDData sets in a z/OS system are organized on DASD volumes.• A disk drive contains cylindersA disk drive contains cylinders• Cylinders contain tracks• Tracks contain data records

© Copyright IBM Corp., 2006. All rights reserved. 8

Page 9: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Using a data set

To use a data set, you first allocate it. Then, access the data using macros for the access method that you have chosenchosen.

Various ways to allocate a data set:• ISPF data set panel option 3 2• ISPF data set panel, option 3.2• Access Method Services• TSO ALLOCATE command • job control language (JCL)

© Copyright IBM Corp., 2006. All rights reserved. 9

Page 10: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Allocating space on DASD volumes

How space is specified:• explicitly (SPACE parameter)• implicitly (SMS data class)• implicitly (SMS data class)

Logical records and blocks:• Smallest amount of data to be processed• Smallest amount of data to be processed• Grouped in physical records named blocks

Data set extents:ata set e te ts• Space for a disk data set is assigned in extents

© Copyright IBM Corp., 2006. All rights reserved. 10

Page 11: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Data set record formatsd dF record

block block

record record recordF

FB

Fixed records.

recordrecord recordrecord record recordFBFixed blocked records. BLKSIZE = n * LRECL

recordrecord recordV

RDWVariable records.

block blockrecord record record recordrecord

BDW

VBVariable blocked records. BLKSIZE >= 4 + n * largest LRECL

record record record record

BDW

UUndefined records. No defined internal structure for access method.

© Copyright IBM Corp., 2006. All rights reserved. 11

Record and block descriptors words are each 4 bytes long

Page 12: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Types of data sets

We discuss three types in this class: • Sequential, partitioned, and VSAM

A ti l d t t i ll ti f d itt dA sequential data set is a collection of records written and read in sequential order from beginning to end.

A partitioned data set (PDS) is a collection of sequentialA partitioned data set (PDS) is a collection of sequential data sets, called members.• Consists of a directory and one or more members.Consists of a directory and one or more members.• Also called a library.

A PDSE is a partitioned data set extended.p

© Copyright IBM Corp., 2006. All rights reserved. 12

Page 13: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

PDS versus PDSE

PDS data sets:• Simple and efficient way to organize related groups of sequential

filesfiles.

PDSE data sets:• Similar to a PDS, but advantages include:

o Space reclaimed automatically when a member is deletedo Flexible sizeo Can be sharedo Faster directory searchesy

© Copyright IBM Corp., 2006. All rights reserved. 13

Page 14: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

What is a data set, and how is it storedSequential Data Set

Record 1 Record 2 Record 3 Record 4

Sequential Data Set

DASD

Partitionedand Record 4

etc ...Sequential

Partitioned Data SetDirectory

Entry for COMPJCL Entry for JCOPY Entry for SORT1

Previously used space recoverable by compress utility

COMPJCL

JCOPY

SORT1

© Copyright IBM Corp., 2006. All rights reserved. 14

Available space

Page 15: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

VSAM

VSAM is Virtual Storage Access MethodVSAM provides more complex functions than other disk

th daccess methodsVSAM record formats:

Ke Seq ence Data Set (KSDS)• Key Sequence Data Set (KSDS)• Entry Sequence Data Set (ESDS)• Relative Record Data Set (RRDS)Relative Record Data Set (RRDS)• Linear Data Set (LDS)

© Copyright IBM Corp., 2006. All rights reserved. 15

Page 16: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Simple VSAM control interval

R R R CIDR1 R2 R3 free space in CI D

FDF

DF

DF

Record Descriptor Fields

© Copyright IBM Corp., 2006. All rights reserved. 16

Page 17: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

How data sets are namedData set naming conventionData set naming convention

• Unique nameo Maximum 44 characters

• Maximum of 22 name segments: level qualifier• Maximum of 22 name segments: level qualifier o The first name in the left: high level qualifier (HLQ)o The last name in the right: low level qualifier (LLQ) o Level qualifiers are separated by '.'

• Each level qualifier:o From 1 up to 8 characterso The first must be alphabetical (A-Z) or special (@ # $)o The 7 remaining: alphabetical national numeric (0 9) or hyphen ( )o The 7 remaining: alphabetical, national, numeric (0-9) or hyphen (-)o Upper case only

• Example: MYID.JCL.FILE2 HLQ: MYID 3 qualifiers Member name of partitioned data setMember name of partitioned data set

• 8 bytes long• First byte: alphabetical (A-Z) or special (@ # $)• The 7 remaining: alphabetical, special, numeric (0-9)

© Copyright IBM Corp., 2006. All rights reserved. 17

The 7 remaining: alphabetical, special, numeric (0 9)

Page 18: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Catalogs and VTOCs

z/OS uses a catalog and a volume table of contents (VTOC) on each DASD volume to manage the storage and placement of data setsplacement of data sets.

VTOC:VTOC:• Lists the data sets on a volume• Lists the free space on the volume.

© Copyright IBM Corp., 2006. All rights reserved. 18

Page 19: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

VTOC

LABEL(volser)

free spaceYOUR.DATAMY.DATA

VTOC

trackstrackstracks trackstrackstracks

Extents

© Copyright IBM Corp., 2006. All rights reserved. 19

Page 20: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

How a catalog is used

A catalog associates a data set with the volume on which the data set is located.

L ti d t t iLocating a data set requires:• Data set name• Volume name• Volume name• Unit (volume device type)

Typical z/OS system includes a master catalog and yp ca /OS syste c udes a aste cata og a dnumerous user catalogs.

© Copyright IBM Corp., 2006. All rights reserved. 20

Page 21: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Catalog Structure SYSTEM.MASTER.CATALOG

Master Catalog

Data Set-SYS1.A1or

HLQs (alias)IBMUSER...USER USERCAT COMPANYUSERCAT.IBM USERCAT.COMPANY

Data Set withHLQ=USER

User Catalog

USERCAT.IBM

User Catalog

Data Set withHLQ=IBMUSER

Catalog StructureHLQ=USERHLQ IBMUSER

volume (wrk002)unit (3390) volume (wrk001)

unit (3390)

IBMUSER.A1USER.A1SYS1.A1

IBMUSER.A2IBMUSER.A3

volume (012345)unit (tape)

USER.TAPE.A1

© Copyright IBM Corp., 2006. All rights reserved. 21

Page 22: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

z/OS UNIX file systems

• z/OS UNIX System Services (z/OS UNIX) allows z/OS to access UNIX filesUNIX files.

• A z/OS UNIX file system is hierarchical and byte-oriented.• Files in the UNIX file system are sequential files and are

accessed as byte streams.• UNIX files and traditional z/OS data sets can reside on the same

DASD volumeDASD volume.

© Copyright IBM Corp., 2006. All rights reserved. 22

Page 23: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

UNIX file system structure

Directory

Directory Directory

Directory Directory Directory

File

File

File

File

File

File

File

File

File

File

File

FileFile

File

File

File

File

File

File

© Copyright IBM Corp., 2006. All rights reserved. 23

Page 24: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Summary

A d i ll i f l i ll l d d (• A data set is a collection of logically related data (programs or files)

• Data sets are stored on disk drives (DASD) and tape.( ) p• Most z/OS data processing is record-oriented. Byte stream files

are not present in traditional processing, except in z/OS UNIX. /OS d f ll ll d fi d f t b d d• z/OS records follow well-defined formats, based on record

format (RECFM), logical record length (LRECL), and the maximum block size (BLKSIZE).

• z/OS data set names have up to 44 characters, divided by periods into qualifiers.

© Copyright IBM Corp., 2006. All rights reserved. 24

Page 25: Chapter05 Working with data sets · PDF fileIntroduction to the new mainframe How data sets are named ... Microsoft PowerPoint - Chapter05 Working with data sets slides.ppt [Compatibility

Introduction to the new mainframe

Summary (continued)

C l d l d• Catalogs are used to locate data sets. • VSAM is an access method that provides more complex

functions than other disk access methods. • z/OS libraries are known as partitioned data sets (PDS or PDSE)

and contain members. A fil i th hi hi l fil t b ith t t fil• A file in the hierarchical file system can be either a text file or a binary file.

• z/OS treats an entire UNIX file system hierarchy as a collection of y y“data sets.” Each data set is a mountable file system.

© Copyright IBM Corp., 2006. All rights reserved. 25