Using Data Sets
Total Page:16
File Type:pdf, Size:1020Kb
Introducción al Sistemas Operativo z/OS Introducción a los Data Sets USING DATA SETS José Luis Calva Martínez Email: [email protected] [email protected] INTRODUCTION In working with the z/OS operating system, you must understand data sets, the files that contain programs and data. The characteristics of traditional z/OS data sets differ considerably from the file systems used in UNIX and PC systems. To make matters even more interesting, you can also create UNIX file systems on z/OS, with the common characteristics of UNIX systems. A data set is a collection of logically related data; it can be a source program, a library of programs, or a file of data records used by a processing program. DtDataset recordsarethe bibasicunit of ifinforma tion used bby a processing program. José Luis Calva 1 Introducción al Sistemas Operativo z/OS Introducción a los Data Sets WHAT IS A DATA SET? Nearly all work in the system involves data input or data output. In a mainframe system, the channel subsystem manages the use of I/O devices, such as disks, tapes, and printers, while z/OS associates the data for a given task with a device. z/OS manages data by means of data sets. The term data set refers to a file that contains one or more records. Any named group of records is called a data set. Data sets can hold information such as medical records or insurance records, to be used by a program running on the system. Data sets are also used to store information needed by applications or the operating system itself, such as source programs, macro libraries, or system variables or parameters. For data sets that contain readable text, you can print them or display them on a console (many data sets contain load modules or other binary data that is not really printable). Data sets can be cataloged, which permits the data set to be referred to by name without specifying where it is stored. WHAT IS A DATA SET? In simplest terms, a record is a fixed number of bytes containing data. Often, a record collects related information that we treat as a unit, such as one item in a database or personnel data about one member of a department. The term field refers to a specific portion of a record used for a particular category of data, such as an employee's name or department. The record is the basic unit of information used by a program running on z/OS. z/OS UNIX files are different from the typical z/OS data sets because they are byte-oriented rather than record-oriented. The records in a data set can be organized in various ways, depending on how we plan to access the information. If you write an application program that processes things like personnel data, for example, your program can define a record format for each person’s data. There are many different types of data sets in z/OS, and different methods for accessing them. We discuses three types of data sets: sequential, partitioned, and VSAM data sets. José Luis Calva 2 Introducción al Sistemas Operativo z/OS Introducción a los Data Sets DATA SETS TYPES Sequential data set, records are data items that are stored consecutively. To retrieve the tenth item in the data set, for example, the system must first pass the preceding nine items. Data items that must all be used in sequence, like the alphabetical list of names in a classroom roster, are best stored in a sequential data set. A partitioned data set or PDS consists of a directory and members. The directory holds the address of each member and thus makes it possible for programs or the operating system to access each member directly. Each member, however, consists of sequentially stored records. Partitioned data sets are often called A collection of logically related data records, such as a library of macros or a source program. Programs are stored as members of partitioned data sets. Generally, the operating system loads the members of a PDS into storage sequentially, but it can access members directly when selecting a program for execution. In a Virtual Storage Access Method (VSAM) key sequenced data set (KSDS), records are data items that are stored with control information (keys) so that the system can retrieve an item without searching all preceding items in the data set. VSAM KSDS data sets are ideal for data items that are used frequently and in an unpredictable order. Where are data sets stored? z/OS supports many different devices for data storage. Disks or tape are most frequently used for storing data sets on a long-term basis. Disk drives are known as direct access storage devices (DASDs) because, although some data sets on them might be stored sequentially, these devices can handle direct access. Tape drives are known as sequential access devices because data sets on tape must be accessed sequentially. The term DASD applies to disks or simulated equivalents of disks. All types of data sets can be stored on DASD (only sequential data sets can be stored on magnetic tape). You 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. To enable the system to locate a specific data set quickly, z/OS includes a data set known as the master catalog that permits access to any of the data sets in the computer system or to other catalogs of data sets. z/OS requires that the master catalog reside on a DASD that is always mounted on a drive that is online to the system. José Luis Calva 3 Introducción al Sistemas Operativo z/OS Introducción a los Data Sets What are 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, system-provided programs (or macros) to define data sets, and utility programs to process data sets. Access methods are identified primarily by the data set organization. z/OS users, for example, use the basic sequential access method (BSAM) or queued sequential access method (QSAM) with sequential data sets. 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 using BSAM, QSAM, basic partitioned access method (BPAM), or virtual storage access method (VSAM). Commonly used access methods include the following: z QSAM Queued Sequential Access Method (heavily used) z BSAM Basic Sequential Access Method (for special cases) z BDAM Basic Direct Access Method (becoming obsolete) z BPAM Basic Partitioned Access Method (for libraries) z VSAM Virtual Sequential Access Method (used for more complex applications) How are DASD volumes used? DASD volumes are used for storing data and executable programs (including the operating system itself), and for temporary working storage. One DASD volume can be used for many different data sets, and space on it can be reallocated and reused. On a volume, the name of a data set must be unique. A data set can be located by device type, volume serial number, and data set name. This is unlike the file tree of a UNIX system. The basic z/OS file structure is not hierarchical. z/OS data sets have no equivalent to a path name. 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. Each device has an access mechanism that contains read/write heads to transfer data as the recording surface rotates past them. José Luis Calva 4 Introducción al Sistemas Operativo z/OS Introducción a los Data Sets DASD terminology for UNIX and PC users The disk and data set characteristics of mainframe hardware and software differ considerably from UNIX and PC systems, and carry their own specialized terminology. Throughout this text, the following terms are used to describe various aspects of storage management on z/OS: Direct Access Storage Device (DASD) is another name for a disk drive. A disk drive is also known as a disk volume, a disk pack, or a Head Disk Assembly (HDA). We use the term volume except when discussing physical characteristics of devices. A disk drive contains cylinders. Cylinders contain tracks. Tracks contain data records. Data blocks are the units of recording on disk. What are DASD labels? The operating system uses groups of labels to identify DASD volumes and the data sets they contain. Customer 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. The z/OS system programmer or storage administrator uses the ICKDSF utility program to initialize each DASD volume before it is used on the system. ICKDSF generates the volume label and builds the volume table of contents (VTOC), a structure that contains the data set labels. The system programmer can also use ICKDSF to scan a volume to ensure that it is usable and to reformat all the tracks.