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 server users to run a command on a remote system that is running the target portion of this function, AREXECD (APPC remote executing) daemon.
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 |
Keyword | Description | Choices | Notes |
---|---|---|---|
CMD | Command | Character value | Required, Positional 1 |
RMTLOCNAME | Remote location | Character value | Required, Positional 2 |
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 |
Specifies a character string of up to 2000 characters that represents a command that is 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 apostrophes if it contains embedded blanks or special characters.
Note: The normal rule of pairing apostrophes 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 the user is coding a quoted string within another quoted string. Therefore, when this parameter is being coded, wherever a single apostrophe would normally be paired with another apostrophe, each occurrence in the inside set of apostrophes must be doubled to produce the same results at the target system.
Top |
Specifies the remote location to connect with. Specify the remote location name using the format nnnnnnnn.cccccccc, where nnnnnnnn is the network identifier (ID) and cccccccc is the remote location name. If only the remote location name is specified, the local network ID (LCLNETID) network attribute is used as the value of the network identifier (ID).
Top |
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.
The possible values are:
Top |
Specifies the password sent to the target system.
The possible values are:
Top |
Specifies the name of the mode to be used for the APPC conversation.
The possible values are:
Note: SNASVCMG and CPSVCMG are reserved names and cannot be specified.
Top |
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:
The possible values are:
Top |
Specifies the time in seconds to wait for the return (echo) before declaring the remote location to be unreachable.
The possible values are:
Top |
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.
Top |
*ESCAPE Messages
Top |