CMD Type(MVS) — Issue MVS command with response
This command issues MVS commands. A response is returned to the issuing EXEC.
Command | Parameters |
---|---|
CMD | 'MVS_command' [RESPONSE(*|MessageID)] [COUNT|LINES(1|n)] [DELAY|DLY(nnnnn)] [WAIT(30|n)] [NAME(xxxxxxxx)] [ALL] [ALLWAIT(1 - 9999)] [DEBUG] [TYPE(MVS)] [STEM ( )] [ENDMSG( )] |
Additonal usage notes
The following describes additional considerations when using this command.
LOCAL variables
Command output is placed in LOCAL variables LINE1 through LINEnnnn, where nnnn is the last line (variable IMFNOL contains the value of nnnn ). These variables must be retrieved by using the VGET command before they can be used.
However, for REXX EXECs, you can specify the optional STEM parameter. If you specify the STEM parameter, the output is returned in REXX stem TSO variables. Refer to the description of the STEM parameter in the following table for more information.
Variables
The variable IMFCNAME contains the MVS console name that was used to issue the command.
The variable IMFRC contains the return code given by the MVS MGCRE macro (which is used to issue the command). This return code is meaningful only when issuing the MVS START command. Do not inspect this variable if you are not issuing the MVS START command.
When you issue the MVS START command and if IMFRC is zero, the variable IMFCASID contains the ASID (decimal) of the started address space and IMFCSTKN contains the STOKEN (16 hexadecimal characters).
Console IDs
All consoles have a four-byte console ID and an eight-byte console name. See Customizing-BMC-AMI-Ops-Automation-after-installation for more information about MVS console considerations.
Console names
BMC AMI Ops Automation activates a console named ssid0000 for all IMFEXEC MVS commands that do not require a response. The console named ssid0000 can be renamed with the BBPARM member BBISSP00 parameter CONSQUAL.
BMC AMI OpsA activates additional consoles named ssidqqnn where the number nn can range in value from 1 to the value that is specified by the BBPARM member BBISSP00 CONSOLES parameter.
For example if CONSOLES=4 is specified, BMC AMI OpsA activates the following response consoles named:
- ssid0001
- ssid0002
- ssid0003
- ssid0004
Using the COUNT keyword
BMC AMI OpsA always activates the 'no' response console named ssid0000. By default, all commands that specify COUNT(0) are issued from the ssid0000 console.
When you issue commands with COUNT(greater than zero) or let COUNT use the default value of 1, BMC AMI OpsA selects any one of the available response consoles named ssidnnnn and issues the command from it and inspects WTOs sent to this console for responses to your command.
To issue an MVS command with a response, use the following format where COUNT(0) is specified:
Command | Parameters | Notes |
---|---|---|
‘MVS_command’ | Specifies the MVS command to be issued | The maximum length of an MVS command is 126 characters. |
RESPONSE | Specifies the message ID(s) expected for response | The default is an asterisk (*), which means any message. You can specify up to 8 message IDs, separated by commas, each up to 16 characters long. Wild cards are allowed. If RESPONSE(*) is specified, the EXEC picks up all messages from the selected MVS console. If there are messages that are responses to previous commands on the same MVS console, it is recommended that RESPONSE is coded for the MSG ID. |
COUNT|LINES | Specifies the number of response lines to be retrieved | Default is 1. You may specify from 0 through 9999. A Multi Line WTO (MLWTO) is counted as one line (even though it may be composed of many lines, as in some VTAM command responses). When you specify COUNT(0) with the IMFEXEC CMD ‘MVS_command’ in an EXEC, it means that this EXEC is not expecting a response from the MVS command that is issued. BMC recommends using this specification instead of using the IMFEXEC CMD (without response) command. |
DELAY|DLY | Specifies that the command executes in nnnnn seconds of time | Valid values are 0 to 99999 seconds. The default value is 0 seconds, which means the command is executed with no delay. In addition, the DELAY|DLY parameter includes the following conditions:
|
WAIT | Specifies the length of time to wait for all response lines to arrive | Default is 30 seconds. You may specify from 5 through 999 seconds. |
ALL | Specifies the retrieve all responses | This parameter causes all other criteria to be ignored and to wait for further responses as long as responses continue to arrive within half-second intervals. |
ALLWAIT | Specifies the wait interval | Specify an interval to wait from 1 to 9999 seconds. ALLWAIT allows CMD processing to continue waiting in intervals (specified in seconds) until no responses are received within an interval of that length. If at least one response is received in that interval, processing continues for an additional interval. This processing is repeated until no responses are received within an interval, which may result in added wait time. Therefore small intervals of 1-5 are recommended: ALLWAIT is only valid when ALL is specified. |
NAME | Specifies the valid MVS console name | Use this parameter if the command must be issued from a specific MVS console name. When the COUNT(parameter ) has a setting greater than zero (0) such as when the default of 1 is used, the NAME parameter must specify a currently inactive or undefined MVS console name; this console name must not be in use by any other jobs. BMC AMI OpsA requires exclusive control of the MVS console to read the command responses. If the COUNT(0) (which means that responses are not required), the NAME( ) parameter can specify any MVS console name, active or inactive or undefined, and even specify consoles that are currently owned by BMC AMI OpsA or another program. When you specify COUNT(0), the NAME keyword can specify a BMC AMI OpsA response console name such as ssid0001, ssid0002, and so on. To use the same console name as an earlier IMFEXEC CMD command that was issued in the same EXEC, specify the variable name IMFCNAME. Refer to Example 4. When command responses are expected, one of the following things can happen (depending on the state of the console of the console name you specified):
The NAME and CONSOLE parameters cannot be used together. |
DEBUG | Issues debugging messages | This command is used for problem diagnosis. |
TYPE | Specifies the type of command | Specify MVS to issue MVS commands. The default command type is MVS. |
STEM | Specifies the command responses are returned in REXX stem TSO variables where the value of stem.0 resolves to the number of lines returned | Specify a stem root name for the REXX stem variable. In addition:
Note: This parameter is valid only for REXX EXECs. It does not work in CLISTs. If the stem name provided ends in a period (.), BMC AMI OpsA processing ignores the period. For example, specifying STEM(MYVAR.) produces the same result as specifying STEM(MYVAR). Using this parameter overrides the creation of LINEn variables in the LOCAL variable pool. The REXX stem variable is only defined as a TSO variable. If you want to use the variables as LOCAL variables, you must first use IMFEXEC VPUT to move these variables to the LOCAL pool. These REXX stem variables conform to all TSO/E REXX coding standards for stem variables. |
ENDMSG | Specifies the one to eight words where each word can be one to sixteen characters, separated by blanks or commas | Use the ENDMSG parameter when you know a specific message ID is available and indicates the end of the WTO Only single line WTOs and the major line of multi-line WTOs are inspected for the ENDMSG() parameter. The minor lines of MLWTOs are not inspected. If none of the WTOs have a message ID that match the ENDMSG parameter, the IMFEXEC CMD ends based on other parameters such as LINES() or WAIT(). The command performs as if the ENDMSG parameter had not been specified. If the RESPONSE() parameter is specified, you can specify ENDMSG() and specify words that are not in specified with the RESPONSE parameter. This means the ending message ID does not have to be one of the WTOs that are returned in the LINEnnnn variables. |
Condition codes are listed in the following table:
Value | Description |
---|---|
0 | Command responded within WAIT time. |
4 | Command partially responded within WAIT time. |
8 | No reply has been received; WAIT time has expired. Check whether the response WTOs have inadvertently been suppressed. The SYSLOG MPF Flags have an indicator showing whether the WTO has been suppressed by a subsystem (for example, by an BMC AMI OpsA Rule). In the following example syslog, the MPF flags are 000A0294. The x'04' bit in the fourth byte indicates the WTO was suppressed. These MPF flags are described in the HCLREQFL field in SYS1.AMODGEN(IHAHCLOG) and also in the IBM MVS publication z/OS MVS Planning: Operations section titled "SYSLOG MPF flags". N 4000000 SJSC 21299 07:03:18.22 J0502638 000A0294 $HASP395 C864181J ENDED - RC=0000 |
16 | Command text is greater than 121 characters. |
20 | Severe error occurred; see short message text for more information. |
Example 1
This EXEC demonstrates how to issue a VTAM command with response.
PARSE ARG EXNAME .
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID''"
"IMFEXEC CMD 'D NET,CDRMS' RESPONSE(IST350I)"
"IMFEXEC MSG '.'EXNAME 'IMFNOL='IMFNOL 'CC='IMFCC''"
DO I=1 TO IMFNOL
"IMFEXEC VGET LINE'I 'LOCAL"
"IMFEXEC MSG '.'EXNAME 'LINE'I 'LENGTH='LENGTH(VALUE('LINE'I))''"
"IMFEXEC MSG '.'EXNAME VALUE('LINE'I)''"
END
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID 'ENDED'"
This example shows that results are more reliable when JES2 returns responses as multiline WTOs. Note that the default COUNT value is 1.
IMFEXEC MSG '.&EXNAME EID=&IMFEID STARTED'
/* request JES2 responses in multi-line WTO format */
IMFEXEC CMD '$DI,L=Z' RESP($HASP636)
IMFEXEC MSG '.&EXNAME NOL=&IMFNOL CC=&IMFCC'
SET &I = 0
DO WHILE &I < &IMFNOL
SET &I= &I + 1
IMFEXEC VGET LINE&I LOCAL
IMFEXEC MSG '.LINE&I = &SYSNSUB(2,&&LINE&I)'
END
IMFEXEC MSG '.&EXNAME EID=&IMFEID ENDED'
Example 2
This REXX EXEC demonstrates how to issue a JES2 command with response.
PARSE ARG EXNAME .
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID''"
"IMFEXEC CMD '$DJ1-999,L=Z' RESPONSE($HASP636)"
"IMFEXEC MSG '.'EXNAME 'IMFNOL='IMFNOL 'CC='IMFCC''"
DO I=1 TO IMFNOL
"IMFEXEC VGET LINE'I 'LOCAL"
"IMFEXEC MSG '.'EXNAME 'LINE'I 'LENGTH='LENGTH(VALUE('LINE'I))''"
"IMFEXEC MSG '.'EXNAME VALUE('LINE'I)''"
END
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID 'ENDED'"
Example 3
The following example EXEC is a duplicate of the EXEC in Example 1 but shows the STEM parameter specified.
PARSE ARG EXNAME .
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID''"
"IMFEXEC CMD 'D NET,CDRMS' RESPONSE(IST350I) STEM(WORK)"
"IMFEXEC MSG '.'EXNAME 'WORK.0='WORK.0 'CC='IMFCC''"
DO I=1 TO WORK.0
"IMFEXEC MSG '.'EXNAME 'WORK.'I 'LENGTH='LENGTH(WORK.I)''"
"IMFEXEC MSG '.'EXNAME WORK.I''"
END
"IMFEXEC MSG '.'EXNAME 'EID='IMFEID 'ENDED''
Example 4
The following example shows how to issue MVS commands from the same console.
The first command is issued with the IMFEXEC CMD that will be issued from any available BMC AMI OpsA response console. The variable IMFCNAME contains the name of the console that is selected.
"IMFEXEC CMD 'f cics,cesn userid pswd' TYPE(MVS)"
/* Use any available console that AO has */
/* check response from CICS signon transaction */
"IMFEXEC CMD 'f cics,my transaction' TYPE(mvs) NAME('imfcname')"
/* Issue the subsequent command on the same console as the first command */
/* Local variable IMFCNAME at the end of IMFEXEC CMD contains the console name used */
/* check responses from the transaction */
/* logoff console from CICS */
"IMFEXEC CMD 'f cics,cesf' TYPE(mvs) NAME('imfcname')"
/* Ensure sure you continue to use the same console*/
/* This is only valid if you had no intervening IMFEXEC CMD statements */
/* You can save the console name in a TSO variable to ensure it remains valid */
Example 5
The following example EXEC shows how to retrieve all WTOs (regardless of their message IDs) up to message ID AA010I using the ENDMSG parameter.
Examples to retrieve all WTOs (no matter what message ID) up to message ID AA0101I using ENDMSG()
*/
"IMFEXEC CMD 'F AO,.D A' TYPE(MVS) COUNT(99)' ,
'ENDMSG(AA0101I)'
"IMFEXEC CMD 'F AO,.D A' TYPE(MVS) ALL ENDMSG(AA0101I)"
"IMFEXEC CMD 'F AO,.D A' TYPE(MVS) ALL ALLWAIT(30)ENDMSG(AA0101I)"
/* rexx
Example to retrieve all WTOs with message IDs IM9* up to message ID AA0101I or AA0104I whichever appears first
*/
"IMFEXEC CMD 'F AO,.D A' TYPE(MVS) RESPONSE(IM9) COUNT(99)' ,
'ENDMSG(AA0103I,AA0104I)"
Related topic