ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) ------------------------------------------------------------------------------- onhost PURPOSE Execute CMS commands on an IBM host. SYNTAX +--------+ +------------+ +----------------+ onhost ---| +----+ |---| |---| |---| +-| -d |-+ +- -a alias -+ +- command line -+ ^| -n || || -p || || -s || |+----+| +------+ DESCRIPTION The onhost command uses the host connection created by the hostconnect command to execute commands on the host system. onhost behaves in one of three modes. o command line is not present. This signals full-screen mode. The onhost command sets up full-screen emulation using an unmodified IBM 3270 terminal emulator such as tn or tn3270. (See "hostconnect," onhost.alias, to specify the emulator.) o command line is rewritten and passed to the host for execution. This process is called special command mode. It is controlled by onhost.profil, described below. Host input and output can be redirected, as usual. When the host command completes, a distinguished end-of-command line signals onhost to terminate with the exit code set by the host. o Additional input is simply passed to the host. This is normal line mode. An exception is made if the line begins with a ^(carat) and one of these characters, "1234567890-=abez", which produce the 3270 actions pf1..pf12, pa1, pa2, enter, and clear, so that accidental execution of a full screen application can be controlled in line mode. Note: The shell scans the command line before it is passed to onhost, so you must escape any shell meta-characters. The simplest way to do this is to put the command in quotes. onhost "ls cms:*exec.a" will list all files of type exec in your CMS A-disk directory, whereas Processed August 2, 1991 ONHOST(1c,C) 1 ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) onhost ls cms:*exec.a will typically report a "No match" error from the shell. FLAGS -a [ alias ] The -a alias option uses the host connection made by hostconnect -a alias. It is not necessary to include the alias on every onhost command; the last alias used is assumed. You can display the current alias by specifying onhost -a. -d This option turns on debugging to study the code or track down a problem. The -d option sends debug output to the terminal. The -d1 option sends debug output to the file onhost.debug. -n This option forces normal line mode treatment for command line. -p This option displays a prompt before all host input. Special command mode is indicated by >>, normal line mode by >. -s This option shows the host return code. FULL SCREEN MODE If onhost is invoked without any command, it sets up full-screen mode by informing hostconnect, then it executes tn or tn3270, for example, with the socket address of hostconnect, and disappears. The emulator behaves normally. But when you quit emulation, using control-t, c for tn, for example, hostconnect maintains the host connection for later onhost use. You must log out of the host to drop the connection. SPECIAL COMMAND MODE onhost simulates some aspects of certain AIX commands. Actually, the IBM host portion of onhost does the simulation. The local onhost code simply looks up the command line token in onhost.profil, where the entry determines what is sent to the host. In most cases, a command such as ls is replaced by the string "onhost ls", then sent to the host. You could do the same thing in full-screen mode, for example, by entering "onhost ls". Enter "onhost ?" for a quick reference display. The simulation does not attempt to provide all AIX facilities on CMS. It simply helps you to do cat, ls, and rm, for example, without having to learn CMS. Most of the commands are simulated by a program named onhost exec. This program is written in REXX, an interpretive language, and can be easily modified to extend the scope and number of the commands which it simulates. SPECIAL COMMAND DESCRIPTIONS FOR CMS Several of the following special commands use host file names. These names are distinguished by the cms: prefix for CMS files. A file in CMS has a name and a type, each no longer than eight characters. A disk directory in CMS is Processed August 2, 1991 ONHOST(1c,C) 2 ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) identified by a single letter, called the mode when alone or suffixed with a single digit. So a CMS file with file name fn and file type ft in the disk directory fm is specified by cms:fn.ft.fm. onhost CAT Displays a CMS file on standard output. For example, onhost cat cms:fn.ft.fm Only one file name may appear and there are no options. Pipe the result to "cat -n" for the -n and similar cat options. Files with more than eighty characters per line may contain lines broken at column 80. Processed August 2,1991 ONHOST(1c,C) 3 ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) Use the standard CMS copy command to catenate files into the single file, fn ft fm, for example, onhost copy fn1 ft1 fm1 fn2 ft2 fm2 ... fn ft fm (replace onhost CP Copies files between AIX and the host. These commands copy a file from AIX to CMS, from CMS to AIX, and from CMS to CMS. The files are copied between systems using FTP; see the file transfer section, below, for details. onhost cp test1.pascal cms:test1.pascal.a onhost cp cms:output.data.a output.data onhost cp cms:test1.pascal.a cms:oldtest1.pascal.a The first file is the source. The second file is replaced and carries the current timestamp. onhost DATE Displays the date and time for the local time zone. onhost DF Displays the amount of free space on all accessed CMS disks. The free space on the CMS disk accessed as (disk) s is displayed by onhost df s onhost HEAD Displays a file on standard output. The command onhost head -n cms:fn.ft.fm displays the first n lines of the CMS file. Only one file name can appear. If -n is omitted, then the default value of 10 is used. Files with more than eighty characters per line may contain lines broken at column 80. onhost LS Lists the contents of a CMS disk directory. The contents of the CMS disk accessed as mode x is displayed by onhost ls ../x The -l option gives a long form of listing. The -t option orders the result according to time, with the newest file at the head of the list. The -r option reverses the order. The options can be combined, for example, -lrt. Files may be listed which match patterns allowed by the CMS listfile command. Briefly, an asterisk represents any number of characters, and a percent represents any single character. For example, all files of type FORTRAN in any directory with names beginning with a and ending with z onhost "ls -l cms:a*z.fortran.*" Processed August 2, 1991 ONHOST(1c,C) 4 ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) The C-shell type of pattern matching using [ ] and the C-Shell use of { } is not supported. The format and main results are similar to those of the AIX ls command but some of the results differ. However, the command does show what files exist, whether they can be read or written, and their (approximate) size and date. onhost RM Removes a CMS file. onhost TAIL Displays the end of a file in a manner similar to onhost head. onhost WHO Lists users of the host system running with terminals con- nected. The user ID and terminal is displayed. The command will not show how long a terminal has been logged in as this information is not available. "onhost who am i" will show your user ID and terminal. onhost WRITE Writes a message to a user of the host system. onhost write user message text sends the message text to the user. Unlike AIX, it does not warn the recipient or wait for you to type the message. ONHOST.PROFIL onhost.profil controls simple rewriting of onhost special commands. It is found in one of the directories specified in your path. There is a default onhost.profil in one of the standard directories. This file has entries of the form: www sss where www is a word and sss is a string. If you enter onhost www xxx and the word, www, is found in onhost.profil, then www is replaced by the string sss, and sss xxx is sent to the host. If www is not found, then onhost www xxx is sent to the host. The syntax for the $FTPAUPW in this file is "IP-ADDR USERID PASSWORD WORKING-DIRECTORY". FILE TRANSFER The ftp command, at the host, is used for file transfer. The CMS console is spooled to a file named cms:onhostcp.ftptrace.a during file transfer. The CMS onhostcp exec checks this file to determine if the file was copied. If the onhost cp command returns a non-zero return code, you can cat this trace file for details. The onhost cp command is not different than any other special command. However, the address of the local system, the user ID, and the password must be supplied to the host system so ftp can connect to the local system. This information is needed on every file transfer request. The token, $FTPAUPW, Processed August 2, 1991 ONHOST(1c,C) 5 ONHOST(1c,C) AIX TCP/IP User's Guide ONHOST(1c,C) found in onhost.profil, is replaced by the AIX address, user ID, password, and working directory before the special command goes to the host. TROUBLE It is difficult for onhost to properly handle the many situations which can arise in host communication. If a host command takes too long (taking communication delays into account) or behaves poorly, then enter control-c (or your escape character) to interrupt onhost. If onhost is waiting for your input, it will terminate. If onhost is waiting for the host to read, the interrupt will force a line to the host, or if no line is present, you will be prompted for a line or full-screen mode. The host may have the console spooled with no output, as indicated by no display of entered lines; enter "sp cons stop" to clear this condition. If you can not log out of the host system, then kill hostconnect. Do not use kill -9! (See "hostconnect" for additional information.) NOTE To make sure onhost CP command work correctly, it is necessary to : Set LDRTBLS to a larger number in PROFILE EXEC and $FTPAUPW in $HOME/.onhost .profil with correct syntax. RELATED INFORMATION In this book: "hostconnect" Processed August 2, 1991 ONHOST(1c,C) 6