| Address IDCAMS | IDCAMS Functions |
| IDCAMS Return Codes | Service Descriptions |
"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.nWhere 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:
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:
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.