ADDRESS IDCAMS

Syntax:

ADDRESS IDCAMS [command [;command]...]

Commands:

IDCAMS commands. IDCAMS commands are documented in the Access Method Services manual for your system's level of DFP or DFSMS.

There are minor restrictions concerning the coding of IDCAMS commands. These are as follows:

  1. The PARM MARGINS command is supported, but should not be used because it can adversely affect the way in which IDCAMS reads subsequent commands. The default values for the LEFTMARGIN and RIGHTMARGIN parameters are 1 and 32760 (the maximum), respectively.
  2. You may not code IDCAMS comments in any command string. If you require comments, code REXX comments. For example:
    "DELETE (KSDS.DATA)"   /* DELETE THIS ONE */
    
  3. You may not use IDCAMS continuation characters in any command string. However, you may (and should) use REXX statement continuations whenever you have a command that won't fit on one source line. For example:
    "LISTC ENTRIES(KSDS.DATA",
    "VRDS.DATA) ALL"
    
  4. It is permissible to execute more than one IDCAMS command per REXX host command. The commands must be separated by a semicolon. The semicolons must be contained within the REXX command string. For example:
    "LISTC ENTRIES(KSDS1); LISTC ENTRIES(KSDS2)"
    
    Note: If you "stack" commands like this, the output will also be stacked.
  5. The IDCAMS IF-THEN-ELSE sequence is supported, but its use is strongly discouraged. If you require control logic between your IDCAMS commands you should use REXX control instructions, which are far more flexible.

Module Name:

SWXIDCMS

Service Description:

ADDRESS IDCAMS is a host command environment. As with other host command environments, you switch to the IDCAMS host command environment using the ADDRESS instruction. To send a command to the host command environment you simply embed a command expression in your program. Because REXX performs expression evaluation on host commands before it invokes the host command processor, you can dynamically construct IDCAMS commands using various REXX arithmetic and string operators.

SYSPRINT output from ADDRESS IDCAMS is directed to a special stem array (See "Returned Information" below).

Returned Information:

The IDCAMS host command environment, like other REXX host command environments, returns a return code in the special variable RC. The possible return values are as follows:
-4
Zero length command string was passed.
-3
IDCAMS host command environment not found. This RC is set by REXX (not by REXXTOOLS) whenever REXX is unsuccessful in locating a host command entry in the host command table of the current REXX environment.
0
Successful execution. Informational messages may have been produced.
4
Some problem was encountered (for example, an entry was not found on a LISTCAT command), but execution continued. Refer to the messages produced by the command for more information.
8
A more severe error was met, and some portion of the command may not have been performed. Refer to the messages produced by the command for more information.
12
The entire command could not be performed.
16
Severe problem encountered.

The IDCAMS host command processor also returns the SYSPRINT output produced by IDCAMS commands. The lines of output are returned in a special array whose stem is "$SWXIDCMS.". The zeroth element ($SWXIDCMS.0) contains the number of lines of SYSPRINT output produced by the most recent IDCAMS host command. If you execute more than one IDCAMS command within a REXX host command expression, the lines of output for the commands will appear, one after another, in the "$SWXIDCMS." array.

Notes:

  1. The SYSPRINT lines contained within the "$SWXIDCMS." array are in "ready-to-print" format. That is, printer control characters appear in the first byte of each record. Use PARSE VAR or SUBSTR to remove these, if you so desire.
  2. The interface performs a REXX drop on the "$SWXIDCMS." stem prior to executing each command string (but not each command within the command string, if there is more than one).
  3. The interface performs a MARGINS command prior to executing each command string. Because of this, the first IDC message in the "$SWXIDCMS." stem array is the "FUNCTION COMPLETED" message for the MARGINS command.

Examples:

  1. Execute a LISTCAT command and print each line to the terminal:
    address idcams "listcat entries(employee) all"
    if rc = 0 then
      do i = 1 to $SWXIDCMS.0
        say substr($SWXIDCMS.i,2)
      end
    
    Notice the use of the REXX SUBSTR function to strip off the carriage control characters on the front of each $SWXIDCMS record. Note also that the LISTCAT command is issued from the ADDRESS instruction itself. This tells REXX to issue the command to IDCAMS, but not to change the current host command environment. If you wanted to change the current host command environment so that subsequent commands would be sent to IDCAMS without using the ADDRESS instruction, you would code:
       address idcams
       "listcat entries(employee) all"
    

© Copyright 1998 by Open Software Technologies, Inc.