Commands (for Beginners)


Command Syntax -


IDCAMS utility has multiple predefined commands, 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-related predefined parameters.
  • Terminator - Specifies the end or continuation of the command.

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 and a hyphen (-) should be used as a continution character.
  • 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.

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.
BLDINDEX Builds alternate indexes for existing VSAM files.
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.
REPRO
  • Copies files.
  • Converts sequential and indexed-sequential files to VSAM format.
  • Converts VSAM and indexed-sequential files to sequential format.
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..THEN.. ELSE Tests a condition code and executes it according to the test results.
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.