Commands


IDCAMS utility has multiple predefined commands, and each command is created for a specific purpose. Each command should be coded in one particular format under SYSIN DD to perform the task. The syntax for the IDCAMS commands are -

//SYSIN DD *
  Command   parameter(s) terminator [Continuation Indicator]
/*
  • Command - Specifies the IDCAMS command.
  • Parameters - Specifies the command-specific parameters that are required to complete the task.
  • Terminator - Specifies the end or continuation of the command. The line followed by spaces (without hyphen) is considered as the current line's ending.

Comments -

Any line coded between /* and */ is considered as a comment. The starting characters (/*) should start from 2nd column. For example -

----+----1----+----2----+----3----+
//SYSIN DD *
 DELETE 'MATEPK.TEST.KSDS
 /*DELETE 'MATEPK.TEST.ESDS'*/
/*

Continuation Indicator -

Hyphen (-) at the end of the line preceded by one space represents that the current line has a continuation in the following line. For example -

----+----1----+----2----+----3----+
//SYSIN DD *
 DELETE -
   'MATEPK.TEST.ESDS' 
/*

Guidelines for coding IDCAMS commands -


An important considerations while coding IDCAMS commands -

  • If the command does not fit in one line, command can be continued to more than one line. A hyphen (-) is allowed as a continution character at the last character in the line.
  • A parameter and a subparameter cannot be separated with a hyphen (-). A plus sign (+) should use for this purpose.
  • Coding multiple commands within one job step is allowed. However, each command coding should start in new line.
  • Minimum one space should code between the command, parameters and subparameters.
  • A space or a comma can use to separate sub-parameter values.

Type of Commands -


IDCAMS utility commands are classified into two types based on their usage, and those are -

  • Functional commands - Used to complete the standard functions of IDCAMS. For example - DEFINE, ALTER, BLDINDEX, etc.
  • Modal commands - Used to set the conditional execution for functional commands. For example - IF, SET, etc.

Functional Commands -


CommandDescription
ALTER Changes the attributes of the existing VSAM file.
BLDINDEX Builds alternate indexes for VSAM files.
DEFINE Define the cluster as a whole and the DATA and INDEX components of the cluster.
DELETE Deletes catalogs, VSAM datasets, and non-VSAM datasets.
EXPORT Exports or creates a backup copy of a cluster or an AIX.
IMPORT Imports or restores a cluster, AIX, or catalog from a backup to the original.
LISTCAT Lists catalog entries.
PRINT Print the dataset (VSAM datasets, non-VSAM datasets, and catalogs) contents.
REPRO
  • Copies the records from source to target files.
  • Creates backup copies of VSAM.
  • Reloads a VSAM from a backup copy.
VERIFY Verify the status of the dataset.
RESTORE Writes a file or index from tape/disk to disk.
SNAPCreates a snapshot of entire ESS volumes on which the catalog and its datasets reside.
BACKUP Creates a backup file on tape or disk.
CANCEL Cancels a job or job step.
RECMAPMap a VSAM cluster to a relational structure and later maintain the associated view.
Note!
  • All the above commands can use on VSAM files.
  • However, ALTER, DEFINE, DELETE, LISTCAT, PRINT, and REPRO commands can use on nonVSAM files.

Modal Commands -


CommandDescription
IF Tests a condition code and decides the flow according to the test results.
DO and ENDSpecify the beginning and ending of functional command lines within a THEN or ELSE clause.
SETChanges the condition codes.
PARMSpecifies diagnosis tools, syntax checking, and printed output options and changes input record margins.