JCL Session 7



IDCAMS

VSAM - Virtual Storage Access Method


KEY SEQUENCE DATA SET (KSDS)
 

A VSAM cluster (cluster is another name for a VSAM file) can be accessed
 
Data records
A VSAM KSDS

For VSAM datasets, use only the first positional parameter of DISP=

Do not use the second or third positional DISP= parameter to alter the status of a VSAM dataset.

    DISP=(OLD,X,X)     or      DISP=(SHR,X,X)

    Use the IDCAMS program for deleting or defining VSAM datasets.



Data component and primary index component form a base cluster.

Data Component (has the data records) and can be processed sequentially.
 
 
EID Name SSN
011  Harris, Stanley  499-35-5069 
022 Lloyd, Harold 293-74-9932
033 Constantine, Joe 889-43-1283
044 Little, John 559-23-1245
055 Siebert, E.R. 599-22-1133
066 Small, Marie 115-76-9322
077 McDonald, Ronald 113-77-1135
 

(Note that the order of the data component is by its primary key (EID)
-------------------------------------------------------------------------------------------------------------------------------

Index Component extracts the primary key from the Data Component.

(Note that the order of the index component is by primary key (EID)



An Alternate Index is a separate KSDS where the data record is the extracted
Alternate Key and Primary Key from the data component of the original KSDS.

The data record can be searched by its alternate key to find the primary key.
 
 
Alternate Key Primary Key
SSN EID
113-77-1135 077
115-76-9322
066
293-74-9932
022
499-35-5069 
011 
559-23-1145
044
599-22-1133
055
889-43-1283
033
(Note that the sequence of the alternate index component is by the alternate key -- SSN)



JCL to invoke AMS

//stepname EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* <--prints SYSIN input plus results of AMS processing
//SYSIN    DD *        <--points to dataset containing AMS input commands
 (AMS COMMANDS)



AMS Command Format
 

Sample list of AMS Command Verbs

ALTER - Change the current information specified for a catalog, cluster, alternate index or path.

BLDINDEX - Build an alternate index.

DEFINE ALTERNATEINDEX - Define an alternate index

DEFINE CLUSTER - Define a VSAM file.

DEFINE PATH - Define the path that relates an alternate index to its base cluster

DELETE - Remove a catalog entry for cluster, alternate index or path.

LISTCAT - List information about datasets.

PRINT - Print the contents of a VSAM or non-VSAM file.

REPRO - Copy records from one file to another.



Parameters for DEFINE CLUSTER Command

NAME(filename)
 

INDEXED
  RECORDSIZE(avg max)
RECSZ
 

KEYS(length offset)
 

VOLUMES(vol-ser, ......)
VOL CYLINDERS | TRACKS | RECORDS | BLOCKS (primary secondary)
 
        Select one of the above
 

UNIQUE
 
    File occupies its own data space.
 

FREESPACE (control_interval_% control_area_%)
FSPC

IMBED

SHAREOPTIONS(Option)
SHR
  CONTROLINTERVALSIZE(bytes)
CISZ



Example of DEFINE CLUSTER Command Creating a KSDS

//DELDEF   EXEC PGM=IDCAMS
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD *
  DELETE filename CLUSTER
  DEFINE CLUSTER -
  (NAME(filename) -
  INDEXED -
  RECSZ(avg max) -
  KEYS(length offset) -
  VOL(volid)) -
  storage_unit(primary secondary) -
  UNIQUE -
  FSPC(ci% ca%) -
  IMBED -
  SHR(shareoption) -
  CISZ(bytes) -
  DATA (NAME(filename.DATA)) -
 INDEX (NAME(filename.INDEX))
//****************************************************************
//*
//* USING IDCAMS TO LOAD A VSAM FILE
//*
//****************************************************************
//*
//REPRO   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDATA   DD DSN=userid.CSC.CNTL(memname),DISP=SHR
//OUTDATA  DD DSN=filename,DISP=OLD
//SYSIN    DD *
  REPRO INFILE(INDATA) OUTFILE(OUTDATA)
//****************************************************************
//*
//* USING IDCAMS TO DUMP (PRINT) A FILE
//*
//****************************************************************
//*
//DUMP    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDATA   DD DSN=filename,DISP=SHR
//SYSIN    DD *
  PRINT INFILE(INDATA) CHARACTER

Parameters for DEFINE ALTERNATEINDEX (AIX) Command

NAME(DSN-name)
  RELATE(DSN-name) CYLINDERS | TRACKS | RECORDS | BLOCKS (primary secondary) VOLUME(vol-ser, ......) KEYS( length offset) UNIQUEKEY | NONUNIQUEKEY SHAREOPTIONS(Option)



Parameter of BLDINDEX Command
 

BLDINDEX
 

Parameters for DEFINE PATH Command
 

PATH

NAME(filename)

PATHENTRY(alt_index_name)

 
Example of DEFINE Alternate Index & Path

//******************************************************************
//* THIS STEP DEFINES AN ALTERNATE INDEX
//******************************************************************
//STEPA   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=X
//SYSIN    DD *
    DEFINE AIX(NAME(filename.AIX) -
    RELATE(filename) -
    RECORDS (primary secondary) VOLUME (volid) -
    KEYS (length offset) SHAREOPTIONS(option) -
    NONUNIQUEKEY)
//********************************************************************
//* THIS STEP BUILDS AN ALTERNATE INDEX
//********************************************************************
//STEPB   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=X
//PRIMEI   DD DSN=filename,DISP=SHR
//ALTERI   DD DSN=filename.AIX,DISP=SHR
//SYSIN    DD *
    BLDINDEX INFILE (PRIMEI) OUTFILE (ALTERI)
//****************************************************************
//* THIS STEP DEFINES A PATH FOR THE ALTERNATE INDEX
//****************************************************************
//STEPC   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=X
//SYSIN    DD *
    DEFINE PATH (NAME(filename.PATH) -
    PATHENTRY (filename.AIX) )
//******************************************************************
//* THIS STEP PRINTS ALTERNATE INDEXES & PATHS
//******************************************************************
//PRINT   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDATA   DD DSN=filename.AIX,DISP=SHR
//INDATA2  DD DSN=filename.PATH,DISP=SHR
//SYSIN    DD *
    PRINT INFILE(INDATA) CHARACTER
    PRINT INFILE(INDATA2) CHARACTER
/*



EXERCISE: (VALUE 30 points)


Create a single JOB with multiple steps which will accomplish the following: