Introduction (for Beginners)


What is IDCAMS?


  • IDCAMS (Integrated Data Cluster Access Method Services) is the utility program name for access method services (AMS) and used to create, modify and delete the VSAM datasets.
  • The functions of AMS are performed through the different functional commands of IDCAMS.

What is AMS?


  • Access Method Services (AMS) is a utility mainly used to define and handle VSAM datasets and integrated catalogs.

IDCAMS Functions -


IDCAMS allows performing the following tasks -

  • Define, alter, copy, and delete datasets.
  • List catalogs, catalog entries, or datasets.
  • Define and build alternate indexes.
  • Back up and restore VSAM datasets.
  • Print the contents of datasets.
  • Collect information about datasets.
  • Detect VSAM dataset problems.
  • Encrypt and decrypt datasets.

Invoking IDCAMS Utility -


IDCAMS utility is invoked in the following three ways -

  • Batch mode (With the help of JCL).
  • With TSO commands.
  • Call from the program - A program requires PPI (Problem Program Interface) to invoke IDCAMS.

Batch mode (With the help of JCL) -


We can run IDCAMS as a batch job with the help of JCL as shown below -

Syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  AMS commands and their parameters
/*
//
  • SYSPRINT DD statement - contains the output of the specified command.
  • SYSIN DD statement - can be a file or instream procedure that contains IDCAMS commands.

With TSO commands -


The ISPF Command Shell (option 6 from the ISPF main menu) is the best option to use the IDCAMS command interactively.

The command can be triggered like below -

Invoking IDCAMS from TSO

The output is -

Invoking IDCAMS from TSO Output
  • NONVSAM - used to specify sequential or non-vsam files.
  • VSAM - used to specify vsam files.
Note! The PREFIX/NOPREFIX option on the TSO command was introduced in z/OS Version 2.2. Before this release, there is no PREFIX option. So all the files should specify by ignoring userid prefix.

For example - to refer "MATEPK.IDCAMS.JCLLIB", it should specify as "IDCAMS.JCLLIB".

How to validate the IDCAMS return code?


The return code or condition code are used to specify the result of the command and used to decide what has to do next.

There are two return codes to validate the job completion status, and those are -

Return Code Description
Last Condition Code (LASTCC)
  • LASTCC provides the return code of the last executed command.
Maximum Condition Code (MAXCC)
  • MAXCC provides the highest return code of the entire JOB execution, which may contain one or more commands.

IDCAMS sets LASTCC at the command level and MAXCC at the step level.

Following are the return codes set by the IDCAMS -

  • 0 (Normal Completion) - Specifies that the functional command successfully finished its processing.
  • 4 (Minor Error) - Specifies processing can continue further. However, a minor error occurred that issued a warning message.
  • 8 (Major Error) - Specifies processing can continue further. However, a more severe error resulted in major command specifications being bypassed.
  • 12 (Logical Error) - Specifies that inconsistent parameters are coded, which causes the entire command to be bypassed.
  • 16 (Severe Error) - Specifies a severe error that causes the entire AMS command stream to be flushed.

Example -


Scenario - Let us take an example of creating ESDS and deleting the same in the same step to demonstrate the LASTCC and MAXCC.

Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKE JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),            
//             NOTIFY=&SYSUID                                           
//************************************************************          
//STEP01   EXEC PGM=IDCAMS                                              
//SYSPRINT DD SYSOUT=*                                                  
//SYSIN    DD  *                                                        
  DEFINE CLUSTER(NAME(MATEPK.TEST.ESDS)  -                              
     RECORDSIZE(47,47)    -                                             
     CYLINDERS(2,1)       -                                             
     CISZ(4096)           -                                             
     VOLUMES(DEVHD4)      -                                             
     NONINDEXED           -                                             
     REUSE)               -                                             
  DATA(NAME(MATEPK.TEST.ESDS.DATA))                                     
  DELETE 'MATEPK.TEST.ESDS'                                             
/*                                                                      
//
**************************** Bottom of Data ****************************

Output -

LASTCC and MAXCC