IDCAMS

Shadow REXXTOOLS includes a host comand environment for issuing IDCAMS commands, and functions that make common IDCAMS-related operations easier. Using the REXXTOOLS IDCAMS interfaces you can:

Address IDCAMS IDCAMS Functions
IDCAMS Return Codes Service Descriptions

Address IDCAMS

The most generalized IDCAMS interface provided by REXXTOOLS is the IDCAMS host command environment. This interface permits IDCAMS commands to be embedded directly in your REXX programs. As in other host command environments, IDCAMS commands are REXX expressions that resolve to a string. The expressions can be as simple as a literal string, like this:
"listc lvl('sys1.rexxtool') nonvsam volume"
Or they can be complex REXX expressions, like this:
"define "||type||DataKeywords||GetIndexKW(type)
To direct commands to the IDCAMS host command environment, you use the REXX ADDRESS instruction. If you want to send more than one command to IDCAMS, code the ADDRESS instruction on a line by itself. For example:
address idcams
"define cluster."
"define cluster."
"listc."
If you want to send just one command to IDCAMS without changing the current host command environment, you code the command immediately after the ADDRESS instruction, like this:
address idcams "listc lvl('rexxtool')"
The IDCAMS host command environment returns IDCAMS messages in stem variables of the form:
$SWXIDCMS.n
Where n is a numeric subscript.

The number of variables returned is contained in the "zeroth" variable, $SWXIDCMS.0. So, for example, to display messages returned from a LISTC command, you would code something like the following:

/* REXX */
address idcams
"listc lvl('rexxtool') volume"
if rc = 0 then
  do i = 1 to $swxidcms.0
    say $swxidcms.i
  end
Notes:
  1. Complete IDCAMS command information can be found in the Access Method Services manual for your system's level of DFP or DFSMS. Additional IDCAMS information can be found in the Using Data Sets manual for your system's level of DFP or DFSMS.
  2. The IDCAMS host command environment uses the level of IDCAMS that is available on your system (REXXTOOLS issues an undirected LOAD macro to obtain its address). Because of this, ADDRESS IDCAMS will handle commands for VSAM or ICF catalogs.

IDCAMS Functions

REXXTOOLS provides the following IDCAMS functions:
DSNDEL
a function for deleting data sets.
LISTC
a function for listing catalog information. The information is returned in a more "programmer friendly" format than is provided by the raw LISTC command.

You use the IDCAMS functions as you would use any other REXX function. Simply code references to them in your REXX programs. For example, to delete a data set using DSNDEL you could code:

/* REXX */
if dsndel("'us01.user.data'") = 0 then
  say 'Data set deleted.'
else do
  say 'Delete failed.'
  do i = 1 to $swxidcms.0
    say $swxidcms.i
  end
end
Alternatively, you can use the REXX CALL instruction or PARSE VALUE, as is shown below:
parse value listc("sys1.rexxtool",,"v") with rc dsncount
if rc = 0 then do
  do i = 1 to dsncount
    parse pull dsname volser devtype .
    say dsname volser devtype
  end
end
Notes:
  1. The DSNDEL and LISTC functions are not implemented over ADDRESS IDCAMS. They are separate assembler programs. You do not need to ensure that ADDRESS IDCAMS is present before issuing a call to either of these functions.
  2. All "IDC" messages produced as a result of running an IDCAMS function are stored in the $SWXIDCMS. stem variable array.
  3. The primary argument to the LISTC function is data set level. Because this is not truly a data set name, the LISTC function will not automatically append a userid to it. The DSNDEL's primary argument is a data set name (or data set name pattern), and it will automatically append a userid, if the data set name argument is not enclosed in single quotes.

IDCAMS Return Codes

The IDCAMS host command environment returns the IDCAMS return code in the RC variable. The IDCAMS functions do not set the RC variable. They return as their value the IDCAMS return code.

A zero return code always indicates successful execution. Non-zero return codes indicate partial or complete command failure. The precise meaning of non-zero IDCAMS return codes is documented in the Access Method Services manual for your system's level of DFP or DFSMS. However, non-zero return codes are almost always accompanied by explanatory "IDC" messages. These messages can be obtained by displaying the contents of the $SWXIDCMS array.

Service Descriptions

The sections that follow describe the syntax and operation of the IDCAMS services.

ADDRESS IDCAMS

DSNDEL

LISTC


© Copyright 1998 by Open Software Technologies, Inc.