Commands (for Experienced)


Command Syntax -


IDCAMS utility has multiple predefined commands, and each command is assigned 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]
/*

In the above syntax,

  • 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 comment characters (/*) should start from 2nd column. For example -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//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----+----4----+----5----+----6----+----7--
//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.
  • Comments are allowed in the SYSIN DD.

Type of Commands -


The IDCAMS utility program 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 - creating, deleting, or copying datasets).
  • Modal commands - Used to set the conditional execution for functional commands.

Functional Commands -


The functional commands are -

Command Description
ALTER Alters the existing catalog entries.
BACKUP Creates a backup file or index to tape or disk.
BLDINDEX Builds alternate indexes for existing VSAM files.
CANCEL Cancels a job or job step.
DEFINE Creates catalogs and catalog entries for files, alternate indexes, paths, and VSAM data spaces.
DELETE Deletes catalog entries.
EXPORT Creates a copy of a file for backup or makes a file or user catalog portable to use in another system.
IMPORT Reads a backup copy of a file or makes a file or user catalog previously exported available in another system.
LISTCAT Lists catalog entries.
PRINT Prints VSAM and nonVSAM files.
RECMAP Map a VSAM cluster to a relational structure and later maintain the associated map or view.
REPRO
  • Copies files.
  • Converts sequential and indexed-sequential files to VSAM format.
  • Converts VSAM and indexed-sequential files to sequential format.
  • Creates backup copies of VSAM catalogs.
  • Reloads a VSAM catalog from a backup copy.
RESTORE
  • Writes a file or index from tape/disk to disk.
  • Prints the list of objects backed up.
SNAP
  • Creates a snapshot of entire ESS volumes on which the catalog and its datasets reside.
  • Terminates the relation that was established when creating the snapshot.
VERIFY Provoke a catalog to correctly reflect the end of a file.
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 -


The modal commands are -

Command Description
IF Tests a condition code and executes it according to the test results. IF is followed by THEN and ELSE clauses that specify alternative actions.
DO and END Specify the beginning and ending of functional command lines within a THEN or ELSE clause.
SET Changes condition codes.
PARM Specifies diagnosis tools, syntax checking, and printed output options and changes input record margins.