IDCAMS
IDCAMS
Keith Winnard
Stephen M. Branch
Redpaper
International Technical Support Organization
October 2016
REDP-5389-00
Note: Before using this information and the product it supports, read the information in “Notices” on page v.
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .x
Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .x
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
iv Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Notices
This information was developed for products and services offered in the US. This material might be available
from IBM in other languages. However, you may be required to own a copy of the product or product version in
that language in order to access it.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area. Any
reference to an IBM product, program, or service is not intended to state or imply that only that IBM product,
program, or service may be used. Any functionally equivalent product, program, or service that does not
infringe any IBM intellectual property right may be used instead. However, it is the user’s responsibility to
evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not grant you any license to these patents. You can send license inquiries, in
writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, MD-NC119, Armonk, NY 10504-1785, US
This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may make
improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time
without notice.
Any references in this information to non-IBM websites are provided for convenience only and do not in any
manner serve as an endorsement of those websites. The materials at those websites are not part of the
materials for this IBM product and use of those websites is at your own risk.
IBM may use or distribute any of the information you provide in any way it believes appropriate without
incurring any obligation to you.
The performance data and client examples cited are presented for illustrative purposes only. Actual
performance results may vary depending on specific configurations and operating conditions.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm the
accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the
capabilities of non-IBM products should be addressed to the suppliers of those products.
Statements regarding IBM’s future direction or intent are subject to change or withdrawal without notice, and
represent goals and objectives only.
This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to actual people or business enterprises is entirely
coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the sample
programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore,
cannot guarantee or imply reliability, serviceability, or function of these programs. The sample programs are
provided “AS IS”, without warranty of any kind. IBM shall not be liable for any damages arising out of your use
of the sample programs.
The following terms are trademarks or registered trademarks of International Business Machines Corporation,
and might also be trademarks or registered trademarks in other countries.
AIX® RACF® z Systems™
Destination Z™ Redbooks® z/OS®
IBM® Redpaper™
IBM z Systems™ Redbooks (logo) ®
Other company, product, or service names may be trademarks or service marks of others.
vi Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
IBM REDBOOKS PROMOTIONS
Download
Android
iOS
Now
This IBM® Redpaper™ publication is different from others you have read because it was not
written in the conventional way with a residency and a handful of authors. It was written by
people who want to make a difference.
The IBM Redbooks® organization and SHARE teamed up to give all of the attendees at the
SHARE 2016 conference that was held in Atlanta, US, July 31 - August 5 the opportunity to
contribute their thoughts and ideas about the latest IDCAMS capabilities. Many discussions
arose about the subject and related techniques.
On behalf of everyone who took part in this project, we hope you enjoy the collective thoughts
of many people who were so willing to help to increase your expertise.
Authors
This paper was produced as a collaboration of specialists from around the world at the
SHARE Conference that was held in Atlanta, US, in 2016. The following authors captured the
information:
Keith Winnard is the IBM z/OS® Project Leader at the International Technical Support
Organization, Poughkeepsie Center. He writes extensively and is keen to engage with
customers to understand what they want from IBM Redbooks publications. Before joining the
ITSO in 2014, Keith worked for clients and Business Partners in the UK and Europe in various
technical and account management roles. He is experienced with blending and integrating
new technologies into the traditional landscape of mainframes.
Acknowledgements
Thanks to the following people for entering the spirit of the collaboration and making this
initiative a success:
Donna J Hudi (Executive Director, SHARE)
Ed Jaffe (SHARE)
Martha M McConaghy (SHARE)
Skip Robinson (SHARE)
James Vincent (SHARE)
Harry Williams (SHARE)
Russell Witt (SHARE)
Jim Erdahl (Systems Architect, US bank)
Bruce Koss (z/OS Systems Engineer, Wells Fargo)
Marty Hasegawa (Senior Software Engineer, Rocket Software)
Ray Mullins (Senior Software Developer, Phoenix Software International)
Gary Puchkoff (Senior Technical Staff Member, IBM)
Barbara White-McDonald (DFSMS Product Strategist,IBM)
Bob Haimowitz (DSG,IBM)
Deana Coble (DSG,IBM)
Martin Keen (DSG,IBM)
Jim Pistilli (DSG,IBM)
Chris Rayns (DSG,IBM)
Tom Wasik (JES2 Development, IBM)
Bill White (DSG,IBM)
Debbie Willmschen (DSG,IBM)
Tara Woodman (DSG, IBM)
Many thanks to all those people who stopped by the Redbooks publications booth and
attended the “Everything You Wanted To Know About IDCAMS But Were Afraid To Ask”
session. In addition, to all of those people who joined in the discussions at the Techtalk
sessions at the SHARE booth.
x Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Find out more about the residency program, browse the residency index, and apply online at:
ibm.com/redbooks/residencies.html
Comments welcome
Your comments are important to us!
We want our papers to be as helpful as possible. Send us your comments about this paper or
other IBM Redbooks publications in one of the following ways:
Use the online Contact us review Redbooks form found at:
ibm.com/redbooks
Send your comments in an email to:
redbooks@us.ibm.com
Mail your comments to:
IBM Corporation, International Technical Support Organization
Dept. HYTD Mail Station P099
2455 South Road
Poughkeepsie, NY 12601-5400
Preface xi
xii Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
1
SHARE prides itself on sharing user-led proven practices across the IT ecosystem, which this
opportunity demonstrated. The skills and expertise that the IBM Redbooks publications team
brought to SHARE allowed us all to quickly produce a technical first draft publication by the
end of the event. Historically, a project such as this one often takes weeks (if not months) of
dedicated commitment of all involved to complete.
Our members were demonstrated the depth of their technical leadership quickly and easily
while they collaborated with their peers within the industry. SHARE is proud to be part of the
team that provided this opportunity to our membership.
This IBM Redpaper publication is the result of a live event that was held at SHARE Atlanta,
US, in August 2016. If you participated in the making of this publication in any way, we thank
you for helping to further the knowledge of others by sharing your thoughts, questions, and
ideas. Great things can happen when minds come together with a common goal.
If you are interested in running a similar initiative, this chapter is intended to provide you with
useful information about how we produced this publication.
We encourage you to improve on what we produced by sharing your ideas with SHARE and
seeing how innovation through collaboration can bring benefits to this long-established
community of devotees. For more information about getting involved, see this website:
http://www.share.org/
Finally, from all of us who took part in this initiative, we wish you the best of luck.
Keith Winnard (z/OS Project Leader at the International Technical Support Organization): “It’s
a question of aligning the target readership with the subject content to provide relevance.”
Gary Puchkoff (z/OS New Technology, IBM Systems): “Agreed, but how do you capture that
alignment on a specific topic in a reasonable time period to increase the value?”
Keith “Hmmm, if we could have captured people’s thoughts at SHARE, that would have
helped. Then, we could follow up with a publication fairly soon after.”
Keith: “Gary posed an interesting question yesterday about writing a book live at SHARE.”
Barbara (DFSMS Product Strategist, IBM z™ Systems Software, IBM Systems): “That’s very
interesting; I like that.”
And that is how this publication came to be. Well, not quite, many helping hands were
available to put this Redpaper publication in front of you.
2 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
1.2.2 SHARE benefits
Although SHARE is made up of its members, it is also an entity. By exploring innovations,
SHARE might realize the following benefits:
Provide SHARE with the opportunities to channels through which SHARE can distribute
their materials.
Provide the opportunity to increase the reach of SHARE into the target readership for
SHARE and non-SHARE members.
Increase the scope for vendors the opportunity to partake in a new engagement model.
1.3.1 Preparation
This initiative is new and an established topic was chosen. Several candidate topics were
evaluated. Eventually, the topic that was chosen was IDCAMS. The initial IDCAMS
presentation was written, refined, and titled, “Everything You Always Wanted to Know about
IDCAMS But Were Afraid to Ask”. The presentation was scheduled for the SHARE event on
Wednesday morning at 8:30 AM.
1.3.2 Marketing
A promotional video was created by IBM Redbooks publications to be used at the event. The
video was passed to SHARE Executive Director Donna J Hudi to use to promote the initiative.
The video is available on YouTube:
https://www.youtube.com/watch?v=nfSjEGdYi5c&feature=youtu.be
The video was also made available in MP4 format to increase the opportunity to promote the
paper.
The IBM Redbooks publications and SHARE social media teams also produced a social
marketing campaign to promote the event.
The social coverage consisted of two parts leading up the day of the session and social
coverage as the session is happening from the IBM Redbooks publications social channels.
4 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Leading up to the event, IBM Redbooks publications highlighted and emphasized
participating in the live IBM Redpaper publication across their mainstream social channels of
Twitter, Facebook, LinkedIn (Business and Group), and Google+. These social channels
added up to over 82,000 fans and followers across all platforms. The #ShareRedpaper
hashtag was created to promote the event.
The content that was shared on these channels was social channels and text in long and
short form that announced the session and invited readers to participate in the session. We
also coordinated with other IBM groups to mention on their social channels. Groups, such as
IBM z Systems™, LinuxOne, Destination Z™, MSP Techmedia, and other IBM social pages
were also mentioning the live Redpaper session to increase awareness and visibility.
A Tech Talk session was also arranged at the SHARE booth in the Expo center. While the
Tech Talk and main session were happening, IBM Redbooks Project Leader Martin Keen was
covering the event on the IBM Redbooks Twitter page, which included tweets that described
the class and photos.
SHARE and IBM Redbooks publications also designed a special cover for the paper to
include the SHARE logo to emphasize the collaboration.
Many contributions and discussions were captured during the event and added to the IBM
Redpaper publication. A few of the topics that were covered required further discussion.
These topics were followed up after the event.
The main session on the Wednesday (shown in Figure 1-4) was well-attended, with great
questions, suggestions, and discussions interspersed throughout.
The positive response from attendees led to several communications being continued beyond
the event to refine some of the points that were raised and to add other points.
The IBM Redpaper publication was published in draft on Friday, August 5 around 5 PM.
6 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
1.3.4 Collateral and review
This initiative was a pilot. The experience and collateral that was taken from it will be reviewed
with SHARE representatives to provide valuable input for future initiatives.
The pilot was successful, and we encourage others to work with SHARE to run similar
initiatives and give members the opportunity to share their experiences and expertise in the
chosen topic for the benefit of others in the spirit of sharing.
The figures that are listed in Table 1-1 show the promotion and interest for the IBM Redpaper
publication from the IBM Redbooks’ coverage activities.
To complete the collaborative efforts, the figures that are listed in Table 1-2 show the
promotion and interest for the IBM Redpaper publication from the SHARE coverage activities.
Clicks 52
Twitter retweets 12
Social engagements 63
Social shares 4
Attendees that were reached through four onsite daily emails throughout the 1,000+
week of SHARE Atlanta
Ultimately, we reached several thousand individuals by using email and numerous social
engagements while sharing and interacting with the IBM Redbooks publications posts from
the SHARE channels.
The collaboration was a great success and both parties complemented each other to reach
out to the attendees and the rest of the SHARE and IBM Redbooks publications communities.
3 Options
10 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
JCL option
You can run IDCAMS as a batch job. A sample basic JCL is shown in Figure 2-2.
The SYSPRINT DD statement contains the output from the commands that were used.
The SYSIN DD statement is the file that contains your commands. You can write them
in-stream (denoted by the “ * ”) or you can include the commands in a separate data set and
use the SYSIN DD statement to identify the data set, as shown in Example 2-1.
TSO option
The Interactive System Productivity Feature (ISPF) Command Shell is the best option if you
want to use the IDCAMS command interactively, as shown in Figure 2-3.
As shown in Figure 2-3, the IDCAMS LISTCAT command is entered at the top of the window
and the output appears at the bottom of the window.
Note: The PREFIX option on the TSO command was introduced in z/OS Version 2 Release
2. The PREFIX/NOPREFIX was introduced so that the user can add the TSO user ID.
ALTER Alters attributes of catalogs, data sets, tape library entries, and
tape volume entries that were defined.
DCOLLECT Collects data set, volume usage, and migration utility information.
DELETE Deletes catalogs, VSAM data sets, and non-VSAM data sets.
IMPORT Connects user catalogs and imports VSAM data sets and
catalogs.
PRINT Prints VSAM data sets, non-VSAM data sets, and catalogs.
12 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Command Description
Commands are separated from their parameters by one or more separators (blanks,
commas, or comments). For some parameters, parentheses are used as separators.
After each function command completes, a condition code is generated to notify you of the
result of your command. The condition codes are listed in Table 2-2.
16 A severe error occurred that erased the remainder of the command stream.
Note: Modal commands are not available when the TSO option is used.
LASTCC refers to the condition code that results from the preceding function command that is
compared.
MAXCC specifies the maximum condition code value that is established by any previous
function command or by using a SET command that is compared.
Equal to = or EQ
Not equal to ¬= or NE
Greater than > or GT
Less than < or LT
Greater than or equal to >= or GE
Less than or equal to <= or LE
14 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
SET command
The SET command changes or resets a defined condition code. This change is made because
a common technique (which is described in Chapter 3, “Setting up and maintaining data sets
scenario” on page 17) is to include a DELETE command before a DEFINE command for the
same data set.
If you want to DEFINE a VSAM data set, you might want to check whether it exists before you
define it. If you include a DELETE command for the data set first, the use of the DELETE
command removes the data set if it exists (assuming it is not being used by someone else)
and then, your DEFINE command likely is okay.
However, if the use of the DELETE command did not find the data set, it issues a non-zero
return code. You can then reset the return code and continue, as shown in Example 2-3.
2.2.3 Comments
Comments are important because they indicate what you are trying to achieve. Check your
local policies to determine whether there are guidelines for including comments.
Comments are strings of characters that are surrounded by /* and */. Comments can contain
any characters except */. Commands can begin at, or to the right of, the left margin. For
batch processing jobs, the default margins are 2 and 72.
Comments must be kept current, accurate, and aligned with the functional and modal
commands so that they are useful to other users. A sample comment and command flow is
shown in Example 2-4.
If the return fails, the problem might be an application program issue; therefore, the
comments can indicate that a call out to the application support group must be made for more
support.
16 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
3
This chapter provides a sample provisioning scenario and guides you through how to
complete all of the tasks in the scenario. Your scenario is based on setting up and maintaining
data sets for a small application during its development cycle.
Although the initial base scenario was designed by the authors, the scenario was expanded
by the SHARE attendees of SHARE 2016 event in Atlanta.
Application
Development LPAR
Existing Project APP1
CATAPP1 data sets
The APP3 project is self-contained. It includes its own recognizable user catalog and unique
high-level qualifier for the dat sets. These attributes make it easily portable.
18 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
3.2 Setting up the APP3 project
The scenario is divided into six steps. An overview of the tasks you must complete to support
the project is shown in Figure 3-2.
Master
DCAT01
catalog
User
CATAPP3
catalog
Figure 3-3 Master and user catalogs
By using the DEFINE USERCATALOG command, the user catalog CATAPP3 is created. A user
catalog connector record in the master catalog also is created.
DCAT01
CATAPP3
20 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
IDCAMS commands to define CATAPP3 and APP3 alias
To help you learn and combine the use of comments, functional, and modal commands, both
tasks are combined into a single stream, as shown in Example 3-1.
Note: Some of the comments were changed throughout this chapter to help emphasize the
related points.
You can see the results of your command in the SYSPRINT SYSOUT. The output from the
user catalog and alias definition is shown in Example 3-2.
DEFINE -
USERCATALOG -
(NAME (CATAPP3) -
STORCLAS(S1P03S01) -
CYLINDERS(1 1))
IDC0510I CATALOG ALLOCATION STATUS FOR VOLUME BH5OE1 IS 0
IDC0512I NAME GENERATED-(I) CATAPP3.CATINDEX
IDC0181I STORAGECLASS USED IS S1P03S01
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IF LASTCC = 0 -
THEN DO
END
In the remainder of this chapter, only the selected output is shown to avoid repetition.
The data sets that must be allocated are listed in Table 3-1.
APP3.PROGRAMS.LOADLIB APP3.PARTNAME.AIX
APP3.PROJECT.JCL APP3.PARTNAME.PATH
APP3.PARTSUPP.AIX
APP3.PARTSUPP.PATH
APP3.PARTS.LOG (ESDS)
Note: In this scenario, all data sets are created by using JCL to run batch jobs.
The ALLOCATE command is used for the non-VSAM data sets and the DEFINE CLUSTER
command is used for the VSAM data sets.
Note: The NORECATALOG (default) option of the DEFINE NONVSAM command adds a NONVSAM
entry to the catalog. It is not mandated that the data set is on the volume.
The RECATALOG option adds an SMS-managed NONVSAM entry to a catalog by using the
non-VSAM volume record (NVR) in the (VSAM Volume data set) VVDS. In this case, the
NVR must be on the volume.
The APP3.PROGRAMS.SOURCE is to be allocated as a partitioned data set (PDS). The data sets
are used by the application developers to hold the source code for their programs.
The APP3.PROGRAMS.LOADLIB is also a PDS and holds the load modules for the APP3
application.
The APP3.PROJECT.JCL is a PDS that contains the JCL and whatever else is required to
maintain and report on the APP3 project’s data sets and catalog.
22 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
IDCAMS commands to allocate APP3 non-VSAM data sets
The IDCAM SYSIN in-stream commands that are used to allocate the three non-VSAM data
sets are shown in Example 3-3.
The use of the DELETE command ensures that the data set allocations do not fail because the
data set is available. A sample from the SYSPRINT SYSOUT output is shown in
Example 3-4.
DELETE APP3.PROGRAMS.LOADLIB
IDC3012I ENTRY APP3.PROGRAMS.LOADLIB NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42
IDC0551I ** ENTRY APP3.PROGRAMS.LOADLIB NOT DELETED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8
SET MAXCC=0
DELETE APP3.PROJECT.JCL
IDC3012I ENTRY APP3.PROJECT.JCL NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42
IDC0551I ** ENTRY APP3.PROJECT.JCL NOT DELETED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8
SET MAXCC=0
END
IDCAMS issued messages and a condition code of 8. By using the SET command, the
condition code value is reset so that the processing can continue as specified.
The following VSAM data sets are available to define for the APP3 application:
APP3.PARTS: A KSDS that appears in the following parts:
– Base cluster.
– The data component that holds the data records. A primary key is defined for the
program on which to access the data records. The KEYS(8 0) indicates that the length
of the primary key is 8 bytes and is at location 0 of the record (the first byte of the data
record). The parameters are separated by a space.
– The index component that provides the index into the data component. The index
reduces the search for a record. Instead of reading the data in a sequential manner,
the index contains a hierarchical map of the data component; therefore, it can minimize
the search steps for the requested data record.
APP3.PARTS.LOG is an ESDS data set. There is no index for this VSAM data set.
24 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
INDEX(RECORDS (500 500))
/* DEFINE THE ESDS. */
IF LASTCC = 0 -
THEN DO
DEFINE CLUSTER (NAME(APP3.PARTS.LOG) STORCLAS(S1P03S01) -
RECORDS(100 100) RECORDSIZE(80 80) -
NONINDEXED)
END
Note: The DELETE command for the APP3.PARTS KSDS deletes the associated data and
index components and any associated ALTERNATE INDEXes (IBM AIX®) or PATHs.
You can now use the TSO command to list the name component of the APP3.PARTS KSDS, as
shown in Figure 3-5.
The base cluster is APP3.PARTS with the DATA and INDEX components.
To load the contents of the APP3 PARTS.INPUT into the APPS.PARTS VSAM data set, you
can use the IDCAMS REPRO command, as shown in Example 3-6 on page 26.
There are two Data Definition (DD) statements in the JCL. The INPUT DD card refers to the
sequential data set that contains the test data. The OUTPUT DD refers to the VSAM data set
into which you want to load the data. The INFILE on the REPRO command specifies the
DDNAME of the input data set in the JCL. The OUTFILE specifies the DDNAME of the output
dat set.
The output from the REPRO command is shown in Example 3-7. The messages indicate how
many records were loaded into the file.
1 2 3 4 5 6 7 8
012345678901234567890123456789012345678901234567890123456789012345678901234567890……
PART WAREHOUSE PART COST PER QUANTITY SUPPLIER NAME
NUMBER LOCATION NAME ITEM ON HAND
00000127 ROW 9 CELL 20 WASHER 0.040 120000 WALLY'S WASHER WORLD
00001392 ROW 6 CELL 14 SCREW 0.003 500000 SAM'S SCREWDRIVERS
00001395 ROW 5 CELL 11 NAIL 0.001 730000 NELLIE'S NICE NAILS
00001467 ROW 3 CELL 01 BOLT 0.110 005000 BOB'S BOLT BONANZA
00002256 ROW 3 CELL 05 NUT1 0.040 002000 NEIL'S NUT HUT
00002257 ROW 3 CELL 06 NUT2 0.055 003000 NED'S NEIGHBORLY NUTS
The top two layers show the offset into the data record. The record begins at offset 0 and
not 1. The next two lines contain the field names.
Note: The top four lines are included only for your information and are not part of the test
data in the data set.
26 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
The test data set contains six records. The offsets and field names are listed in Table 3-2.
0 PART NUMBER
9 WAREHOUSE LOCATION
24 PART NAME
44 QUANTITY ON HAND
55 SUPPLIER NAME
The IDCAMS commands and keywords that are used to define the cluster are shown in
Figure 3-5 on page 24. Notice the KEYS(8 0) values. This parameter specifies the primary
key. It overrides the values that might be specified on the DATACLASS parameter.
The data records are stored in order of the primary key. Programs that are accessing the data
set by using the primary key can locate the data record more quickly. Therefore, the PART
MUMBER is the primary key in the APP3.PARTS VSAM KSDS. The index is built based on the
primary key.
The answer is to define an alternative index by using the AIX. This index does not replace the
original index; instead, it is another index that is built on a different key. A cluster can include
more than one AIX that is related to it, as shown in Figure 3-8.
APP3.PARTS
DATA RECORD: | PART NUMBER |…| PART NAME |…| SUPPLIER NAME|
APP3.PARTS
APP3.PARTNAME.AIX
When the path is opened to process data records, the alternative index and the base cluster
are opened and the program accesses the data by the AIX.
The KEYS parameter values specify its length and offset into the record (see Table 3-2 on
page 27). The two fields that you defined as the alternative key for each AIX are the PART
NAME and the SUPPIER NAME.
The APP3.PARTNAME.AIX specifies the key length as 6 and the offset as 24.
28 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
The APP3.PARTSUPP.AIX specifies key length as 30 and the offset as 55.
Note: UPGRADE is the default parameter if you do not specify the option that you want to use.
Also, you must load the AIX with the necessary data for it to be effective.
Loading an AIX
You use the BLDINDEX command to load an AIX. When you specify the BLDINDEX command,
IDCAMS opens the base cluster to sequentially read the data records, sorts the information
that is obtained from the data records, and builds the alternative index records.
The base cluster’s data records are read and information is extracted to form the key-pointer
pair. When the base cluster is key sequenced, such as APP3.PARTS, the alternative key value
and the data record’s prime key value form the key-pointer pair.
The key-pointer pairs are sorted in ascending alternative key order. The sort can be done
internally if you specified sufficient virtual storage and access method services perform an
internal sort. If you want the sort to be performed externally, you can specify the EXTERNALSORT
parameter.
If insufficient virtual storage is available to perform the internal sort, IDCAMS defines and
uses two sort work files and performs the sort externally. The external sort work file is a
VSAM ESDS that is marked as reusable. IDCAMDS uses the sort work files to contain most
of the key-pointer pairs while it sorts some of them in virtual storage.
Use the following formula to help you calculate the minimum amount of virtual storage you
need for an external sort:
32768 + ((32768/sort record length) x 4)
When the key-pointer pairs are sorted into an ascending alternative key order, IDCAMS builds
an alternative index record for each key-pointer pair. When all alternative index records are
built and loaded into the alternative index, the AIX and its base cluster are closed.
The INDATASET parameters specify the base cluster and the OUTDATASET parameter
specifies the AIX to be built.
Note: The REPRO Mergecat is outside the scope of this IBM Redpaper publication.
Note: IDCAMS does not use Record Level Sharing (RLS). An RLS keyword is ignored if it
is specified on the DD statement that is opened by IDCAMS.
A new cluster APP3.PARTS.KSDS.COPY is defined and the records in the APP3.PARTS are copied
by using the REPRO command. The output is shown in Example 3-11.
30 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
SET MAXCC=0
END
/* COPY THE KSDS */
IF LASTCC = 0 -
THEN DO
IF LASTCC = 0 -
THEN DO
END
32 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
This technique is frequently used to reorganize VSAM data sets. If the APP3.PARTS cluster
was to hold hundreds or thousands of records and feature high activity levels, such as record
inserts and deletes, you can expect to see Control Interval (CI) splits and Control Area (CA)
splits. However, this split decreases the efficiency of the KSDS data set. You can resolve this
issue by using the REPRO command to copy the data set to a sequential file and then copy it
back, which means that the CIs and CAs are rebuilt and the efficiency restored.
NONVSAM data sets can also be copied to NONVSAM data sets. However, consider the following
points:
Do not use the REPRO command to copy PDS or PDSEs because the information that is
stored in the directories is not copied. However, you can copy a PDS member.
You do not see the record count when compressed data sets are copied.
The following parameters can be used to help you select records for a partial copy:
For a KSDS:
– FROMKEY(key): Specifies the key of the first record you want copied. You can specify
generic keys (a portion of the key, followed by *).
– TOKEY(key): Specifies where copying is to end in the data set that is being copied. You
can specify only one of these parameters for a copy operation. The location where
copying is to end must follow the location where it is to begin.
For a RRDS/VRRDS:
– FROMNUMBER(number): Specifies the relative record number of the first record you want
copied.
– TONUMBER(number): Specifies the relative record number of the last record you want
copied.
For KSDS and ESDS or their components:
– FROMADDRESS(address): Specifies the relative byte address (RBA) of the first record you
want copied. The RBA value must be the beginning of a logical record. If you specify
this parameter for key-sequenced data, the records are copied in physical sequential
order instead of in logical sequential order. This parameter cannot be specified when
either of the following conditions exist:
• When the data set is being accessed through a path.
• For a key-sequenced data set with spanned records if any of those spanned
records are to be accessed.
– TOADDRESS(address): Specifies the RBA of the last record you want copied. Unlike
FROMADDRESS, the RBA value does not need to be the beginning of a logical record. The
entire record that contains the specified RBA is copied.
Note: The same two restrictions apply for a path and spanned records, as in the
FROMADDRESS parameter.
SKIP(number): Specifies the number of logical records to skip before copying records.
COUNT(number): Specifies the number of logical records you want copied. This setting is
not be specified when you access the data set through a path.
The use of the EXPORT command exports a VSAM cluster or an AIX, a backup copy of a
catalog also can be created.
EXPORT copies VSAM information from the catalog and includes it in the portable data set. The
IMPORT command uses the copied catalog information to re-create the data set before loading
it with the exported records.
Use caution when you are selecting your EXPORT parameters because these parameters can
indicate that you are moving your cluster or AIX elsewhere or possibly archiving it and the
original cluster is to be deleted. Pay attention to whether you specify the following parameters:
TEMPORARY: Specifies that the cluster, alternative index, or catalog is not to be deleted from
the original system. The object in the original system is marked as TEMPORARY to indicate
that another copy exists and that the original copy can be replaced by using an IMPORT
command.
PERMANENT: Specifies that the cluster or alternative index is to be deleted from the original
system. Its storage space is freed. If its retention period did not yet expire, you must also
include the PURGE parameter.
34 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
IDCAMS commands to restore by using IMPORT
The IMPORT command to restore APP3.PARTS is shown in Example 3-15.
The use of the IMPORT command deleted the base cluster and all its associated components.
The APP3.PARTS cluster is re-created along with its DATA and INDEX components by using the
information from the export.
Note: The AIX and the PATH components were not re-created by using the IMPORT
command; therefore, you must redefine and reload them.
Note: Because catalog management does not maintain statistics of its own cluster entry,
the information you see might not be accurate.
36 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
CATALOG(catalog name): Limits to the specified catalog.
LIBRARY(library name): Limits to the name of the tape library for which tape volume
entries are to be listed.
ALIAS: Only the alias entries are listed.
USERCATALOGS: Lists the catalog connectors.
The results of the use of an EXAMINE command on APP3.PARTS with the index and data
components being tested is shown in Example 3-19.
38 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
3.5 Removing the APP3 project
After the project is completed, the application developers request that you to remove the
project data sets, including the alias and user catalog.
The following options and parameters are available to delete the various elements:
SCRATCH or NOSCRATCH:
– SCRATCH removes the VVR or NVR and associated VTOC entries.
– NOSCRATCH performs an uncatalog action only.
ERASE or NOERASE:
– ERASE is valid with the SCRATCH option only. Consider the following points:
• The AIX components are to be overwritten with binary zeros when deleted.
• More processing is required for the overwriting.
• The option also can be set in an IBM RACF® profile.
– NOERASE does not perform the overwrite. The RACF options can override the NOERASE
option so that an ERASE is performed.
After the job was run, an extract of the SYSPRINT is shown in Example 3-22.
This issue is corrected by changing the print train default parameter value, which is set to PN.
The value can be changed to TN, which is the character set for text printing 120 characters
and displaying lowercase comments. You specify this parameter by using the PARM command.
PARM command
The PARM command specifies processing options to be used during execution. These options
remain in effect until they are changed by another PARM command. You can also use these
options in the PARM field of an EXEC statement, which is in the JCL. The syntax of the PARM
command is shown in Example 3-23 on page 41.
40 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Example 3-23 PARM command
Command Parameters
PARM [TEST({[TRACE]
[AREAS(areaid[ areaid...])]
[FULL((dumpid[ begin[ count]])
[(dumpid...)...])]|
OFF})]
[GRAPHICS(CHAIN(chain)|TABLE(mname))]
[MARGINS(leftmargin rightmargin)]
The job is run and the relevant SYSPRINT is shown in Example 3-25.
Example 3-25 Lowercase text that is displayed by using PARM on the EXEC
IDCAMS SYSTEM SERVICES
GRAPHICS(CHAIN(TN))
IDCAMS SYSTEM SERVICES
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
The PARM command can be entered in the SYSIN, as shown in Example 3-26.
Dynamic allocation allows a job to acquire resources as the resources are needed and
release them immediately after use. The resources are a ddname-data set combination with its
volumes and devices.
One reason to use dynamic allocation is that you might not know all of the device
requirements for a job before the job is run. Another reason is that it allows the system to use
resources more efficiently; that is, the system can acquire resources before they are used
and then release those resources immediately after use.
To dictate the number of resources to be held in anticipation of reuse, use the following code:
//stepname EXEC PGM=IDCAMS,DYNAMNBR=n
Specify n as a decimal number 0 - 3273, minus the number of DD statements in the step.
Note: The limit of 3273 is based on the number of single unit DD statements for a 64 K task
input/output table (TIOT). This limit can be different depending on the installation-defined
TIOT size. The 32 K size is the default TIOT size. The limit for a 32 K TIOT is 1635. (In a
JES3 system, the installation might further reduce the limit.) The default value is 0.
The system uses the sum of this number and the number of DD statements (including any DD
statements that are in a cataloged or in-stream procedure that is called by the step) in the
step to establish a control limit for tracking resources that it is holding in anticipation of reuse.
Note: If this control limit is reached and another dynamic allocation is requested, the
request is not honored unless resources can be unallocated so that the control limit is not
exceeded.
42 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
3.6.3 UNIQUE KEY
When a key is selected for an AIX, the field to which that key refers in the base cluster might
not be unique. A sample data set record layout is listed in Table 3-3.
The base cluster is the Applicant ID. Each applicant for this application is given a unique
identifier. The second field in each record contains each applicant’s first name, and the third
field lists the applicant’s city.
If an AIX is set up with the APPLICANT CITY as the key, a duplicate key exists (see
Table 3-3); therefore, the key is not unique.
When the AIX is defined, the UNIQUEKEY | NONUNIQUEKEY parameter option is available.
This parameter shows whether more than one data record (in the base cluster) can contain
the same key value for the alternative index.
UNIQUEKEY points each alternative index key to only one data record. When the alternative
index is built and more than one data record contains the same key value for the alternative
index, the BLDINDEX processing ends with an error message.
NONUNIQUEKEY points a key value for the alternative index to more than one data record in the
base cluster. The alternative index’s key record points to a maximum of 32768 records with
non-unique keys. When NONUNIQUEKEY is included, the maximum record size is large enough
to allow for alternative index records that point to more than one data record. This setting is
the default setting.
During BLDINDEX processing when the key-pointer pairs are sorted into ascending alternative
key order, IDCAMS builds an AIX record for each key-pointer pair. If the NONUNIQUEKEY
attribute is used and more than one key-pointer pair features the same alternative key values,
the alternative index record contains the alternative key value followed by the pointer values in
ascending order. If the UNIQUEKEY attribute is used, each alternative key value must be unique.
JOBGROUPs allow you to define a schedule that ensures the jobs are run in the correct
sequences and any jobs that you identify as running concurrently with others run as such.
Figure 3-10 shows a schematic to define the APP7 project much as we defined the APP3
project. The JOBGROUP is named APP7JOBG.
APP7JOBG
APP7UCAT
Defines USERATALOG
and ALIAS
APP7DFNV APP7DFCL
Concurrent
Defines NONVSAM Defines VSAM data
data sets sets
APP7LDCL
Loads test data into
VSAM KSKDS
APP7AIX1
Defines first AIX, PATH,
and BLDINDEX
APP7AIX2
Defines second AIX,
PATH, and BLDINDEX
Figure 3-10 APP7JOBG JOBGROUP
44 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Figure 3-10 on page 44 also shows the structure of the APP7JOBG. The jobs roles are included
below the job names of the jobs that make up the JOBGROUP. The relationship between the jobs
is shown in the following examples:
APP7UCAT is the first job to run.
APP7DFNV and APP7DEFC run if job APP7UCAT completes with a return code 0. Both jobs can
run concurrently.
APP7LDCL runs if APP7DFNV and APP7DEFC complete with a return code of 0. Although this
job loads only the VSAM KSDS with test data, steps can be added to also load the
NONVSAM data sets with PDS members, such as program sources and the JCL to
compile and link-edit them. If you choose to do use this configuration, you can encounter
concurrent load jobs for each data set.
APP7AIX1 runs if job APP7LDCL completes with a return code 0.
APP7AIX2 runs if job APP7AIX1 completes with a return code 0. The AIX jobs cannot run
together because they serialize on the APP7.PARTS KSDS.
Concurrent JOBs
When concurrent jobs are used, ensure that you set a value on the GRPDEF definition. Use the
$DGRPDEF command and check the CONCURRENT_MAX value (default is 0), as shown in
Example 3-29.
The CONCURRENT_MAX value specifies how many concurrences you can have in a JOBGROUP. To
modify the limit, use the $TGRPDEF,CONCURRENT_MAX=20 command.
SDSF JG option
Example 3-31 shows the JOBGROUP output via the SDSF JG option.
46 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
$HASP1301 APP7AIX1 in job group APP7JOBG queued for execution
$HASP373 APP7AIX1 STARTED - INIT 2 - CLASS A - SYS SC74
$HASP395 APP7AIX1 ENDED - RC=0000
$HASP1301 APP7AIX2 in job group APP7JOBG queued for execution
$HASP373 APP7AIX2 STARTED - INIT 1 - CLASS A - SYS SC74
$HASP395 APP7AIX2 ENDED - RC=0000
$HASP1304 job group APP7JOBG is complete
Example 3-32, Example 3-33 on page 48, Example 3-34 on page 48, Example 3-35 on
page 49, Example 3-36 on page 50, and Example 3-37 on page 50 show the individual jobs
that made up the JOBGROUP.
IF LASTCC = 0 -
THEN DO
DEFINE ALIAS(NAME(APP7) RELATE(CATAPP7))
END
/*
//
IF LASTCC = 0 -
THEN DO
ALLOC DSNAME('APP7.PROGRAMS.LOADLIB') NEW RECFM(U) LRECL(0) -
BLKSIZE(32760) DSORG(PO) DIR(50) SPACE(5,1) CYLINDERS -
STORCLAS(S1P03S01)
END
IF LASTCC = 0 -
THEN DO
ALLOC DSNAME('APP7.PROJECT.JCL') NEW RECFM(F B) LRECL(80) -
BLKSIZE(27920) DSORG(PO) DIR(50) SPACE(5,1) CYLINDERS -
STORCLAS(S1P03S01)
END
/*
//
48 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
/* NOTE: THIS WILL ALSO DELETE ANY DEFINED AIX OR PATH. */
DELETE APP7.PARTS
SET MAXCC=0
IF LASTCC = 0 -
THEN DO
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART NAME PATH. */
DEFINE PATH (NAME (APP7.PARTNAME.PATH) -
PATHENTRY(APP7.PARTNAME.AIX) )
END
IF LASTCC = 0 -
THEN DO
/* BUILD THE PART NAME AIX. */
BLDINDEX INDATASET(APP7.PARTS) -
OUTDATASET(APP7.PARTNAME.AIX)
END
PRINT INDATASET(APP7.PARTNAME.AIX)
/*
//
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART SUPPLIER PATH. */
DEFINE PATH (NAME (APP7.PARTSUPP.PATH) -
PATHENTRY(APP7.PARTSUPP.AIX) )
50 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
END
IF LASTCC = 0 -
THEN DO
/* BUILD THE PART SUPPLIER AIX. */
/* BUILD THE PART SUPPLIER AIX. */
BLDINDEX INDATASET(APP7.PARTS) -
OUTDATASET(APP7.PARTSUPP.AIX)
END
PRINT INDATASET(APP7.PARTSUPP.AIX)
/*
//
The JCL starts a procedure that is named APPNBLD1. This procedure is a JCL proc with
instream SYSIN. It uses one symbolic variable that is named PROJHLQ. The value of
PROJHLQ is set to APP9. Example 3-39 shows the APPNBLD1 procedure, which was stored
in a PROCLIB.
IF LASTCC = 0 -
THEN DO
DEFINE ALIAS(NAME(&PROJHLQ) RELATE(CATAPP5))
IF LASTCC = 0 -
THEN DO
REPRO INFILE(TESTDATA) OUTDATASET(&PROJHLQ..PARTS)
END
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART NAME AIX. */
DEFINE ALTERNATEINDEX (NAME(&PROJHLQ..PARTNAME.AIX) -
RELATE(&PROJHLQ..PARTS) KEYS(6 24) RECORDS(800 100) UPGRADE )
END
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART NAME PATH. */
DEFINE PATH (NAME (&PROJHLQ..PARTNAME.PATH) -
PATHENTRY(&PROJHLQ..PARTNAME.AIX) )
END
IF LASTCC = 0 -
THEN DO
/* BUILD THE PART NAME AIX. */
BLDINDEX INDATASET(&PROJHLQ..PARTS) -
OUTDATASET(&PROJHLQ..PARTNAME.AIX)
END
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART SUPPLIER AIX. */
DEFINE ALTERNATEINDEX (NAME(&PROJHLQ..PARTSUPP.AIX) -
RELATE(&PROJHLQ..PARTS) KEYS(30 55) RECORDS(800 100) NOUPGRADE)
END
IF LASTCC = 0 -
THEN DO
/* DEFINE THE PART SUPPLIER PATH. */
DEFINE PATH (NAME (&PROJHLQ..PARTSUPP.PATH) -
PATHENTRY(&PROJHLQ..PARTSUPP.AIX) )
52 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
END
IF LASTCC = 0 -
THEN DO
/* BUILD THE PART SUPPLIER AIX. */
BLDINDEX INDATASET(&PROJHLQ..PARTS) -
OUTDATASET(&PROJHLQ..PARTSUPP.AIX)
END
/* DELETE THE ESDS. */
DELETE &PROJHLQ..PARTS.LOG
SET MAXCC=0
DELETE &PROJHLQ..PROGRAMS.SOURCE
DELETE &PROJHLQ..PROGRAMS.LOADLIB
DELETE &PROJHLQ..PROJECT.JCL
SET MAXCC=0
IF LASTCC = 0 -
THEN DO
/* ALLOCATE THE LOAD LIBRARY */
ALLOC DSNAME(‘&PROJHLQ..PROGRAMS.LOADLIB’) NEW RECFM(U) LRECL(0) -
BLKSIZE(32760) DSORG(PO) DIR(50) SPACE(5,1) CYLINDERS -
STORCLAS(S1P03S01)
END
IF LASTCC = 0 -
THEN DO
/* ALLOCATE THE JCL LIBRARY */
ALLOC DSNAME('&PROJHLQ..PROJECT.JCL') NEW RECFM(F B) LRECL(80) -
BLKSIZE(27920) DSORG(PO) DIR(50) SPACE(5,1) CYLINDERS -
STORCLAS(S1P03S01)
END
/*
The data sets provisioning also can be part of a larger workflow for setting up application
environments for the development, testing, and training purposes.
54 Everything You Always Wanted to Know about IDCAMS But Were Afraid to Ask
Related publications
The publications that are listed in this section are considered particularly suitable for a more
detailed discussion of the topics that are covered in this paper.
IBM Redbooks
The following IBM Redbooks publications provide more information about the topic in this
document. Note that some publications that are referenced in this list might be available in
softcopy only:
A Practical Guide to ICF Catalogs, SG24-8262
VSAM Demystified, SG24-6105
You can search for, view, download, or order these documents and other Redbooks,
Redpapers, Web Docs, draft, and other materials at the following website:
ibm.com/redbooks
Other publications
The following publications are also relevant as further information sources:
Access Method Services, SC23-846
DFSMS Managing Catalogs, SC23-6853
DFSMS Using data sets, SC23-6855
Online resources
The following SHARE website also is relevant as a further information source:
http://share.org
REDP-5389-00
ISBN 0738455555
Printed in U.S.A.
®
ibm.com/redbooks