Run Remote Command (RUNRMTCMD)
Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Run Remote Command (RUNRMTCMD) command, also known as AREXEC when an SNA address is specified for the remote location name, allows users to run a command on a remote system that is running the target portion of this function.
The target portion of this function can be:
- a REXECD (remote execution) daemon, if you specify *IP for the address type
- an AREXECD (APPC remote execution) daemon, if you specify *SNA for the address type.
When the command is sent to the remote system, the local system waits for the command to complete and the output from the remote command will be placed in a spooled file.
Top |
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
CMD | Command | Character value | Required, Positional 1 |
RMTLOCNAME | Remote location | Element list | Required, Positional 2 |
Element 1: Name or address | Character value | ||
Element 2: Type | *SNA, *IP | ||
RMTUSER | Remote user ID | Character value, *NONE, *CURRENT | Optional |
RMTPWD | Remote password | Character value, *NONE | Optional |
MODE | Mode | Communications name, *NETATR | Optional |
CCSID | Coded character set ID | 1-65533, *CALC | Optional |
WAITTIME | Wait time (in seconds) | 2-3600, *NOMAX, *NOWAIT | Optional |
Top |
Command (CMD)
Specifies a character string of up to 2000 characters that represents a command to be run on the target system. The maximum length supported by the target system may be less than 2000 characters. If you specify a command string that exceeds the maximum length supported by the target system, the command will fail.
The command must be enclosed in single quotation marks if it contains embedded blanks or special characters.
This is a required parameter.
Note: The normal rule of pairing single quotation marks in quoted strings on the local system must be doubled when the same string is submitted to a remote system on this CMD parameter; this is required because you are coding a quoted string within another quoted string. Therefore, when this parameter is being coded, wherever a single quotation mark would normally be paired with another single quotation mark, each occurrence in the inside set of single quotation marks must be doubled to produce the same results at the target system.
Top |
Remote location (RMTLOCNAME)
Specifies the target system and the type of connection used to connect to the target system.
This is a required parameter.
Element 1: Name or address
- character-value
- The syntax for this element is dependent on the value specified for the second element:
- When the address type is *SNA, specify the name of the target system using the format nnnnnnnn.cccccccc, where nnnnnnnn is the network identifier (ID) and cccccccc is the remote location name. If no network ID is specified, the network attributes are used to determine the default network ID.
- When the address type is *IP, specify a host name or an internet address to identify the target system. Host names must follow these conventions:
- The first character must be either A through Z or 0 through 9.
- The last character must be either A through Z, 0 through 9, or a period (.).
- Blanks ( ) are not allowed.
- The special characters, period (.), underscore (_), and minus (-) are allowed.
- Parts of the name separated by periods (.) cannot exceed 63 characters in length.
Note: Each part of the name separated by periods (.) must begin and end with an English alphabetic character or a numeric character.
- Names must be from 1 to 255 characters in length.
The IPv4 address is specified in the form nnn.nnn.nnn.nnn where nnn is a decimal number ranging from 0 through 255. An IPv4 Internet address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address.
The IPv6 address is specified in the form x:x:x:x:x:x:x:x where x is a hexadecimal number ranging from 0 through X'FFFF'. "::" may be used once in the IPv6 address to indicate one or more groups of 16 bits of zeros. The "::" may be used to compress leading, imbedded, or trailing zeros in the address.
If the Internet address is entered from a command line, the address must be enclosed in single quotation marks.
Element 2: Type
- *SNA
- The target system is accessed using a Systems Network Architecture (SNA) address and protocol.
- *IP
- The target system is found using a host name or an internet address over a TCP/IP connection.
Top |
Remote user ID (RMTUSER)
Specifies the user identifier (ID) for the target system. If a user ID is specified for this parameter and password security is active on the target system, RMTPWD(*NONE) is not valid.
- *NONE
- No user ID is sent. If security on the target system is configured to require a user ID, the command will fail.
- *CURRENT
- The user ID of the job (signed-on user) using this command is sent.
- character-value
- Specify a user ID to use that exists on the target system. If a user ID is specified and password security is active on the target system, a password must be specified.
Top |
Remote password (RMTPWD)
Specifies the password sent to the target system.
- *NONE
- The system does not send a password. If a user identifier (ID) is specified on the RMTUSER parameter and password security is active on the target system, the command will fail.
- character-value
- Specify a password sent to the target system to verify the sign-on of the user ID specified in the RMTUSER parameter. If an address type of *IP is specified, the password sent is not substituted across the communication line; if *SNA is specified, the password may or may not be substituted, depending on whether the remote system supports password substitution.
Top |
Mode (MODE)
Specifies the name of the mode to be used when sending the command to the target system. This parameter is only allowed when the address type value is *SNA.
- *NETATR
- The mode in the network attributes is used.
- communications-name
- Specify the name of the mode object to use. Specify BLANK for a mode name consisting of eight blank characters.
Note: SNASVCMG and CPSVCMG are reserved names and cannot be specified.
Top |
Coded character set ID (CCSID)
Specifies the coded character set identifier (CCSID) that will be used for conversions. When data is sent to the remote system, the data is converted using the CCSID of the job to the CCSID specified on the CCSID parameter. Similarly, when data is received from the remote system, the data is converted from the CCSID that was specified on the CCSID parameter to the CCSID of the job.
Restrictions:
- If the CCSID of the job is 65535 (indicating no conversion), the default CCSID of the job will be used.
- This command uses the round-trip conversion method when converting data from the source CCSID to the target CCSID and back. For more information about CCSID conversion methods, see the National Language Support book.
- *CALC
- The CCSID value sent from the target system is used if it is available. If a value is not provided from the target system, a default value of 00819 (ISO 8859-1 8-bit ASCII) will be used.
- 1-65533
- Specify the CCSID value to use. This value is validated to ensure a valid CCSID has been requested.
Top |
Wait time (in seconds) (WAITTIME)
Specifies the time in seconds to wait for the return (echo) before declaring the remote location to be unreachable.
- *NOMAX
- The system waits forever.
- *NOWAIT
- The system returns immediately if there is a connection ready and available.
- 2-3600
- Specify the number of seconds to wait.
Top |
Examples
Example 1: Run Remote Command (RUNRMTCMD) Using SNA Address Type
RUNRMTCMD CMD('dir') RMTLOCNAME(APPN.RMTSYS *SNA)
This command runs the 'dir' command on the system specified by 'RMTLOCNAME' using an SNA address type.
Example 2: Run Remote Command (AREXEC) Using SNA Address Type
AREXEC CMD('dir') RMTLOCNAME(APPN.RMTSYS)
This command is equivalent to the command in example 1.
Example 3: Run Remote Command Using IP Address Type and Host Name to Specify Target System
RUNRMTCMD CMD('ls') RMTLOCNAME(MYSYS.NET1.LOCAL *IP)
This command runs the 'ls' command on the system specified by host name MYSYS.NET1.LOCAL.
Example 4: Run Remote Command Using IP Address Type and Internet Address to Specify Target System
RUNRMTCMD CMD('ls') RMTLOCNAME('9.5.1.94' *IP)
This command runs the 'ls' command on the system specified by internet address '9.5.1.94'.
Example 5: Run Remote Command With Multiple Commands Using IP Address Type and Internet Address to Specify Target System
RUNRMTCMD CMD('ls; cat myfile; date') RMTLOCNAME('9.5.1.94' *IP)
This command runs multiple commands, first 'ls', then 'cat myfile', then 'date' on system specified by internet address '9.5.1.94'.
Example 6: Run Remote Command With a Wait Time Expiration Value
RUNRMTCMD CMD('dir') RMTLOCNAME(APPN.RMTSYS *SNA) WAITTIME(15)
This command runs the 'dir' command on the specified system. The maximum wait time for the remote location to respond is 15 seconds. A wait time is only allowed when using *SNA address type value.
Example 7: Run Remote Command Using IP Address Type and IPv6 Address to Specify Target System
RUNRMTCMD CMD('ls') RMTLOCNAME('2001:D88::1' *IP)
This command runs the 'ls' command on the system specified by IPv6 address '2001:D88::1'.
Top |
Error messages
*ESCAPE Messages
- CPF91CB
- Problems occurred on the command, but the command completed.
- CPF91CC
- Command did not complete successfully.
- CPF91CF
- Command failed on remote system.
- CPF91C9
- MODE value not allowed when *IP specified for RMTLOCNAME address type.
Top |