JCL: Types of Data Sets
Unit 1. Data Set Overview
In this course, you see how to define data set names composed of multiple segments separated by periods (for example, A.B.C). You'll see that for a cataloged data set, the first segment (A.) corresponds to the high-level index in the catalog.You'll also examine rules for naming a permanent data set and for naming partitioned data sets.
In this unit, you will learn that the course assumes a familiarity with JCL coding and basic concepts of data sets. You will also learn the differences between permanent and temporary data sets.
After completing this unit, you should be able to:
- Describe DD (Data Definition) statements
- Identify the different data type sets
- Compare and contrast VSAM and non-VSAM data sets
- Distinguish between temporary and permanent data sets
Topic 1.1: Review of Data Sets and DD Statements
*The DD (Data Definition) StatementNow review information about data sets and DD statements. As mentioned previously, you will be relying on your prior JCL knowledge when looking at the topics in this course.
The course assumes a familiarity with the DD (Data Definition) statement and its parameters, in particular DCB, DISP, DSN, LABEL, SPACE, UNIT and VOL.
As a quick review of these parameters, try the questions on the next few screens.
*Coding JCL Statements
Not only will you need to rely on your prior JCL knowledge but you will also be coding JCL.
The course assumes you can code JCL statements, in particular, the DD statement. Here's the format of a generic DD statement:
//ddname DD operands comments
To refresh your memory on JCL coding formats, generic parameter statements are periodically shown. For example:
DISP=(<status><,normal disp><,abnormal disp>)
A parameter shown in < > is optional. For example <status> is an optional parameter.
Topic 1.2: Data Set Types
*Data Set FamiliarityJCL: Data Sets also presumes you are familiar with the different types of data sets.
Data sets are classified according to the way they store and access data.
To jog your memory, a brief description of some data set types follows.
*Four Different Types
Different types of data sets include...
- sequential: a data set whose records are organized on the basis of their successive physical positions.
- direct: a data set whose records can be accessed randomly without accessing the records that precede it. The random access is usually done via a relative block number or a physical address.
- indexed: a data set whose records can be accessed directly with a key field.
- partitioned: a data set that is divided into partitions, called members. Each member is a sequential data set. Each partitioned data set (PDS) contains a directory used to locate members in the PDS. A PDS is also referred to as a library.
Topic 1.3: Comparing VSAM and Non-VSAM Data Sets
*Four VSAM SetsThe different types of data sets (indexed, sequential and direct) are also useful distinctions when looking at the four kinds of VSAM data sets:
- A key sequenced data set (KSDS) is the functional equivalent of an indexed data set.
- An entry sequenced data set (ESDS) is the functional equivalent of a sequential data set.
- A relative record data set (RRDS) is the functional equivalent of a direct access data set.
- A linear data set is a special type of VSAM data set generally used only by system support programs such as DB2.
*Data Set Comparisons
Speaking of VSAM data sets, let's briefly compare VSAM and non-VSAM data sets.
Then we'll look at the effects of the Storage Management Subsystem (SMS) on data set creation and management.
*Basic Differences
Background knowledge of the distinction between VSAM and non-VSAM data sets is helpful for this course.
There are two basic differences between them:
- Where the information regarding the physical characteristics of a data set is kept
- How the records are grouped in the data set
*Information in the VTOC
Where is the information regarding the physical characteristics of a data set kept?
For non-VSAM data sets it is contained in the VTOC of the disk volume where it resides. Additionally, you can describe this information either
- Using the DCB parameter in the JCL or
- Using the file description statements of your programming language from within the program that processes the file.
*VSAM Catalogs
For VSAM data sets it is kept in interactive catalog facility catalogs or VSAM catalogs.
A catalog is a data set which describes the physical characteristics and location of data sets. You'll learn more about catalogs later in the course.
The VTOC entry for a VSAM data set is only used to indicate where on a disk the data set resides and how big it is.
*Grouping Records
How are the records grouped in the data set?
For non-VSAM data sets logical records are grouped together (blocked) to form a physical record (block). The data is recorded on disk or tape in blocks.
For VSAM data sets the data sets are referred to as VSAM clusters. Logical records are grouped into a CI (control interval). The data is recorded on disk in CIs. CIs are grouped together to form CAs (control areas).
*Utility Differences
Another basic difference between non-VSAM and VSAM data sets is reflected in the utilities used to maintain them.
For non-VSAM data sets: there are many utilities, such as IEBCOPY, IEBGENER, IEBDG, IEBISAM, IEBUPDTE. Each utility has a specific purpose. Some of the functions performed by the utilities overlap.
For VSAM data sets: one utility, IDCAMS, performs all the Access Method Services (AMS). IDCAMS performs most of the functions performed by non-VSAM utilities.
Actually, you can use IDCAMS for most VSAM and non-VSAM processing. Conventional utilities, on the other hand, cannot be used for VSAM data sets.
*Creation of Data Sets
Regarding creating non-VSAM and VSAM data sets
Non-VSAM data sets can be created and defined in the JCL used to run the program that will write data to them.
VSAM data sets can be created and defined
- In JCL with the RECORG parameter when SMS is active
- Using the AMS IDCAMS program
*Storage Management Subsystem (SMS)
As you learned in JCL: Fundamentals, MVS has a feature called the Storage Management Subsystem (SMS).
As you may recall, SMS simplifies the allocation and management of data sets.
SMS can manage most types of data sets, including: GDG PDS/PDSE sequential temporary VIO VSAM HFS SMS cannot manage the following types of data sets: instream (SYSIN) ISAM unmovable data sets SYSOUT SUBSYS tape (except those contained in an automated Tape Library Dataserver) TCAM.
*SMS Constructs
The storage administrator at your installation determines the data sets that will be managed by SMS. The storage administrator also defines the classes for each of the three SMS constructs:
DATACLAS - specifies the data class
MGMTCLAS - specifies the management class
STORCLAS - specifies the storage class
Installation-written automatic class selection (ACS) routines are used to assign these constructs to new data sets.
All SMS-managed permanent data sets are cataloged. You'll learn more about this later in the course.
Topic 1.4: Permanent and Temporary Data Sets
*Two Basic CategoriesBefore you go on to the next unit, let's take a quick look at permanent and temporary data sets. You'll learn more about both types later in this course. Data sets fall into one of two basic categories:
- Permanent
- Temporary
A temporary data set is created and deleted in the same job. Only the job that creates a temporary data set has access to it.
*Data Set Availability
The chart below shows which types of data sets can be permanent and/or temporary.
Permanent Temporary
Sequential Y Y
Direct Y Y
Partitioned (PDS/PDSE) Y Y
VSAM Y Y (SMS only)
Generation data set Y N
DD Statement Parameters
The DD statement parameters that determine whether a data set is permanent or temporary are:
DSN DISP
In this course, you'll learn how to code these parameters for all types of permanent and temporary data sets.
Topic 1.5: Unit 1 Summary
The following points were covered in this unit:- The course assumes a familiarity with the DD (Data Definition) statement and its parameters, in particular DCB, DISP, DSN, LABEL, SPACE, UNIT and VOL.
- The course assumes you can code JCL statements, in particular, the DD
statement. Here's the format of a generic DD
statement:
//ddname DD operands comments - JCL: Data Sets also presumes you are familiar with the different types of data sets.
- Background knowledge of the distinction between VSAM and non-VSAM data sets is helpful for this course. There are two basic differences between them are where the information regarding the physical characteristics of a data set is kept and how the records are grouped in the data set.
- SMS simplifies the allocation and management of data sets. SMS can manage
most types of data sets,
including:
GDG temporary
PDS/PDSE VIO
sequential VSAM
HFS - A permanent data set is created and then kept after a job ends. Other jobs can access a permanent data set.
- A temporary data set is created and deleted in the same job. Only the job that creates a temporary data set has access to it.
Unit 2. Using Permanent Data Sets
This unit focuses on using permanent data sets, including sequential, direct, partitioned (PDSs and PDSEs) and VSAM.
This unit starts with the general rules for naming all types of permanent data sets. Then it describes specific considerations for naming key sequenced VSAM data sets (KSDSs) and members of partitioned data sets (PDSs and PDSEs).
The other type of permanent data set, a generation data set, is covered in a later unit.
After completing this unit, you should be able to:
- Explain the rules for naming permanent data sets using the DSN
parameter
- Specify the status and disposition for permanent data sets using the DISP parameter
Topic 2.1: Naming Permanent Data Sets
*Auxiliary StorageWhenever you want to create a new data set and place it on auxiliary storage (disk or tape), the data set needs to be assigned a name. The data set name identifies a space on auxiliary storage.
And whenever you want to read or update a data set, you must identify what data set you want to access. A data set is identified by its data set name (DSN).
*Coding the DSN
Suppose the name of the data set you want to read is
MONTHLY.REPORT
You code the DSN on the DD statement as follows:
//INFILE DD DSN=MONTHLY.REPORT
You may use either DSNAME or the short form DSN when you code this parameter.
Topic 2.1.1: Data Set Names
*Unqualified and Qualified NamesThere are two types of data set names: unqualified and qualified.
An unqualified name can be up to eight alphanumeric characters long and must begin with an alphabetic (A to Z) or national (@,$,#) character.
For example, the data set name MASTER is an unqualified name.
*Naming Rules
A qualified name is made up of multiple unqualified names, or segments, connected by a period. The rules for naming each segment are the same as the rules for an unqualified name:
- Eight alphanumeric characters long
- Must begin with an alphabetic (A to Z) or national (@,$,#) character.
*Name Length
A qualified data set name can be up to forty-four characters long. The length of the data set name equals the sum of the lengths of the segments plus the number of periods.
The name must begin with a segment.
Two consecutive periods are not allowed.
Here are some valid data set names:
ABC.TEST
T.A.B123
A1234567.B1234567.C1234567
*Using Special Characters
You can use special characters (such as a blank, period, comma, slash and so on) in a data set name.
You must enclose the name in apostrophes if the characters are not significant to the system. For example, the data set name BACK UP includes a blank and is coded as:
DSN='BACK UP'
Because the blank is not significant to the system, the name must be enclosed in apostrophes.
*Using Apostrophes
If the data set name contains an apostrophe, you must code two consecutive apostrophes. For example, the data set name BACK'UP is coded as:
DSN='BACK''UP'
Certain special characters are significant to the system. When a data set name includes these characters, the name is not enclosed in apostrophes.
*Significant Special Characters
The following special characters are significant:
- The period that connects segments of a data set name; for example, ACCOUNT.MASTER
- The parentheses that enclose the member name of a PDS or PDSE; for example, TESTLIB(MEM1)
- The parentheses, plus(+) and minus(-) that are used in the name of a generation data set; for example, ACCOUNT.MASTER(+1)
- The && that starts a temporary data set name; for example, &&TEMP1
- The * that indicates a backward reference; for example, *.STEP1
Topic 2.1.2: High-Level Index*The First Segment
The first segment of a qualified data set name is called the high-level index of the data set.
Depending on your shop, for high-level index you may also use high-level qualifier, high-level node, prefix, or first node
In this course, you'll see high-level index used.
*An Example of High-Level Index
The first segment of a qualified data set name is called the high-level index of the data set.
For example, in the data set name
DP3030.LEWIS.NEWDATA
DP3030 is the high-level index.
The high-level index comes into play when cataloging data sets. It is discussed in more detail in the unit devoted to cataloging.
*Guaranteeing Unique Names
The structure of qualified data set names is used to group data sets or to guarantee unique names. For example:
PAYROLL.SOURCE PAYROLL.DATA PAYROLL.REPORT all belong to the payroll department.
Programmer Lewis uses her last name as the high-level index to guarantee unique data set names.
LEWIS.SOURCE LEWIS.DATA LEWIS.REPORT
Topic 2.2: Naming KSDSs, PDSs, and PDSEs
KSDSs, PDSs and PDSEsYou've seen the general rules for naming all types of permanent data sets.
Next, we'll present special considerations for naming key sequenced VSAM data sets (KSDSs) and members of partitioned data sets (PDSs and PDSEs).
*Key Sequenced Data Sets
VSAM data sets follow the same naming rules as other permanent data sets. There are, however, special considerations for naming key sequenced data sets (KSDSs).
As you know, a KSDS is the functional equivalent of an indexed data set. It consists of two components: the index component and the data component. The two components together are called a cluster.
*Using Cluster Names
When you create a KSDS, you assign a name to the cluster. For example, TEST.INVEN is the cluster name.
You also assign a different name to each component. For example, TEST.INVEN.INDX is the name of the index component. TEST.INVEN.DATA is the name of the data component.
When you refer to a KSDS using the DSN parameter, you use the cluster name. For example, DSN=TEST.INVEN refers to the entire KSDS.
*Partitioned Data Set
A partitioned data set (PDS or PDSE) consists of sequential records organized into separate groups called members. Each member is identified by a unique name.
A member name can be up to eight characters long and must begin with an alphabetic or a national character.
*Using Member Names
To refer to a member, you code the name of the PDS or PDSE followed by the member name enclosed in parentheses. No periods should be used before or inside the parentheses.
Here's an example: DSN=MEMO.LIB(FIRST)
MEMO.LIB is the name of a PDS. FIRST is the name of the member.
Topic 2.3: Unit 2 Summary
The following points were covered in this unit:- The DSNAME parameter is used to specify the name of a data set. You can abbreviate the parameter as DSN.
- An unqualified name can be up to eight alphanumeric characters long and must begin with an alphabetic (A to Z) or national (@,$,#) character.
- A qualified name is made up of multiple unqualified names, or segments, connected by a period. The rules for naming each segment are the same as the rules for an unqualified name.
- You can use special characters (such as a blank, period, comma, slash and so on) in a data set name. You must enclose the name in apostrophes if the characters are not significant to the system.
- The first segment of a qualified name is called the high-level index.
- The structure of qualified data set names is used to group data sets or to guarantee unique names.
- When you create a KSDS, you assign a name to the cluster. You also assign a different name to each component.
- When you refer to a KSDS using the DSN parameter, you use the cluster name.
- To refer to a member of a PDS or PDSE, you code the name of the PDS or PDSE followed by the member name enclosed in parentheses. No periods should be used before or inside the parentheses.
Unit 3. Disposition of Data Sets
In this unit, you will learn how to specify the status and disposition for a permanent data set using the DISP parameter.
You'll learn the general rules for coding the DISP parameter for permanent data sets.
And finally, you'll learn about special considerations for VSAM data sets, PDSs and PDSEs.
After completing this unit, you should be able to:
- Describe the DISP parameter
- Code the first, second and third subparameters of the
DISP
- Code DISP parameters for VSAM data sets
- Code DISP parameters for PDSs
- Code DISP parameters for PDSEs
Topic 3.1: Coding the DISP Parameter
DISP ParametersThe DISP parameter describes:
- The status of a data set
- The disposition of a data set after the step or job terminates.
DISP=(<status><,normal disp><,abnormal disp>)
*Subparameters
Below is a description of each subparameter:
Subparameter | Description |
---|---|
status | describes the status of the data set at the start of the step or job. |
normal-termination disposition | tells the system what to do with the data set if the step or job terminates normally. |
abnormal-termination disposition | tells the system what to do with the data set if the step or job terminates abnormally. |
Now, let's discuss the options for each subparameter.
Topic 3.2: The First Subparameter
*The Status SubparameterThe status subparameter tells the system the status of the data set at the beginning of the step or job. Here are valid options for this subparameter:
Option | Description |
---|---|
NEW | indicates that the data set does not exist and is being created. |
OLD | indicates that the data set exists. |
MOD | tells the system that records are to be added to the end of the data set. The data set must be sequential. If the data set does not exist, the system creates it. |
SHR | indicates that the data set exists and that other jobs can share it. |
If you don't code a status subparameter, the system uses NEW as the default.
MOD Status
MOD is a special status that allows you to add records to the end of an existing data set. The data set must be sequential.
With MOD, the system positions the read/write mechanism after the last record in an existing data set. Then it adds the new records in the sequence in which you write them.
If the data set does not exist, MOD tells the system to create it.
MOD is only used for specific types of applications. Don't use it as a substitute for NEW or OLD.
*Exclusive Control
NEW, OLD and MOD give a job exclusive control of a data set. When you code one of these options, other jobs in the system cannot access the data set until your job ends.
SHR allows multiple jobs to concurrently use a data set; this is called shared control. As a general rule, shared data sets can be retrieved or viewed, but not updated.
*General Guidelines
Here are some general guidelines for using the options of the status subparameter:
- Use NEW to create a data set.
- Use either OLD or SHR to retrieve a data set (input only).
*When to Use MOD and OLD
Use OLD to update a data set. This gives your job exclusive control of the data set and prevents any other job from accessing the data set while you're working with it.
Use MOD to add records to the end of a sequential data set. This gives your job exclusive control while the data set is being extended.
Topic 3.3: The Second Subparameter
*Normal Termination: DELETE and KEEPThe second subparameter of DISP tells the system what to do with a data set if the step or job terminates normally.
Here are valid options for this subparameter:
Option | Description |
---|---|
DELETE | tells the system to delete the data set. If the data set is also cataloged, DELETE implies UNCATLG. For a disk data set, the system frees up the space so that it can be used by another data set. For a tape data set, the data remains on the tape until another job overwrites it. |
KEEP | tells the system to keep the data set. |
*Normal Termination: PASS, CATLG, and UNCATLG
The second subparameter of DISP tells the system what to do with a data set if the step or job terminates normally.
Here are valid options for this subparameter:
Option | Description |
---|---|
PASS | indicates that the data set should be passed to a subsequent step or steps in the job. |
CATLG | tells the system to make an entry in a special data set called a catalog. The entry points to the data set so that it can be easily accessed by other jobs. |
UNCATLG | tells the system to remove the data set entry from the catalog. |
*Default Subparameters
If you omit this subparameter, the defaults are:
DELETE for a NEW data set.
KEEP for an existing data set.
Here, we'll discuss some general guidelines for using these options for permanent data sets. You'll learn more about the options in later units in this course.
*Creating a New Data Set
Let's start with creating a permanent data set.
A permanent data set is one that is retained by the system after it is created. The options that tell the system to retain a data set are KEEP and CATLG.
When you use KEEP, the system retains the data set. However, the system does not store information about the data set's location (VOL=SER) or its device type (UNIT). The system does store the data set's attributes (DCB).
To retrieve a data set that was kept, you must specify the data set's location (VOL=SER) and its device type (UNIT) on the DD statement.
*Using CATLG
If you use CATLG when you create a data set, the system makes an entry in a catalog. This entry contains information about the data set's location (VOL=SER) and device type (UNIT).
To retrieve a cataloged data set, you can omit all DD statement parameters except DSN and DISP.
From this brief discussion, you can see the benefits of cataloging -- it makes data set retrieval much easier!
If you're using SMS to manage your data sets, KEEP implies CATLG for new data sets because SMS-managed data sets are cataloged when they're allocated.
KEEP, UNCATLG, and DELETE
Cataloging is discussed in detail in the next unit in this course. Now let's discuss the options used when you retrieve a permanent data set.
The following normal disposition options are typically used when you retrieve a data set:
KEEP UNCATLG DELETE
KEEP is the default for an existing data set. So, the DISP parameters shown below are equivalent:
DISP=(OLD,KEEP) DISP=OLD
*Using UNCATLG
UNCATLG and DELETE are used to get rid of a data set at the end of a step or job.
UNCATLG tells the system to remove the data set's entry from the catalog. However, this option does not delete the data set.
Under SMS, UNCATLG is ignored and KEEP is implied. That's because SMS manages the cataloging and uncataloging of data sets based on the data set's STORCLAS and MGMTCLAS.
*Using DELETE
DELETE tells the system to uncatalog the data set if it was cataloged and then to delete it.
For a disk data set, the system frees up the space so that it can be used by another data set. For a tape data set, the data remains on the tape until another job overwrites it.
If you are deleting a cataloged data set and you code VOL=SER and UNIT on the DD statement, the system deletes the data set but does not uncatalog it. This happens because, by coding VOL=SER and UNIT, you are bypassing the catalog. You'll learn more about using the catalog in the next unit.
Topic 3.4: The Third Subparameter
*Abnormal TerminationThe third subparameter of DISP tells the system what to do with a data set if the step or job terminates abnormally.
Here are valid options for this subparameter:
DELETE KEEP CATLG UNCATLG
They have the same meaning as they do when they are used for normal disposition. Notice that PASS is not an option for abnormal disposition.
*Default Subparameters
If you omit the abnormal disposition subparameter, the system performs the action specified or implied by the normal disposition except when PASS is coded as the normal disposition. For PASS, the default abnormal disposition is:
- DELETE for a NEW data set
- KEEP for an existing data set
*Omitting Abnormal Disposition
Here are some examples of omitting the abnormal disposition subparameter:
- If you code DISP=(NEW,CATLG), the system catalogs the data set if the step or job terminates abnormally.
- If you code DISP=OLD, the system keeps the data set if the step or job terminates abnormally because the second subparameter, KEEP, is implied by default.
- If you omit the DISP parameter entirely, the system deletes the data set if the step or job terminates abnormally because the defaults are DISP=(NEW,DELETE,DELETE).
*Specify or Imply Actions
When you code JCL, make sure that the appropriate action is specified or implied for the abnormal termination disposition. For example, assume that your job creates a new data set and the DD statement for that data set specifies:
DISP=(NEW,CATLG)
Now assume that this job terminates abnormally. What happens? The system catalogs the data set.
Before you rerun this job, you'll need to perform "clean up" work. Because the data set is now cataloged, you'll need to delete it. Otherwise, the job will terminate abnormally because it will attempt to create a data set that already exists!
By using the appropriate abnormal disposition subparameter, you can minimize or avoid "clean up" work.
Topic 3.5: DISP Parameters for VSAM
*Special ConsiderationsHere, we'll present the special considerations for coding the DISP parameter for VSAM data sets.
We'll start with the status.
- You usually use DISP=OLD or DISP=SHR for VSAM data sets,
even if you're loading records into a new data set, because VSAM data sets are
actually created and cataloged using IDCAMS.
Under SMS, you can create a VSAM data set using JCL instead of IDCAMS. In this case, you'd code DISP=(NEW,CATLG) to create the data set.
*Sharing Data Sets
- Before you code SHR as the status for a VSAM data set, check with
someone in your installation to find out if the data set can be
shared.
VSAM data set sharing is controlled by parameters that are specified when the VSAM data set is defined. - MOD cannot be used unless the VSAM data set is being managed by SMS.
*Disposition Considerations
Now let's look at disposition considerations.
- If your data sets are not managed by SMS, only KEEP is valid for VSAM. If you want to catalog, delete or uncatalog a VSAM data set, you must use the IDCAMS utility.
- If your data sets are managed by SMS:
- All dispositions are valid for VSAM.
- If you specify UNCATLG or PASS, the system substitutes KEEP.
*Wrapping Up VSAM Considerations
This concludes the section on VSAM considerations.
Next you will see more about PDS considerations.
Topic 3.6: DISP Parameters for PDSs
*Special Considerations for PDSsHere, we'll present the special considerations for coding the DISP parameter for PDSs.
PDSs are usually used for specific purposes, such as program libraries, load libraries, and so on. In most installations, PDSs are created before you add, retrieve or update a member.
When you work with a PDS, you'll usually be dealing with an individual member. However, when you code the DISP for a PDS, you must consider the data set as a whole rather than as the individual member you're working with.
*General Guidelines
The general guidelines for working with a PDS are:
- Use DISP=OLD if you're adding or updating a member. This gives your job exclusive control of the PDS. If the member does not exist, it is added. If it does exist, it is updated.
For this reason, it's easier to code DISP=OLD when you add a member. Then you don't have to remember to change your JCL when you want to update the member.
- Code DISP=SHR if you're retrieving a member of a PDS.
- Never code DISP=MOD.
*Wrapping Up PDS Considerations
This concludes the section on PDS considerations.
Next you will see more about PDSE considerations.
Topic 3.7: DISP Parameters for PDSEs
*Special Considerations for PDSEsHere, we'll present the special considerations for coding the DISP parameter for PDSEs.
PDSEs are usually used for specific types of data libraries. In most installations, PDSEs are created before you add, retrieve or update a member.
When you work with a PDSE, you'll usually be dealing with an individual member. However, when you code the DISP for a PDSE, you must consider the data set as a whole rather than as the individual member you're working with.
*Valid Parameters
Below are valid DISP parameters for PDSEs:
- DISP=OLD or DISP=SHR can be used to add, retrieve or update members.
- DISP=(NEW,CATLG) can be used when you're adding a new member. However, if the member name already exists, the system terminates the job.
*Sharing Members
Unlike other types of data sets, PDSEs can be shared even if members are being added or updated. The system ensures data integrity by allowing only one job to update a member at a time. However, multiple jobs can add and update members concurrently.
Because PDSEs can be updated concurrently by more than one job, your installation might want you to code DISP=SHR when you work with PDSEs.
Topic 3.8: Unit 3 Summary
The following points were covered in this unit:- The DISP parameter describes the status of a data set and the disposition of a data set after the step or job terminates.
- The syntax of this parameter
is:
DISP=(<status><,normal disp><,abnormal disp>) - The status subparameter tells the system the status of the data set at the beginning of the step or job.
- The second subparameter of DISP tells the system what to do with a data set if the step or job terminates normally.
- The third subparameter of DISP tells the system what to do with a data set if the step or job terminates abnormally.
- You usually use DISP=OLD or DISP=SHR for VSAM data sets, even if you're loading records into a new data set, because VSAM data sets are actually created and cataloged using IDCAMS.
- If your data sets are not managed by SMS, only KEEP is valid for VSAM. If your data sets are managed by SMS all dispositions are valid for VSAM and if you specify UNCATLG or PASS, the system substitutes KEEP.
- Use DISP=OLD if you're adding or updating a member. This gives your job exclusive control of the PDS.
- DISP=OLD or DISP=SHR can be used to add, retrieve or update members of a PDSE.
Unit 4. Cataloging Data Sets
This unit examines the type of information contained in an interactive catalog facility catalog, a VSAM catalog and a CVOL.
You will also learn about the catalog structure on the MVS operating system.
NOTE: For purposes of abbreviation, we'll use the term ICF catalog in this unit to represent an interactive catalog facility catalog.
After completing this unit, you should be able to:
- Describe the catalog structure
- Describe the catalog entries for VSAM and non-VSAM
- Identify how and when to catalog
- Describe the benefits of cataloging
- Explain the catalog structure on an MVS operating system
Topic 4.1: The Catalog Structure
*Looking into CatalogsA catalog is a special kind of data set which contains information about other data sets.
Cataloging a data set means creating an entry in the catalog that points to the data set. Cataloging enables you to keep track of and retrieve data sets.
*Master and User Catalogs
There are two types of ICF catalogs -- master and user.
The ICF master catalog contains information about the environment.
An ICF user catalog contains information about VSAM data sets as well as non-VSAM data sets.
SMS-managed data sets are always cataloged in an ICF catalog.
*VSAM Catalogs
A VSAM catalog, also referred to as a VSAM user catalog, contains information about VSAM data sets as well as non-VSAM data sets.
Use of VSAM catalogs may be discouraged in many installations. Be sure to refer to your installation guidelines.
SMS-managed data sets cannot be cataloged in a VSAM catalog.
*CVOL (control volume) Catalogs
A CVOL (control volume) contains information about non-VSAM data sets only.
The use of CVOLs is discouraged in most installations.
SMS-managed data sets cannot be cataloged in CVOLs.
Topic 4.2: Catalog Entries
*Catalog Entries for VSAMA catalog entry for a VSAM data set consists of
- The data set name
- The device type and volume name where it resides
- The data set's physical characteristics such as record length, block size, record format
- The data set's processing options such as how shareable it is -- that is, whether it can be read or updated concurrently by more than one program
*Catalog Entries for Non-VSAM
A catalog entry for a non-VSAM data set consists of only
- The data set name
- The device type and volume name where it resides
Topic 4.3: How and When To Catalog a Data Set
*Conditions to ConsiderHow and when you catalog a data set depends on a number of conditions, including:
- Whether or not the data set is SMS-managed
- Whether the data set is a VSAM data set or non-VSAM data set
*Non-SMS-Managed Data Sets
Cataloging VSAM data sets is required.
You can only catalog non-SMS-managed VSAM data sets using Access Method Services (IDCAMS). IDCAMS is not covered in this course. You'll just see how to access the VSAM data sets.
Cataloging non-VSAM data sets is optional.
There are several ways to catalog non-SMS-managed non-VSAM data sets, including:
- Via JCL, using the DISP parameter
- Using IDCAMS (to catalog to an ICF or VSAM catalog)
- Using a utility program such as IEHPROGM (to catalog to a CVOL)
*Access Method Services
Actually, Access Method Services can be used for most VSAM and non-VSAM processing. Conventional utilities, on the other hand, cannot be used for VSAM data sets.
The following chart provides a summary of cataloging.
SMS-Managed Non-SMS-Managed
Data Sets Data Sets
VSAM | non-VSAM | VSAM | non-VSAM | |
---|---|---|---|---|
cataloging | automatic | automatic | required | optional |
control cataloging with |
* IDCAMS * JCL |
* IDCAMS * JCL |
* IDCAMS only | * IDCAMS * JCL * IEHPROGM |
cataloged in |
* ICF catalog | * ICF catalog | * ICF catalog * VSAM catalog |
* ICF catalog * VSAM catalog * CVOL |
*Cataloging Non-SMS-Managed Data Sets
Let's take a closer look at
- Controlling the cataloging of a non-VSAM data set with the DISP parameter
- If cataloging is optional, why you do it
DISP Parameter Values
Here are the values of the DISP parameter for cataloging and uncataloging a non-VSAM data set.
DISP Parameter | Value |
---|---|
DISP=(NEW,CATLG) | catalogs a newly created data set. |
DISP=(OLD,CATLG) | catalogs an existing data set. |
DISP=(OLD,UNCATLG) | uncatalogs a data set. The data set remains intact, though the information contained in the catalog about the data set is removed. |
DISP=(OLD,DELETE) | deletes and uncatalogs a data set if the data set was accessed through the catalog. |
Topic 4.4: Why Catalog
*What's the Purpose?As you know, cataloging a non-VSAM data set is optional. Why, then, would you decide to catalog it?
By cataloging, you save yourself the trouble of remembering
1) whether it is a tape or disk data set and 2) the name of the volume on which it resides
In simple terms, you don't have to code the UNIT and the VOL parameters on the JCL DD statements that reference that data set.
*Non-Cataloged Example
For example, if the data set is not cataloged, the JCL looks like this:
//INFILE DD DSN=MY.DATA,UNIT=DISK,VOL=SER=DISK1,DISP=SHR
or
//INDATA DD DSN=MY.FILE,UNIT=TAPE,VOL=SER=TAPE9,DISP=OLD
*Cataloged Example
If the data set is cataloged, you only need to code the DSN parameter and a DISP status other than NEW.
//INFILE DD DSN=MY.DATA,DISP=SHR
or
//INDATA DD DSN=MY.FILE,DISP=OLD
Why is the DISP parameter needed? Remember your basic JCL. NEW is the default.
*Reviewing What You Know
You've seen the type of information contained in an ICF catalog, a VSAM catalog and a CVOL.
You've learned that cataloging VSAM data sets is required, whereas for non-VSAM data sets it is optional.
All SMS-managed data sets (VSAM and non-VSAM) are cataloged automatically.
Proceed now to a discussion of the catalog structure on the MVS operating system.
Topic 4.5: Cataloging on MVS Operating Systems
*Master CatalogEach MVS system has one master catalog that is required. The master catalog is an ICF catalog. It points to ICF and VSAM user catalogs and CVOLs.
*Catalog Structure
This catalog structure --
one master catalog pointing to user catalogs and CVOLs
-- keeps the master catalog down to a reasonable size.
By confining the master catalog to pointers, you don't clutter it with all the information about the data sets. That information (name, volume name, physical characteristics, processing options) belongs in the other catalogs.
*Keep the Master Available
Also, when cataloging takes place, updating a catalog can make the catalog briefly unavailable to other users. You want to keep the master catalog available. Confine its use to pointers.
Topic 4.6: Unit 4 Summary
The following points were covered in this unit:- There are two types of ICF catalogs. The ICF master catalog contains information about the environment. An ICF user catalog contains information about VSAM data sets as well as non-VSAM data sets.
- A VSAM catalog, also referred to as a VSAM user catalog, contains information about VSAM data sets as well as non-VSAM data sets.
- A CVOL (control volume) contains information about non-VSAM data sets only.
- A catalog entry for a VSAM data set consists of the data set name, the device type and volume name where it resides, the data set's physical characteristics, and the data set's processing options.
- A catalog entry for a non-VSAM data set consists of only the data set name and the device type and volume name where it resides.
- All SMS-managed data sets are automatically cataloged in an ICF catalog when they are defined or allocated.
- With non-SMS-managed data sets, cataloging VSAM data sets is required; cataloging non-VSAM data sets is optional.
- By cataloging, you save yourself the trouble of remembering 1) whether it is a tape or disk data set and 2) the name of the volume on which it resides.
- Each MVS system has one master catalog that is required. The master catalog is an ICF catalog. It points to ICF and VSAM user catalogs and CVOLs.
Unit 5. Accessing Cataloged Data Sets
In this unit, you will take a look at non-VSAM data sets and VSAM data sets in the following two situations:
- When they are cataloged
- When they are accessed
After completing this unit, you should be able to:
- Use SMS-managed data sets in cataloging
- Use non-SMS-managed data sets in cataloging
- Access non-VSAM and VSAM data sets
Topic 5.1: SMS-Managed Data Sets
*SMS-Managed Data SetsAs you learned previously, SMS-managed permanent data sets are automatically cataloged when they are defined or allocated.
You create a permanent data set using a disposition of KEEP or CATLG. For new SMS-managed data sets, KEEP implies CATLG.
*Using SMS-Managed Data Sets
There are a few things you should keep in mind when using SMS-managed data sets:
- Generally, you should not specify a target catalog when creating an SMS-managed data set. (This is often a restricted function.)
- SMS-managed data sets are always cataloged in ICF catalogs. They cannot be cataloged in VSAM catalogs or CVOLs.
- You cannot use JOBCAT or STEPCAT DD statements with SMS-managed data sets. If you use a JOBCAT or STEPCAT DD statement in a job that references an SMS-managed data set, the job will ABEND.
*Cataloging Differences
In summary, here are the main differences between VSAM and non-VSAM regarding cataloging.
VSAM | non-VSAM | |
---|---|---|
catalog entry includes | the data set name the device and volume where it resides its physical characteristics its processing options |
the data set name the device and volume where it resides |
cataloging | done automatically | done automatically |
control cataloging | with Access method Services (IDCAMS) through JCL |
with Access method Services (IDCAMS) through JCL |
cataloged in | ICF user catalog ICF master catalog |
ICF user catalog ICF master catalog |
Topic 5.2: Non-SMS-Managed Data Sets
*Cataloging Non-SMS-Managed Data SetsWhat happens when non-SMS-managed data sets are cataloged?
A data set, for example MY.DATA, could be cataloged in
- The master catalog (for non-VSAM and VSAM data sets)
- An ICF or VSAM user catalog (for non-VSAM and VSAM data sets)
- A CVOL (for non-VSAM data sets only)
NOTE: Throughout this section, the general term data set will be used to represent non-SMS-managed data sets.
*Which Catalog to Use?
When a data set is about to be cataloged, how does the system decide which catalog to use?
1. First, it looks for a STEPCAT or JOBCAT DD statement in the JCL pointing to a user catalog.
2. If there is no STEPCAT or JOBCAT DD statement, then it searches the master catalog. It tries to find a match with one of the following:
- An ICF user catalog whose name or alias is the same as one or more of the qualifiers of the data set name
- A VSAM user catalog whose name or alias is the same as the first qualifier (high-level index)
- A CVOL associated with the high-level index (for non-VSAM data sets only) If a match is found, the data set is cataloged in that catalog.
*Using the Master
When a data set is about to be cataloged, how does the system decide which catalog to use?
3. If there is no match, then the data set is cataloged in the master catalog.
Let's discuss these one at a time.
Topic 5.2.1: STEPCAT and JOBCAT
*Two Available Options1. When a data set is about to be cataloged, the system looks for a STEPCAT or JOBCAT DD statement in the JCL.
A STEPCAT or JOBCAT specifies the data set name of a user catalog which is to be used for cataloging a data set.
If a STEPCAT or JOBCAT DD statement is found, the data set is cataloged in the user catalog that the DD statements point to.
Thus, by coding STEPCAT or JOBCAT, you can control where a data set is cataloged.
//TEST JOB
//S1 EXEC PGM=PROG1
// :
//S2 EXEC PGM=PROG2
:
//S3 EXEC PGM=PROG3
:
*A Coding Example
The JCL above includes a JOBCAT and a STEPCAT DD statement. JOBCAT applies to all the steps of a job except for the job steps that specify STEPCAT. This is similar to the JOBLIB and STEPLIB DD statements.
As you can see in the example above, JOBCAT comes before the first EXEC statement. STEPCAT follows the EXEC statement of the step it is used for.
//TEST JOB
//S1 EXEC PGM=PROG1
// :
//S2 EXEC PGM=PROG2
:
//S3 EXEC PGM=PROG3
:
*Specifying Catalogs
In this example, JOBCAT DD specifies MYVSAM.CATALOG as the user catalog. Steps S1 and S3 will use MYVSAM.CATALOG for cataloging data sets created by or accessing data sets needed by PROG1 and PROG3.
STEPCAT specifies BIGVSAM.TEST as the user catalog. Step S2 will use BIGVSAM.TEST for cataloging or accessing data sets needed by PROG2. If a previously cataloged data set cannot be found in BIGVSAM.TEST, the master catalog is accessed in S2.
*Overriding Other Cataloging
You saw the first situation (of three) regarding how the system decides which catalog to use:
1. A STEPCAT or JOBCAT in the JCL overrides any other cataloging in determining where a data set is cataloged.
Topic 5.2.2: Searching the Master Catalog
*No STEPCAT or JOBCAT DD StatementsMove on to the next situation: if there is no STEPCAT or JOBCAT DD statement.
The system searches the master catalog to try to catalog the data set in one of the following:
- An ICF user catalog whose name or alias is the same as one or more of the qualifiers of the data set name
- A VSAM user catalog whose name or alias is the same as the first qualifier (high-level index)
- A CVOL associated with the high-level index (for non-VSAM data sets only)
*Using an Alias
As you learned before, an alias is essentially an alternative name for a user catalog. For example, you might have a catalog named PNUCAT35 whose alias is PAYROLL.
A lengthy discussion of naming catalogs and aliases is beyond the scope of this course. For our discussion here, it's only important to know that an alias is linked to a specific catalog.
*Searching for the First Qualifier
When VSAM catalogs and CVOLs are searched, the system looks to the first qualifier (high-level index) of the data set name to find a matching catalog.
For example, if the data set TEST.DEPT2.PAYROLL is about to be cataloged in a non-ICF catalog, the system searches the master catalog for TEST.
If there is a VSAM catalog or CVOL associated with the high- level index TEST, the data set is cataloged in that VSAM catalog or CVOL.
*Multilevel Alias Facilities
When ICF catalogs are searched, the system uses what is called the multilevel alias facility. This facility allows ICF catalog selection based on multiple qualifiers of a data set name. The catalog with the most matching qualifiers is used to catalog the data set.
Let's see how this works with our TEST.DEPT2.PAYROLL example.
*Two User Catalogs
Suppose there are two ICF user catalogs, with the aliases TEST and TEST.DEPT2. Here, the data set TEST.DEPT2.PAYROLL is cataloged in the ICF catalog associated with alias TEST.DEPT2, since there are two matching qualifiers.
Remember, the system uses the multilevel alias facility only with ICF (master and user) catalogs. With VSAM catalogs and CVOLs, only the high-level index is considered.
Topic 5.2.3: Cataloging in the Master
*The Final OptionHere's the last situation (of three) to consider when the system is deciding which catalog to use.
1. If there is no STEPCAT or JOBCAT DD statement in the JCL
2. If there is no match in the master catalog ...
3. What happens? Then the data set is cataloged in the master catalog.
However, the master catalog usually contains only entries for system data sets and aliases for other catalogs. Remember, you are trying to keep the master catalog down to a reasonable size. You don't want to catalog a data set there unless it is a special data set.
*VSAM Data Set Exception
You've seen how the system decides where to catalog data sets.
The process is exactly the same for both VSAM and non-VSAM data sets EXCEPT a VSAM data set cannot be cataloged in a CVOL.
Thus, if MY.DATA is a VSAM data set, the system catalogs it either in a user catalog or in the master catalog, but not in a CVOL.
Topic 5.3: Accessing Non-VSAM and VSAM Data Sets
*Getting Access to Your Data SetsYou saw what happens when data sets are cataloged.
A data set could be cataloged in a user catalog (for non-VSAM and VSAM data sets) a CVOL (for non-VSAM data sets only) the master catalog (for non-VSAM and VSAM data sets)
Now, move on to look at what happens when non-VSAM and VSAM data sets are accessed.
*System Search Order
What happens when the system accesses a data set? You'll recognize the steps below. They are the same as for cataloging.
To access a data set, the system searches catalogs in this order:
1. user catalogs pointed to in the current job step (STEPCAT), or user catalogs pointed to in the current job (JOBCAT) if there's no STEPCAT
2. a CVOL or user catalog indicated by the high-level index (for VSAM catalogs and CVOLs) or multiple qualifiers (for ICF catalogs) of the data set name
3. the master catalog
*Using JOBCAT
Say, for example, the system needs to access the data set MY.DATA. It finds a JOBCAT which specifies the DSN of the user catalog to be used for accessing MY.DATA.
The system goes to the user catalog and finds the entry for MY.DATA. The system can then access the data set MY.DATA.
*Searching User Catalogs
Let's continue with the example: the system needs to access the data set MY.DATA. If there is no JOBCAT or STEPCAT, then the system searches for a user catalog or CVOL (for non-VSAM data sets).
The entry for MY.DATA in the user catalog or CVOL includes the information necessary to access the data set MY.DATA.
*Searching Master Catalogs
If there is no JOBCAT or STEPCAT, nor a match to an alias or catalog name in the master catalog, then the system searches the master catalog for the data set.
The system finds MY.DATA cataloged in the master catalog. The system checks the entry for MY and using this information, can then access the data set MY.DATA.
Now consider the following screens when cataloging with JOBCATs and STEPCATs.
*Reviewing the Previous Scenario
The previous questions show that a user catalog may contain entries for unrelated high-level indexes because of the use of JOBCATs and STEPCATs.
To access these data sets you must either use a JOBCAT or STEPCAT to find their catalog entries or not use the catalog at all by explicitly coding the UNIT and VOLUME where the data set resides.
Now consider the following scenario.
//TEST JOB CLASS=A
//JOBCAT DD DSN=USER,CAT,DISP=SHR
//S1 EXEC PGM=LRS007
:
//WEEKLY DD DSN=LRS.WEEKLY,DISP=(,CATLG)...
:
//S2 EXEC PGM=BKP
//STEPCAT DD DSN=LRS.CAT,DISP=SHR
:
//WEEKLY DD DSN=LRS.WEEKLY,DISP=(OLD,CATLG)
:
*Two User Catalogs
LRS.WEEKLY is now cataloged to 2 user catalogs because of the STEPCAT statement and the DISP=(OLD,CATLG) parameters!
Again, you must be careful when explicitly pointing to a catalog.
*Be Careful with Your Tools
JOBCATs and STEPCATs can be very helpful cataloging tools.
However, care must be taken to
- Remember where the data set was cataloged
- Not produce multiple catalog entries for the same data set
*Reviewing the Differences
In summary, here are the main differences between VSAM and non-VSAM regarding cataloging.
VSAM | non-VSAM | |
---|---|---|
catalog entry includes | the data set name the device and volume where it resides its physical characteristics its processing options |
the data set name the device and volume where it resides |
cataloging | required | optional |
control cataloging | only with Access Method Services (IDCAMS) | with Access Method Services (IDCAMS with
user/master catalogs) through JCL with utility programs (IEHPROGM for COVLs) |
cataloged in | user catalog master catalog |
user catalog master catalog CVOL |
Topic 5.4: Unit 5 Summary
The following points were covered in this unit:- There are a few things you should keep in mind when using SMS-managed data sets. Generally, you should not specify a target catalog when creating an SMS-managed data set. SMS-managed data sets are always cataloged in ICF catalogs. You cannot use JOBCAT or STEPCAT DD statements with SMS-managed data sets.
- When a non-SMS-managed data set is about to be cataloged, the system looks for a STEPCAT or JOBCAT DD statement in the JCL.
- If there is no STEPCAT or JOBCAT DD statement, the system searches the master catalog to try to catalog the data set in one of the following: an ICF user catalog whose name or alias is the same as one or more of the qualifiers of the data set name, a VSAM user catalog whose name or alias is the same as the first qualifier (high-level index), or a CVOL associated with the high-level index (for non-VSAM data sets only).
- If there is no STEPCAT or JOBCAT DD statement in the JCL and if there is no match in the master catalog, then the data set is cataloged in the master catalog.
- To access a data set, the system searches catalogs in this order: User catalogs pointed to in the current job step (STEPCAT), or user catalogs pointed to in the current job (JOBCAT) if there's no STEPCAT, a CVOL or user catalog indicated by the high-level index (for VSAM catalogs and CVOLs) or multiple qualifiers (for ICF catalogs) of the data set name, the master catalog.
- A user catalog may contain entries for unrelated high-level indexes because of the use of JOBCATs and STEPCATs. To access these data sets you must either use a JOBCAT or STEPCAT to find their catalog entries or not use the catalog at all by explicitly coding the UNIT and VOLUME where the data set resides.
Unit 6. Using Temporary and Virtual Data Sets
This unit focuses on the general rules and reasons for using temporary data sets.After completing this unit, you should be able to:
- Create temporary data sets
- Describe the reasons for using temporary data sets
- Identify rules and reasons for using V/O data sets
Topic 6.1: Temporary Data Sets
*Defining Temporary Data SetsFirst, let's review the definition of a temporary data set. Temporary data sets are data sets created and deleted within the same job.
They are created at the beginning of a job step within a job and are deleted by the system at the end of the job step, a subsequent job step or the job.
Temporary data sets can be accessed only within the job that creates them. A temporary data set can be created on disk, tape or cartridge.
Note: This definition of temporary data sets is JCL specific. It does not include special permanent data sets established at installations for the temporary storage of data.
*Temporary Data Set Types
Most types of data sets can be created as temporary data sets, including:
- Sequential
- Direct
- Partitioned (PDS or PDSE)
- VSAM (under SMS only)
Note: If you're in an SMS installation, SMS can be used to manage temporary data sets. The general rules for using STORCLAS or installation ACS exit routines also apply to temporary data sets.
Topic 6.1.1: Naming Temporary Data Sets
*Naming Data SetsThe name you assign to a data set determines whether that data set is temporary or nontemporary.
You also have the option of not assigning a name.
If you do assign a name, it must be no more than eight alphanumeric characters (the length does not include the ampersands) begin with an alphabetic (A to Z) or national (@,$,#) and it should be preceded by two ampersands (&&)
&&TEMP and &&MYDATA are examples of temporary data set names.
*Using an Ampersand
An ampersand is also used for symbolic parameters, but only a single ampersand is used. For example, &TEMP or &MYDATA are symbolic parameters. They are preceded by a single ampersand.
Do not confuse these symbolic parameters with temporary data set names. A temporary data set should be preceded by the double ampersand.
Topic 6.1.2: Creating Temporary Data Sets
*Using DD StatementsHere are two DD statements that create temporary data sets.
1:
2: //SORTWK2 DD DSN=&&TEMP,SPACE=(TRK,5),UNIT=SYSDA
In the first example, no name is assigned to the data set. In the second example, the name &&TEMP is assigned.
You'll see these examples again later in this objective when they are discussed in more detail.
Topic 6.1.3: System-Generated Names
*Let the System Do the WorkThe name you assign to a temporary data set is stripped of its ampersands. It becomes the last segment of a five segment name constructed by the system.
The system-generated name consists of four segments separated by periods. The temporary data set name is concatenated by a period to the end of the system-generated name. If you do not specify a name at all, then a fifth segment is generated for you.
The next few screens show you some examples.
*A System-Generated Example
In this example, the name &&LOADSET was assigned to the temporary data set. The job name is TEST.
The system-generated name consists of
- SYS followed by the Julian date
- T followed by the time of day
- A generated identifier
- The job name
- The DSNAME assigned or a generated identifier
*Having No DSN
In the example on the right, no data set name was assigned to the temporary data set, that is, there was no DSN on the DD statement. The job name is TEST.
Topic 6.2: Reasons for Temporary Data Sets
*Why Use a Temporary Data SetNow that you know how to name a temporary data set, you might be asking yourself: Why would you use a temporary data set?
After all, you can achieve the same result by using a permanent data set which you delete when you don't need it anymore. You need only specify DISP=(OLD,DELETE) on the DD statement the last time the data set is accessed.
*Purpose of a Temporary Data Set
Now that you know how to name a temporary data set, you might be asking yourself: Why would you use a temporary data set?
Here's the answer: Use a temporary data set to take advantage of the automatically generated data set name.
Because that name is constructed using the job name and the date and time, it is unique. This uniqueness ensures that no two data sets with the same name can be created on the same disk volume at the same time.
*Avoiding Time-Consuming Tasks
There's really no way around using temporary data sets.
You could try to assign unique names to all data sets created for the duration of one or more job steps of every possible job run on your mainframe.
This, however, would be a very tedious, time-consuming task and impossible!
*Don't Create Extra Work
There's really no way around using temporary data sets.
You could try to assign unique names to all data sets created for the duration of one or more job steps of every possible job run on your mainframe.
For example, what if several users submit a JCL procedure, such as compiling a program or running a utility, at the same time?
And suppose the jobs running on the system use the same names for the work data sets they create (WORK01, WORK02, WORK03 rather than &&WORK01, &&WORK02, &&WORK03). These jobs will start ABENDing due to duplicate data sets being created on the same volume. You can't have two WORK01s on the volume, but you can have two &&WORK01s.
*Example 1
Let's take a look at some examples of creating temporary data sets. Here are two DD statements that create temporary data sets.
Example 1:
Example 2: //SORTWK2 DD DSN=&&TEMP,SPACE=(TRK,5),UNIT=SYSDA
In the first example, a data set is created on one of the disk volumes of the SYSDA group. It is allocated one cylinder. Its name will be completely system-generated.
*Example 2
Here are two DD statements that create temporary data sets.
Example 1: //SORTWK1 DD UNIT=SYSDA,SPACE=(CYL,1)
Example 2:
The second example creates a similar data set. It is allocated five tracks. Its name will be partially system-generated.
- The first four segments will be a unique string generated by the system.
- The last segment will be a period followed by TEMP, the DSN you assigned.
*Deleting Temporary Data Sets
Here are two DD statements that create temporary data sets.
Example 1: //SORTWK1 DD UNIT=SYSDA,SPACE=(CYL,1)
Example 2: //SORTWK2 DD DSN=&&TEMP,SPACE=(TRK,5),UNIT=SYSDA
The data sets are automatically deleted at the end of the job step. Omitting the DISP parameter causes the default DISP=(NEW,DELETE) to be used.
*Using PASS
At this point, you might ask: How can I keep a temporary data set from being deleted at the end of the job step? Suppose you want to use it in a subsequent job step.
Think back to your basic JCL. The way to make a temporary data set available to a subsequent job step is by coding
DISP=(NEW,PASS)
If you specify a disposition of KEEP or CATLG in the DISP parameter, the system changes the disposition to PASS and the data set is deleted at job termination.
You'll see more about this in the next unit devoted to passing data sets.
Topic 6.3: Using V/O Data Sets
*Using Virtual Input/OutputIBM offers a function called virtual input/output (V/O) for use with temporary data sets.
A V/O data set acts like a temporary data set on a direct access storage device. The difference is that a V/O data set resides in external paging storage.
*Being Efficient
Using V/O data sets can make your temporary data set operations more efficient, since access to main storage is much faster than to a device.
V/O is available for temporary data sets only. V/O can be used with both SMS and non-SMS managed data sets.
You cannot use V/O for the following types of data sets:
- Permanent
- VSAM
- PDSEs
- ISAM
*V/O Coding Conventions
The coding conventions for creating SMS-managed V/O data sets are similar to those for regular temporary data sets:
- The DSNAME must be a temporary data set
- The DISP parameter is the same as regular temporary data sets
*V/O Data Set Example
For example:
//WK1 DD DSNAME=&&WORK,STORCLAS=VIRT
will create a V/O data set if storage class VIRT supports V/O data sets.
If the storage class does not support V/O, a regular temporary data set will be created.
*Using VOLUME, SPACE and ABEND
Other parameters in the DD statement are optional, and many should be used with caution.
For example:
The VOLUME parameter, if used, cannot include specific volume serial numbers.
The SPACE parameter can be used to request space up to the size of the simulated volume. In general, you should code the SPACE parameter as if you were working with a non-V/O temporary data set.
Use of the SPACE parameter can get tricky, however. If your space request exceeds the V/O unit's capacity, your job will ABEND. To avoid this problem, you should check your installation guidelines regarding any V/O space limitations.
*Violating the Rules
If your DD statement contains parameters that violate V/O or temporary data set rules, the system will generally ignore your V/O request.
For example:
//WK1 DD DSN=MINE,STORCLAS=SCVX
A permanent data set will be created, since the DSN parameter doesn't identify a temporary data set.
*Non-SMS-Managed Conventions
The coding conventions for creating non-SMS-managed V/O data sets are similar to those for regular temporary data sets:
- The DSNAME must be a temporary data set
- The DISP parameter is the same as regular temporary data sets
*Assigning the UNIT Device
The main difference is that the assigned UNIT device must be defined as a V/O unit. You should check your installation guidelines to find out which units are defined as V/O units.
For example //WK1 DD DSNAME=&&WORK,UNIT=VIRT will create a V/O data set if unit VIRT supports V/O data sets. The system ignores the unit count, if coded.
If the device does not support V/O, a regular temporary data set will be created.
*Use Parameters with Caution
Other parameters in the DD statement are optional, and many should be used with caution.
For example:
- The VOLUME parameter, if used, cannot include specific volume serial numbers.
- The SPACE parameter can be used to request space up to the size of the simulated volume. In general, you should code the SPACE parameter as if you were working with a non-V/O temporary data set.
*Required Parameters
When using a temporary PDS, the SPACE parameter is required.
Use of the SPACE parameter can get tricky, however. If your space request exceeds the V/O unit's capacity, your job will ABEND. To avoid this problem, you should check your installation guidelines regarding any V/O space limitations.
*Ignoring Your V/O Request
If your DD statement contains parameters that violate V/O or temporary data set rules, the system will generally ignore your V/O request.
For example: //WK1 DD DSN=MINE,UNIT=VIRT
A permanent data set will be created, since the DSN parameter doesn't identify a temporary data set.
*Proceed with Caution
Be particularly careful when referring to an earlier statement in the job with VOL=REF or UNIT=AFF. The referenced data set must be a V/O data set, and the new data set must be defined as a temporary data set.
For example:
//WK1 DD UNIT=VIRT
//WK2 DD DSN=&&TEMP,VOL=REF=*.WK1
If unit VIRT is a V/O unit, the temporary data set &&TEMP will be created as a V/O data set.
*Creating a Permanent Data Set
However, in this example:
//WK3 DD UNIT=VIRT
//WK4 DD DSN=TEMP,VOL=REF=*.WK3
Data set TEMP will be created as a permanent data set, assigned to direct access storage. (DSNAME is not a temporary data set.)
Topic 6.4: Unit 6 Summary
The following points were covered in this unit:- Temporary data sets are data sets created and deleted within the same job.
- You have the option of not assigning a name to a temporary data set or assigning a name up to eight alphanumeric characters. The name must begin with an alphabetic or national and should be preceded by two ampersands (&&).
- The name you assign to a temporary data set is stripped of its ampersands.
It becomes the last segment of a five segment name constructed by the
system.
The system-generated name consists of four segments separated by periods. The temporary data set name is concatenated by a period to the end of the system-generated name. If you do not specify a name at all, then a fifth segment is generated for you. - Use a temporary data set to take advantage of the automatically generated data set name. Because that name is constructed using the job name and the date and time, it is unique.
- The way to make a temporary data set available to a subsequent job step is by coding DISP=(NEW,PASS).
- A V/O data set acts like a temporary data set on a direct access storage device. The difference is that a V/O data set resides in external paging storage.
- V/O is available for temporary data sets only. V/O can be used with both SMS and non-SMS managed data sets.
- The coding conventions for creating SMS-managed V/O data sets are similar
to those for regular temporary data sets: the DSNAME must be a
temporary data set and the DISP parameter is the same as regular
temporary data sets.
The main difference is that the assigned storage class must be set up to support V/O data sets. - The coding conventions for creating non-SMS-managed V/O data sets are
similar to those for regular temporary data sets: the DSNAME must be
a temporary data set and the DISP parameter is the same as regular
temporary data sets.
The main difference is that the assigned UNIT device must be defined as a V/O unit.
Unit 7. Passing Data Sets
This unit examines passing permanent and temporary data sets and passing tape data sets.
After completing this unit, you should be able to:
- Pass permanent data sets
- Pass temporary data sets
- Pass tape data sets
Topic 7.1: Passing Permanent Data Sets
*Using the PASS ParameterDISP=(<status><,normal disp><,abnormal disp>)
Passing a non-VSAM data set from a job step to a subsequent job step is accomplished with the
PASS subparameter of the DISP parameter.
PASS can only be coded for the normal disposition of a data set.
*Replacing PASS with KEEP
Only non-VSAM data sets can be passed.
Note: If you're working with SMS-managed data sets, using the PASS subparameter will not result in a JCL error. SMS will simply replace PASS with KEEP.
*Saving Time
DISP=(...,PASS)
Using PASS is a time saver for two reasons:
1. The operating system retains the data set volume information and makes it available to subsequent job steps. The step that receives the data set can omit the volume, unit and tape data set sequence parameters.
2. A mountable volume (such as a tape) containing the data set is mounted and retained until the data set is no longer needed.
*Easing Your Work Load
Data sets can be passed only within the same job.
A passed data set does not have to be referenced in every subsequent job step. You need to reference a passed data set only in the steps that actually use the data set.
Passing is the easiest way to:
- create a disk or tape data set
- not catalog it not specify a storage device
- and then refer to it in subsequent steps.
*Creating a Jobstream
In this scenario, let's say you're creating a jobstream. In the first step you want to back up a data set before updating it.
If the job ends successfully, you want to delete the backup.
If not, you want to restore the backup on top of the updated data set.
Typically, you allow the system to select the volume to put the backup on. The system selects a disk volume or a scratch tape depending on the unit or storage class specified.
*Accessing Volume Information
To continue the scenario, the system selects the volume to put the backup on. Now, you have several ways to access the volume information. You can
- Catalog the data set
- Use backward reference in the volume parameter
- Pass the data set
*Permanent Data Sets
Passing can be used with permanent non-VSAM data sets. If you are using a non-cataloged data set in a job, you must include any required storage parameters (e.g., UNIT/VOL or STORCLAS) in the JCL.
If the data set is used in more than one job step, code the storage parameters you normally would in the first step that uses the data set. Code PASS as the normal disposition.
Any subsequent job step that uses the data set can then omit the storage parameters.
*Specifying Other DISPs
Once a step specifies a DISP other than PASS, the system no longer retains storage information. It is up to you to code the needed parameters the next time you want to access the non-cataloged data set.
//TEST1 JOB
//STPA EXEC PGM=PGRMA
//INFILE DD
//
//STPB EXEC PGM=PRGMB
//INDATA DD
//STPC EXEC PGM=PRGMC
//INPUTA DD
//STPD EXEC PGM=PRGMD
//INPUTB DD DSN=TEST.DATA,DISP=(OLD,KEEP),
// (ANY REQUIRED STORAGE PARAMETERS)
*A PASS Example
In this example, step STPA uses the non-cataloged disk data set TEST.DATA and has to supply any required storage parameters.
By specifying PASS on INFILE DD, steps STPB and STPC can use TEST.DATA without supplying all the parameters.
//TEST1 JOB
//STPA EXEC PGM=PGRMA
//INFILE DD
//
//STPB EXEC PGM=PRGMB
//INDATA DD DSN=TEST.DATA,DISP=(OLD,PASS)
//STPC EXEC PGM=PRGMC
//INPUTA DD
//STPD EXEC PGM=PRGMD
//INPUTB DD
//
*Using KEEP
KEEP terminates the effect of PASS. Therefore, step STPD must supply all required parameters on INPUTB DD in order to access TEST.DATA.
*Coding the Final Disposition
As you saw in these examples, you must code PASS each time a data set is referenced in a subsequent job step to continue passing the data set.
You code the final disposition in the last DD statement that uses the data set. If you omit a final disposition, the default disposition will be used.
Topic 7.2: Passing Temporary Data Sets
*Temporary Data SetsTemporary data sets cannot be kept or cataloged. Passing is the only way to make a temporary data set available to a subsequent job step. Otherwise, the data set is deleted at the end of the step.
The subparameter PASS prolongs the life of a temporary data set. A subsequent step that uses the temporary data set may in turn specify PASS. In this way, it remains available to the job steps that follow.
Any temporary data sets not deleted explicitly are automatically deleted at the end of the job.
//TEST3 JOB
//ST1 EXEC PGM=PRG1
//WK1 DD
//ST2 EXEC PGM=PRG2
:
//ST3 EXEC PGM=PRG3
//WK3 DD
//ST4 EXEC PGM=PRG4
:
end of jobstream
*Specifying DISP=(OLD,DELETE)
Temporary data set &&T1 remains undeleted throughout the entire job. The system deletes it automatically at the end of the job.
For the most efficient processing, specify DISP=(OLD,DELETE) in the last job step which uses the temporary data set. This releases the disk space and makes it available for the creation of other temporary data sets.
*Using KEEP or CATLG
Another aspect of passing temporary data sets was touched upon in the last unit.
What happens if you specify a disposition of KEEP or CATLG instead of PASS for the DISP parameter?
The system changes the disposition to PASS and the data set is automatically passed to subsequent steps.
*Using Referback
One last concept to become acquainted with concerning passing temporary data sets is using backward referencing or referback.
Remember that you are not required to assign a name to a temporary data set. If you don't name a temporary data set and you pass it, you can only refer to the passed temporary data set by using referback.
In fact, many programmers prefer to use referback any time they're passing temporary data sets. To refer back to a DD statement in a previous step, code
DSN=*.stepname.ddname
//TEST5 JOB
//S1 EXEC PGM=PR1
//WRKA DD
//S2 EXEC PGM=PR2
//WRKB DD
*A Referback Example
In this example, no data set name is assigned to the temporary data set created in the first step. The data set is passed to subsequent steps.
Since no name was assigned, the next step refers to the passed data set by referback (DSN=*.S1.WRKA). You can use referback even if you assigned a name to the data set.
Topic 7.3: Passing Tape Data Sets
*Special ConsiderationsLet's see what special considerations there are for tape data sets. You pass a tape data set the same way you pass a disk data set. However, the system takes an additional action when passing a tape data set.
The tape volume remains mounted on the tape drive.
*Automatic Dismounts
Normally at the end of a job step, the system issues a dismount message to the operator for all tapes used in the step.
When you pass a tape data set, the tape remains mounted for subsequent use. Thus operators avoid unnecessarily mounting and dismounting tapes and moving them from device to device for the job.
At the end of the job, any tapes that remain mounted are automatically dismounted by the system. The following example takes advantage of the tape remaining on the drive in order to process more than one file on the same tape.
//PAY JOB
//STEP1 EXEC PGM=PROGM1
//INDATA1 DD
//
//STEP2 EXEC PGM=PROGM2
//INDATA2 DD
//
*Passing a Tape Data Set
Tape volume TAPE01 contains two data sets: PAYROLL1.FILE and PAYROLL2.FILE. This job uses both data sets in separate job steps.
The first step processes PAYROLL2.FILE and passes it to the second step. The second step, however, processes PAYROLL1.FILE and not PAYROLL2.FILE.
//PAY JOB
//STEP1 EXEC PGM=PROGM1
//INDATA1 DD
//
//STEP2 EXEC PGM=PROGM2
//INDATA2 DD
//
*Keeping the Tape Mounted
Disposition PASS is used to keep the tape mounted during processing.
If PASS is not used, the tape is dismounted at the end of the first step and remounted -- possibly to a different tape drive -- for use in the second step.
//PAY JOB
//STEP1 EXEC PGM=PROGM1
//INDATA1 DD DSN=PAYROLL2.FILE,UNIT=TAPE,DISP=OLD,
//
//STEP2 EXEC PGM=PROGM2
//INDATA2 DD DSN=PAYROLL1.FILE,DISP=OLD,UNIT=TAPE,
// VOL=SER=TAPE01
*Using RETAIN
Another way to keep a tape mounted is by using the RETAIN subparameter of the VOL parameter. Above is our sample JCL using RETAIN.
The format of the VOL parameter used with RETAIN is:
VOL=(,RETAIN,SER=serial-number)
The RETAIN subparameter is discussed in more detail in the unit on tape considerations.
Topic 7.4: Unit 7 Summary
The following points were covered in this unit:- Passing a non-VSAM data set from a job step to a subsequent job step is accomplished with the PASS subparameter of the DISP parameter.
- Passing can be used with permanent non-VSAM data sets. If you are using a non-cataloged data set in a job, you must include any required storage parameters (e.g., UNIT/VOL or STORCLAS) in the JCL.
- You must code PASS each time a data set is referenced in a subsequent job step to continue passing the data set.
- You code the final disposition in the last DD statement that uses the data set. If you omit a final disposition, the default disposition will be used.
- Passing is the only way to make a temporary data set available to a subsequent job step.
- Any temporary data sets not deleted explicitly are automatically deleted at the end of the job.
- If you specify a disposition of KEEP or CATLG for a temporary data set, the system changes the disposition to PASS and the data set is automatically passed to subsequent steps.
- You are not required to assign a name to a temporary data set. If you don't name a temporary data set and you pass it, you can refer to the passed temporary data set by using referback.
- To refer back to a DD statement in a previous step, code: DSN=*.stepname.ddname
- When you pass a tape data set, the tape remains mounted for subsequent use.
- At the end of the job, any tapes that remain mounted are automatically dismounted by the system.
- Disposition PASS is used to keep a tape mounted during processing.
- Another way to keep a tape mounted is by using the RETAIN
subparameter of the VOL
parameter:
VOL=(,RETAIN,SER=serial-number)
No comments:
Post a Comment