z/OS Communications Server: IP User's Guide and Commands
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF

REXEC command—Execute a command on the remote host and receive the results on your local host

z/OS Communications Server: IP User's Guide and Commands


Use the REXEC command to execute a command on the remote host and receive the results on the local host.


Read syntax diagramSkip visual syntax diagram
          '- -?-'  '- -b tab-'  '- -d-'  '- -m-'  '- -n-'   

                                      .- -s 512--.   
   '- -l user_id-'  '- -p password-'  '- -s port-'   

   '- -t --dataset_name-'                          

Restriction: The REXEC parameters -b, -d, -l, -m, -n, -p, -s, and -t are case sensitive and must be entered in lowercase letters. The user_id and password parameters might be case sensitive, depending on the operating system of the remote host.


Displays the help message.
-b tab
Specifies the Tab setting. Valid values are in the range 1 - 12 and the default value is 1.
Activates debug tracing.
Specifies that the machine control character (X'09') is added to the beginning of the output lines for the data sets that are associated with the SYSPRINT or OUTPUT DD cards and have the machine control attribute. When you use this parameter, it should be the first parameter that is passed to REXEC so that all output lines are changed.
Prevents automatic logon, if the same foreign host name is defined in the NETRC data set.
-l user_id
Specifies the user ID on the foreign host.
-p password
Specifies the password for the user ID on the foreign host.
-s port
Specifies the TCP port number of the REXEC server on the foreign host. The default, 512, is the port number defined in /etc/services.
-t tran_table
Specifies the data set name of a translation table to be used. The search order when the -t parameter is specified:
If this data set is not found, REXEC terminates with message EZA4805I.
Note: If the -t parameter is not specified on the invocation of the REXEC command, a hardcoded default table is used that is identical to the STANDARD member in the SEZATCPX data set.
Specifies the name or IP address of the foreign host to which you are sending the REXEC command. Specify the foreign host by its host name or IP address. When you are using IPv6 link-local addresses, you can provide scope information along with the host name or IP address, as described in the support for scope information in the z/OS Communications Server: IPv6 Network and Application Design Guide.
Specifies the command to be executed on the remote host.


Use the REXEC command without using NETRC.DATA:
 READY  rexec -l user28 -p user28 -s 512 mvs1 lista


  • If you omit the user_id, the password, or both when entering the REXEC command, the system prompts you to supply the parameters, if the foreign host is not specified with a user ID password in the NETRC data set.
  • When you issue a command that is to be executed on the remote host, do not place the command in quotation marks. Doing so can result in unexpected results.
    Note: There is no such restriction when using the z/OS UNIX orexec command.
  • The condition code 12 is set when an REXEC batch request encounters one of the following error conditions:
    • The client cannot connect to TCP/IP.
    • The host name cannot be resolved.
    • The translation table cannot be loaded.
  • When REXEC 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.

Go to the previous page Go to the next page

Copyright IBM Corporation 1990, 2013
This information center is Built on Eclipse™ ( www.eclipse.org ).