RSH command—Execute a command on a remote host and receive the results on your local host
Purpose
The Remote Shell Protocol (RSH) is a remote execution client similar to REXEC that enables you to execute a command on a remote host and receive the results on your local host.
You can use the RSH command from TSO or as a batch job.
Format
Notes:
- The parameters for the RSH command could be case sensitive, depending on the remote host you are targeting.
- The RSH command uses the MESSAGECASE setting in the TCPIP.DATA file to determine whether messages are issued in uppercase or mixed case characters.
Parameters
- -?
- Lists the valid parameters for the RSH command.
- -b tab
- Specifies the Tab setting. Valid values are in the range 1 - 12. The default value is 1.
- -d
- Turns on debug tracing.
- -l user/password
- Specifies the remote user ID and password.
You must enter the slash (/) between the user ID and password if the target system is MVS™. The character you must use can vary, depending on the target host. For VM hosts, you should use an @ character.
- -s port
- Specifies the server port. The default is 514.
- foreign_host
- Specifies the name or IP address of the remote host on which you are issuing the command. When you are using IPv6 link-local addresses, you can provide scope information along with the name or IP address, as described in the support for scope information in the z/OS Communications Server: IPv6 Network and Application Design Guide.
- command
- Specifies the command to be executed on the remote host.
Examples
- Execute a command on a remote host and receive the results on
your local host:
READY rsh -l user28/user28 mvs1 lista SYS1.HELP BUILD.HELP GIM.SGIMCLS0 ISR.V3R5M0.ISRCLIB DSN230.DSNCLIST DSN230.NEW.DSNCLIST DSN230.DSNAMACS USER.CLIST BUILD.CLIST SYS1.HRFCLST ISP.V3R5M0.ISPEXEC READY
- Use JCL to submit the RSH command as a batch job:
//USER28 JOB ,CARTER,MSGLEVEL=(1,1),NOTIFY=USER28 //RSH31 EXEC PGM=RSH, // REGION=800K, // PARM='/-d -l user28/user28 mvs1 lista' //SYSPRINT DD SYSOUT=* //SYSTCPD DD DSN=USER28.TCPIP.DATA,DISP=SHR //SYSIN DD DUMMY
Usage
- You must enter the required parameters on the command line. The RSH command does not prompt you for missing parameters, or enable you to use the NETRC.DATA set.
- A condition code 1 is set when an RSH batch request encounters an error condition in which the client cannot connect to TCP/IP or when the host name cannot be resolved.
- When RSH issues a command to a remote system and retrieves the output for presentation to the user, it expects a line of output to be no more than 32767 bytes. A warning message is issued when the size of the output line approaches this threshold. This condition has no effect on the job running on the remote host.
- The tab setting is used exclusively by the client and is not forwarded to the server. The tab setting value determines the alignment of the output. If a tab character is included in the output data stream, blank characters are included in the output up to the next tab setting. The processing is the same whether the output is displayed or written to a data set.