IDCAMS - Access Method Services
A utility used to create, delete, load, backup and print VSAM
files. It is also used to create alternate indexes.
The JCL is as follows:
- // EXEC PGM=IDCAMS
- //SYSPRINT DD SYSOUT=A
- //SYSIN DD *
- ****** IDCAMS Control Statements ******
- /*
Statements should begin in column 2. A hyphen is used at the end
of a line to continue a statement on the next line.
DELETE (X) CL This control statement deletes the
VSAM cluster named X. The data component, the index component
and any alternate indexes are deleted.
Example:
DELETE (S460230.MASTER) CL
DEFINE CLUSTER This statement creates a new VSAM
cluster. The various parameters for this statement describe the
file in more detail.
Example:
DEFINE CLUSTER
(NAME(S460201.MASTER) INDEXED
RECORDSIZE(60 60) KEYS(9 0)
RECORDS(50 20) FREESPACE(20 20))
DATA(NAME(S460201.MASTERD))
INDEX(NAME(S460201.MASTERI))
- NAME(X) X is the name of the VSAM cluster being defined.
It must begin with 'ZUMSL01.xxxxxxx' where 'xxxxxxx' is a RACF
userid. Use this name on any DD statement referencing the VSAM
file.
- INDEXED This specifies that the file is a Key Sequenced
VSAM file.
- RECORDSIZE(X Y) X is the average record size and Y
is the maximum record size. If the records are fixed length then
X and Y equal that length.
- KEYS(X Y) X is the length of the primary key. Y is
the offset that the key is from the beginning of the record. The
key should be the first field in the record so the offset is zero.
- RECORDS(X Y) X is the estimated number of records that
the VSAM file will have. Y is the estimated number of records
that may be added to the file. VSAM files can also be allocated
by tracks or cylinders but it is better to let IDCAMS calculate
the space needed.
- FREESPACE(X Y) X is the percent of space to be left
free in each control interval after loading or after a CI split.
Y is the percent of space to be left free in each control area
after loading or after a CA split. This will vary depending on
how much updating will be done. More splits will occur when updating
if less space is left free but more total space will be allocated
to the file if a greater percentage is left free.
- DATA(NAME(X)) X is the name given to the data component
of the VSAM cluster.
- INDEX(NAME(X)) X is the name given to the index component
of the VSAM cluster.
REPRO input-parameter output-parameter other-parameters
REPRO can be used to:
1) Load a VSAM file from a sequential file
2) Copy a VSAM file to a sequential file as when doing backups
3) Copy a VSAM file to another VSAM file
4) Copy a sequential file to another sequential file
Parameters are:
- INFILE(ddname) or INDATASET/IDS(dataset name) - specify the
input file
- OUTFILE(ddname) or OUTDATASET/ODS(dataset name) - specify
the output file
- COUNT(number of records) - specify the number of records to
copy
- SKIP(number of records) - to skip a specific number of records
at the beginning of the file before starting the copy operation
Data must be sorted in ascending sequence on the key field when
copying into a VSAM file.
Examples:
REPRO INFILE(INPUTDD) ODS(S460201.MASTER)
REPRO IDS(S460201.MASTER) OUTFILE(OUTDD)
REPRO IDS(S460201.MASTER) ODS(S460201.TEST.MASTER) -
SKIP(100) COUNT(50)
PRINT input-parameter other-parameters
PRINT can be used to print all or selected records from a VSAM
file. The default is to print the entire file.
Parameters are:
- INFILE(ddname) or INDATASET/IDS(dataset name) - specify the
file to be printed
- COUNT(number of records) - specify the number of records to
print
- SKIP(number of records) - to skip a specific number of records
at the beginning of the file before starting to print
- FROMKEY(key value) - start printing at the record equal to
the key value specified or the first record with a greater key
value
- TOKEY(key value) - stop printing after the record with an
equal key value or the last record with a lesser key value
- CHAR/HEX/DUMP - CHAR prints the data in character format;
HEX prints the data in hexadecimal; DUMP prints both character
format and corresponding hexadecimal format
Examples (assuming VSAM file key length=5):
PRINT IDS(S460201.MASTER) FROMKEY('10000') TOKEY('20000')
PRINT IDS(S460201.MASTER) COUNT(10) DUMP
PRINT IDS(S460201.MASTER) TOKEY('30000')
LISTCAT
LISTCAT displays information about an MVS dataset.
Parameters are:
- ENT(dataset name/cluster name) - specify a VSAM cluster or
MVS sequential dataset
- LEVEL(prefix of dataset name) - specify dataset information
on a group of datasets all named with the same prefix
- NAME/ALL - NAME is the default and will print only the name
of the dataset; ALL will print all available information on a
dataset (ALL is especially useful with a VSAM cluster)
Examples:
LISTCAT ENT(S460201.MASTER) ALL
LISTCAT LEVEL(S460201)
The following job will delete a VSAM cluster if it exists, define
a new VSAM cluster and then load it with data.
//jobname JOB (46020xx,SL),LUGNUT,USER=S4602xx,PASSWORD=pppppp,
// REGION=900K
// EXEC PGM=IDCAMS
//LOADIT DD DSN=$4602.VSAM.DATA,DISP=SHR
//SYSPRINT DD SYSOUT=A
//SYSIN DD * ****** Control Statements follow ******
DELETE (S4602xx.MASTER) CL
DEFINE CLUSTER
(NAME(S4602xx.MASTER) INDEXED
RECORDSIZE(80 80) KEYS(9 0)
RECORDS(50 20) FREESPACE(20 20))
DATA(NAME(S4602xx.MASTERD))
INDEX(NAME(S4602xx.MASTERI))
REPRO INFILE(LOADIT) ODS(S4602xx.MASTER)
//
Where: 'jobname' is any valid jobname
'xx' is a subaccount#
'pppppp' is the RACF password