c3270(1) | General Commands Manual | c3270(1) |
c3270 - curses-based IBM host access tool
c3270 [options] [host]
c3270 [options] session-file.c3270
c3270 opens a telnet connection to an IBM host in a console window. It implements RFCs 2355 (TN3270E), 1576 (TN3270) and 1646 (LU name selection), and supports IND$FILE file transfer. If the console is capable of displaying colors, then c3270 emulates an IBM 3279. Otherwise, it emulates a 3278. The full syntax for host is:
Prepending a P: onto hostname causes the connection to go through the telnet-passthru service rather than directly to the host. See PASSTHRU below.
Prepending an S: onto hostname removes the "extended data stream" option reported to the host. See -tn below for further information.
Prepending an N: onto hostname turns off TN3270E support for the session.
Prepending an L: onto hostname causes c3270 to first create an SSL/TLS tunnel to the host, and then create a TN3270 session inside the tunnel. (This function is supported only if c3270 was built with SSL/TLS support). Note that TLS-encrypted sessions using the TELNET START-TLS option are negotiated with the host automatically; for these sessions the L: prefix should not be used.
Prepending a Y: onto hostname causes c3270 to skip validation of host SSL/TLS certificates. This overrides any other configuration or command-line options.
Prepending an A: onto hostname is equivalent to setting the -nvt option; it forces an NVT-mode session instead of a 3270-mode session.
A specific Logical Unit (LU) name to use may be specified by prepending it to the hostname with an `@'. Multiple LU names to try can be separated by commas. An empty LU can be placed in the list with an extra comma. (Note that the LU name is used for different purposes by different kinds of hosts. For example, CICS uses the LU name as the Terminal ID.)
The hostname may optionally be placed inside square-bracket characters `[' and `]'. This will prevent any colon `:' characters in the hostname from being interpreted as indicating option prefixes or port numbers. This allows numeric IPv6 addresses to be used as hostnames.
On systems that support the forkpty library call, the hostname may be replaced with -e and a command string. This will cause c3270 to connect to a local child process, such as a shell.
The port to connect to defaults to telnet. This can be overridden with the -port option, or by appending a port to the hostname with a colon `:'. (For compatability with previous versions of c3270 and with tn3270(1), the port may also be specified as a second, separate argument.)
An optional accept name (a hostname to accept in the host's SSL/TLS certificate) may be specified by appending it to the hostname with an equals sign (`='). The accept name can also be specified with the -accepthostname option.
c3270 understands the following options:
Model Number | Columns | Rows |
2 | 80 | 24 |
3 | 80 | 32 |
4 | 80 | 43 |
5 | 132 | 27 |
If the terminal that c3270 is running on has at least one more row that the 3270 model requires (e.g., 25 rows for a model 2), c3270 will display a status line. The c3270 status line contains a variety of information. From left to right, the fields are:
Here is a complete list of basic c3270 actions. Script-specific actions are described on the x3270-script(1) manual page. ).PP Actions marked with an asterisk (*) may block, sending data to the host and possibly waiting for a response.
+2 *Attn | attention key |
+2 BackSpace | move cursor left (or send ASCII BS) |
+2 BackTab | tab to start of previous input field |
+2 CircumNot | input "^" in NVT mode, or "notsign" in 3270 mode |
+2 *Clear | clear screen |
+2 Compose | next two keys form a special symbol |
+2 *Connect(host) | connect to host |
+2 *CursorSelect | Cursor Select AID |
+2 Delete | delete character under cursor (or send ASCII DEL) |
+2 DeleteField | delete the entire field |
+2 DeleteWord | delete the current or previous word |
+2 *Disconnect | disconnect from host |
+2 Down | move cursor down |
+2 Dup | duplicate field |
+2 *Enter | Enter AID (or send ASCII CR) |
+2 Erase | erase previous character (or send ASCII BS) |
+2 EraseEOF | erase to end of current field |
+2 EraseInput | erase all input fields |
+2 Escape | escape to c3270> prompt |
+2 Execute(cmd) | execute a command in a shell |
+2 FieldEnd | move cursor to end of field |
+2 FieldMark | mark field |
+2 HexString(hex_digits) | insert control-character string |
+2 Home | move cursor to first input field |
+2 Insert | set insert mode |
+2 *Interrupt | send TELNET IP to host |
+2 Keypad | Display pop-up keypad |
+2 Key(keysym) | insert key keysym |
+2 Key(0xxx) | insert key with character code xx |
+2 Left | move cursor left |
+2 Left2 | move cursor left 2 positions |
+2 Menu | Display menu bar |
+2 MonoCase | toggle uppercase-only mode |
+2 MoveCursor(row, col) | move cursor to zero-origin (row,col) |
+2 Newline | move cursor to first field on next line (or send ASCII LF) |
+2 NextWord | move cursor to next word |
+2 *PA(n) | Program Attention AID (n from 1 to 3) |
+2 *PF(n) | Program Function AID (n from 1 to 24) |
+2 PreviousWord | move cursor to previous word |
+2 Printer(Start[,lu]|Stop) | start or stop printer session |
+2 PrintText(command) | print screen text on printer |
+2 Quit | exit c3270 |
+2 Redraw | redraw window |
+2 Reset | reset locked keyboard |
+2 Right | move cursor right |
+2 Right2 | move cursor right 2 positions |
+2 *Script(command[,arg...]) | run a script |
+2 Scroll(Forward|Backward) | scroll screen |
+2 *String(string) | insert string (simple macro facility) |
+2 Tab | move cursor to next input field |
+2 Toggle(option[,set|clear]) | toggle an option |
+2 ToggleInsert | toggle insert mode |
+2 ToggleReverse | toggle reverse-input mode |
+2 *Transfer(option=value...') | file transfer |
+2 Up | move cursor up |
+2 ignore | do nothing |
Any of the above actions may be entered at the c3270> prompt; these commands are also available for use in keymaps (see KEYMAPS). Command names are case-insensitive. Parameters can be specified with parentheses and commas, e.g.:
or with spaces, e.g.:c3270 also supports the following interactive commands:
Note that certain parameters to c3270 actions (such as the names of files and keymaps) are subject to substitutions:
The character ~ at the beginning of a string is replaced with the user's home directory. A ~ character followed by a username is replaced with that user's home directory.
Environment variables are substituted using the Unix shell convention of $name or ${name}.
Two special pseudo-environment variables are supported. ${TIMESTAMP} is replaced with a microsecond-resolution timestamp; ${UNIQUE} is replaced with a string guaranteed to make a unique filename (the process ID optionally followed by a dash and a string of digits). ${UNIQUE} is used to form trace file names.
The -keymap option or the c3270.keymap resource allow a custom keymap to be specified. If the option -keymap xxx is given (or the c3270.keymap resource has the value xxx), c3270 will look for a resource named c3270.keymap.xxx. If no resource definition is found, it will look for a file named xxx.
Multiple keymaps may be specified be separating their names with commas. Definitions in later keymaps supercede those in earlier keymaps.
In addition, separate keymaps may be defined that apply only in 3270 mode or NVT mode. For example, the resource definition c3270.keymap.xxx.nvt or the file xxx.nvt will augment the definition of keymap xxx in NVT mode. Similarly, the resource definition c3270.keymap.xxx.3270 or the file xxx.3270 will augment the definition of keymap xxx in 3270 mode.
Temporary keymaps can also be added or removed while c3270 is running with the Keymap action. See x3270-script(1) for details.
Each line (rule) in a keymap specifies actions to perform when a particular key or sequence of keys is pressed. Keymap rules have the following syntax:
Here is a sample keymap definition from a file:
Here is the same definition as a resource:
The optional Alt or Ctrl modifiers specify that the Alt and Ctrl keys are pressed along with the specified key, respectively. Key is either an ISO 8859-1 symbol name, such as equal for `=' and a for `a', or a symbolic ncurses key name, such as UP. More than one key can be specified, indicating that a sequence of keys must be pressed in order for the rule to be matched. The action is an action from the ACTIONS list above. More than one action may be specified; they will be executed in order.
Keymap entries are case-sensitive and modifier-specific. This means that a keymap for the b key will match only a lowercase b. Actions for uppercase B, or for Alt-B, must be specified separately.
The base keymap is:
Key | Action |
Ctrl<Key>] | Escape |
Ctrl<Key>a Ctrl<Key>a | Key(0x01) |
Ctrl<Key>a Ctrl<Key>] | Key(0x1d) |
Ctrl<Key>a <Key>Tab | BackTab |
Ctrl<Key>a <Key>c | Clear |
Ctrl<Key>a <Key>e | Escape |
Ctrl<Key>a <Key>r | Reset |
Ctrl<Key>a <Key>k | Keypad |
Ctrl<Key>a <Key>l | Redraw |
Ctrl<Key>a <Key>m | Compose |
Ctrl<Key>a <Key>n | Menu |
Ctrl<Key>a <Key>p | PrintText |
Ctrl<Key>a <Key>^ | Key(notsign) |
Ctrl<Key>k | Keypad |
Ctrl<Key>n | Menu |
<Key>UP | Up |
<Key>DOWN | Down |
<Key>LEFT | Left |
<Key>RIGHT | Right |
<Key>F(n) | PF(n) |
Ctrl<Key>a <Key>F(n) | PF(n+12) |
Ctrl<Key>a <Key>1 | PA(1) |
Ctrl<Key>a <Key>2 | PA(2) |
Ctrl<Key>a <Key>3 | PA(3) |
<Key>PPAGE | Scroll(Backward) |
<Key>NPAGE | Scroll(Forward) |
The base 3270-mode keymap adds:
Key | Action |
Ctrl<Key>c | Clear |
Ctrl<Key>d | Dup |
Ctrl<Key>f | FieldMark |
Ctrl<Key>i | Tab |
Ctrl<Key>l | Redraw |
Ctrl<Key>r | Reset |
Ctrl<Key>u | DeleteField |
<Key>BackSpace | BackSpace |
<Key>Return | Enter |
<Key>Tab | Tab |
<Key>Linefeed | Newline |
<Key>BACKSPACE | BackSpace |
<Key>DC | Delete |
<Key>HOME | Home |
<Key>IC | ToggleInsert |
Some keyboards do not have a Meta key. Instead, they have an Alt key. Sometimes this key acts as a proper Meta key, that is, it is a modifier key that sets the high-order bit (0x80) in the code that is transmitted for each key. Other keyboards send a two-character sequence when the Alt key is pressed with another key: the Escape character (0x1b), followed by the code for the other key.
The resource c3270.metaEscape and the termcap km attribute control how c3270 will interpret these sequences. When c3270.metaEscape is set to true, or when c3270.metaEscape is set to auto and the termcap km attribute is set, the keyboard is assumed to have a separate Meta key. The Escape key can be used as an ordinary data key and has no special meaning.
When c3270.metaEscape is set to true, or when c3270.metaEscape is set to auto and the termcap km attribute is not set, the keyboard is assumed to use the Escape character as a prefix to indicate that the following character is supposed to have the high-order bit set. When c3270 sees an Escape character from the keyboard, it sets a short timeout. If another character arrives before the timeout expires, then c3270 will combine the two characters, setting the high-order bit of the second. In an event trace file, the combined character is listed as derived. In a keymap, only the combined character or the Meta prefix may be used. The Escape key can still be used by itself, but only if there is a short pause before pressing another key.
The default value for c3270.metaEscape is auto.
The Transfer action implements IND$FILE file transfer. This action requires that the IND$FILE program be installed on the IBM host, and that the 3270 cursor be located in a field that will accept a TSO or VM/CMS command.
The Transfer action can be entered at the command prompt with no parameters, which will cause it to prompt interactively for the file names and options. It can also be invoked with parameters to define the entire transfer.
Because of the complexity and number of options for file transfer, the parameters to the Transfer action take the unique form of option=value, and can appear in any order. Note that if the value contains spaces (such as a VM/CMS file name), then the entire parameter must be quoted, e.g., "HostFile=xxx foo a". The options are:
Option | Required? | Default | Other Values |
Direction | No | receive | send |
HostFile | Yes | ||
LocalFile | Yes | ||
Host | No | tso | vm, cics |
Mode | No | ascii | binary |
Cr | No | remove | add, keep |
Remap | No | yes | no |
Exist | No | keep | replace, append |
Recfm | No | fixed, variable, undefined | |
Lrecl | No | ||
Blksize | No | ||
Allocation | No | tracks, cylinders, avblock | |
PrimarySpace | Sometimes | ||
SecondarySpace | No | ||
Avblock | Sometimes | ||
BufferSize | No | 4096 |
The option details are as follows.
There are also resources that control the default values for each of the file transfer parameters. These resources have the same names as the Transfer keywords, but with ft prepended. E.g., the default for the Mode keyword is the c3270.ftMode resource.
The PrintText produces screen snapshots in a number of different forms. The default form wth no arguments sends a copy of the screen to the default printer. A single argument is the command to use to print, e.g., lpr.
Multiple arguments can include keywords to control the output of PrintText:
There are several types of script functions available.
\b | Left |
\exxxx | EBCDIC character in hex |
\f | Clear* |
\n | Enter* |
\pan | PA(n)* |
\pfnn | PF(nn)* |
\r | Newline |
\t | Tab |
\T | BackTab |
\uxxxx | Unicode character in hex |
\xxxxx | Unicode character in hex |
c3270 allows the direct entry of accented letters and special symbols. Pressing and releasing the "Compose" key, followed by two other keys, causes entry of the symbol combining those two keys. For example, "Compose" followed by the "C" key and the "," (comma) key, enters the "C-cedilla" symbol. A C on the status line indicates a pending composite character.
The mappings between these pairs of ordinary keys and the symbols they represent is controlled by the "c3270.composeMap" resource; it gives the name of the map to use. The maps themselves are named "c3270.composeMap.name". The default is "latin1", which gives mappings for most of the symbols in the ISO 8859-1 Latin-1 character set that are not in the 7-bit ASCII character set.
Note: The default keymap defines Meta<Key>m as the "Compose" key. You may set up your own "Compose" key with a keymap that maps some other keysym onto the Compose action.
c3270 supports associated printer sessions via the pr3287(1) program. The Printer action is used to start or stop a pr3287 session.
The action Printer Start starts a printer session, associated with the current LU. (This works only if the host supports TN3270E.)
The action Printer Start lu starts a printer session, associated with a specific lu.
The action Printer Stop stops a printer session.
The resource c3270.printer.options specifies extra options, such as -trace to pass to pr3287.
See pr3287(1) for further details.
The resource c3270.printerLu controls automatic printer session start-up. If it is set to `.', then whenever a login session is started, a printer session will automatically be started, associated with the login session. If it is set an LU name, then the automatic printer session will be associated with the specified LU.
c3270 supports the Sun telnet-passthru service provided by the in.telnet-gw server. This allows outbound telnet connections through a firewall machine. When a p: is prepended to a hostname, c3270 acts much like the itelnet(1) command. It contacts the machine named internet-gateway at the port defined in /etc/services as telnet-passthru (which defaults to 3514). It then passes the requested hostname and port to the in.telnet-gw server.
The -proxy option or the c3270.proxy resource causes c3270 to use a proxy server to connect to the host. The syntax of the option or resource is:
Proxy Type | Protocol | Default Port |
http | RFC 2817 HTTP tunnel (squid) | 3128 |
passthru | Sun in.telnet-gw | none |
socks4 | SOCKS version 4 | 1080 |
socks5 | SOCKS version 5 (RFC 1928) | 1080 |
telnet | No protocol (just send connect host port) | none |
The special types socks4a and socks5d can also be used to force the proxy server to do the hostname resolution for the SOCKS protocol.
When running as a 3270 Model 5, c3270 can take advantage of terminals that can switch between 80 and 132 column modes.
Because the curses library does not support mode switching, the escape sequences and resulting screen dimensions must be specified explicitly to c3270. These are specified with the -altscreen and -defscreen command-line options, or the altScreen and defScreen resources. -altscreen or altScreen defines the alternate (132-column) mode; -defscreen or defScreen defines the default (80-column) mode.
The syntax for the options and resources is rowsxcols=init_string, where rows and cols give the screen dimensions, and init_string is the escape sequence to transmit to the terminal to enter that mode. For defscreen, the minimum dimensions are 24 rows and 80 columns. For altscreen, the minimum dimensions are 27 rows and 132 columns. Within init_string, the usual escape sequences are supported (\E for escape, \r, \b, etc.). For example, the init string for a 132-column xterm is:
Note: When defscreen and altscreen are specified, the model number is always set to 5.
Certain c3270 options can be configured via resources. Resources are defined in the file .c3270pro in the user's home directory, and by -xrm options. The definitions are similar to X11 resources, and use a similar syntax. The resources available in c3270 are:
Resource | Default | Option | Purpose |
allBold | Auto | -allbold | Display all characters bold |
altScreen | -altscreen | 132-col screen definition | |
blankFill | False | -set blankFill | Blank Fill mode |
charset | bracket | -charset | EBCDIC character set |
composeMap | latin1 | Name of composed-character map | |
cursesColorForHostColorn | (note 6) | Color mapping | |
cursesColorForDefault | green | Default color mapping | |
cursesColorForIntensified | red | Default color mapping | |
cursesColorForProtected | blue | Default color mapping | |
cursesColorForProtectedIntensified | white | Default color mapping | |
cursesKeymap | True | Set curses keymap option | |
defScreen | -defscreen | 80-col screen definition | |
dbcsCgcsgid | Override DBCS CGCSGID | ||
dsTrace | False | -trace | Data stream tracing |
eof | ^D | NVT-mode EOF character | |
erase | ^H | NVT-mode erase character | |
extended | True | Use 3270 extended data stream | |
eventTrace | False | -trace | Event tracing |
hostsFile | -hostsfile | Host alias/macro file | |
icrnl | False | Map CR to NL on NVT-mode input | |
inlcr | False | Map NL to CR in NVT-mode input | |
intr | ^C | NVT-mode interrupt character | |
keymap | -keymap | Keyboard map name | |
keymap.foo | Definition of keymap foo | ||
kill | ^U | NVT-mode kill character | |
lineWrap | False | -set lineWrap | NVT line wrap mode |
lnext | ^V | NVT-mode lnext character | |
m3279 | (note 1) | -model | 3279 (color) emulation |
metaEscape | Auto | Interpret ESC-x as Meta-x | |
mono | (note 5) | -mono | Ignore terminal color capabilities |
monoCase | False | -set monoCase | Mono-case mode |
noPrompt | False | -noprompt | Disable command-prompt mode |
numericLock | False | Lock keyboard for numeric field error | |
oerrLock | True | Lock keyboard for input error | |
oversize | -oversize | Oversize screen dimensions | |
port | telnet | -port | Non-default TCP port |
printer.* | (note 4) | Printer session config | |
printerLu | (note 4) | Printer session config | |
quit | ^\ | NVT-mode quit character | |
reconnect | False | -reconnect | Automatically reconnect to host |
rprnt | ^R | NVT-mode reprint character | |
sbcsCgcsgid | Override SBCS CGCSGID | ||
secure | False | Disable "dangerous" options | |
termName | (note 2) | -tn | TELNET terminal type string |
traceDir | /tmp | Directory for trace files | |
traceFile | (note 3) | -tracefile | File for trace output |
typeahead | True | Allow typeahead | |
werase | ^W | NVT-mode word-erase character |
Note 2: The default terminal type string is constructed from the model number, color emulation, and extended data stream modes. E.g., a model 2 with color emulation and the extended data stream option would be sent as IBM-3279-2-E. Note also that when TN3270E mode is used, the terminal type is always sent as 3278, but this does not affect color capabilities.
Note 3: The default trace file is x3trc.pid in the directory specified by the traceDir resource.
Note 4: See PRINTER SUPPORT for details.
Note 5: mono defaults to false if the terminal supports at least 8 colors and to true otherwise.
Note 6: The default curses color mappings for host colors 0 through 15 are: black, blue, red, magenta, green, cyan, yellow, white, black, blue, yellow, blue, green, cyan, black and white.
In .c3270pro, lines are continued with a backslash character.
-xrm options override definitions found in .c3270pro. If more than one -xrm option is given for the same resource, the last one on the command line is used.
/usr/local/lib/x3270/ibm_hosts
$HOME/.c3270pro
pr3287(1), s3270(1), x3270-script(1), x3270(1), tcl3270(1),
telnet(1), tn3270(1)
Data Stream Programmer's Reference, IBM GA23-0059
Character Set Reference, IBM GA27-3831
RFC 1576, TN3270 Current Practices
RFC 1646, TN3270 Extensions for LUname and Printer Selection
RFC 2355, TN3270 Enhancements
Copyright 1993-2017, Paul Mattes.
Copyright 2004-2005, Don Russell.
Copyright 2004, Dick Altenbern.
Copyright 1990, Jeff Sparkes.
Copyright 1989, Georgia Tech Research Corporation (GTRC), Atlanta, GA
30332.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY PAUL MATTES, DON RUSSELL, DICK ALTENBERN, JEFF SPARKES AND GTRC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PAUL MATTES, DON RUSSELL, DICK ALTENBERN, JEFF SPARKES OR GTRC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c3270 3.6ga4
29 December 2017 |