# wc3270 Manual Page

## Contents

> Name
> Synopsis
> Description
> Options
> Modes
> Code Pages
> Menu Bar and Keypad
> NVT Mode
> Toggles
> Status Line
> Keymaps
> File Transfer
> The PrintText Action
> Nested Scripts
> Printer Session Support
> Proxy
> Resources
> See Also
> Copyrights
> Version

## Name

wc3270 - IBM host access tool

## Synopsis

wc3270 [options] [host]
wc3270 [options] session-file.wc3270

## Description

wc3270 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. The full syntax for host is:

> [prefix:]...[LUname@]hostname[:port][=accept]

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 wc3270 to first create a TLS tunnel to the host, and then create a TN3270 session inside the tunnel. (This function is supported only if wc3270 was built with 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 wc3270 to skip validation of host 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.

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 wc3270 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 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.

## Options

wc3270 understands the following options:

-accepthostname name
  Specifies a particular hostname to accept when validating the name presented in the server SSL certificate, instead of comparing to the name used to make the connection.
-allbold
  Forces all characters to be displayed using the `bold' colors (colors 8 through 15, rather than colors 0 through 7). This helps with PC console windows in which colors 0 through 7 are unreadably dim. All-bold mode is the default for color (3279) emulation, but not for monochrome (3278) emulation.
-clientcert name
  Specifies the name of a client certificate to provide to the host.
-clear toggle
  Sets the initial value of toggle to false. The list of toggle names is under TOGGLES below.
-codepage name
  Specifies an EBCDIC host code page. See CODE PAGES below.
-connecttimeout seconds
  Specifies the time that wc3270 will wait for a host connection to complete.
-devname name
  Specifies a device name (workstation ID) for RFC 4777 support.
-hostsfile file
  Uses file as the hosts file, which allows aliases for host names and scripts to be executed at login. See ibm_hosts(1) for details.
-httpd [addr:]port
  Specifies a port and optional address to listen on for HTTP connections. Addr can be specified as `*' to indicate 0.0.0.0; the default is 127.0.0.1. IPv6 numeric addresses must be specified inside of square brackets, e.g., [::1]:4080 to specify the IPv6 loopback address and TCP port 4080.

  Note that this option is mutually-exclusive with the -scriptport option .

-loginmacro Action(arg...) ...
  Specifies a macro to run at login time.
-model name
  The model of 3270 display to be emulated. The model name is in two parts, either of which may be omitted:

  The first part is the base model, which is either 3278 or 3279. 3278 specifies a monochrome (green on black) 3270 display; 3279 specifies a color 3270 display.

  The second part is the model number, which specifies the number of rows and columns. Model 4 is the default.

  Model Number | Columns | Rows
  2 | 80 | 24
  3 | 80 | 32
  4 | 80 | 43
  5 | 132 | 27

  Note: Technically, there is no such 3270 display as a 3279-4 or 3279-5, but most hosts seem to work with them anyway.

  The default model is 3279-4.

-noverifycert
  For TLS connections, do not verify the host certificate.
-nvt
  Start in NVT mode instead of waiting for the host to send data, and make the default terminal type xterm.
-oversize cols x rows
  Makes the screen larger than the default for the chosen model number. This option has effect only in combination with extended data stream support (controlled by the "wc3270.extended" resource), and only if the host supports the Query Reply structured field. The number of columns multiplied by the number of rows must not exceed 16383 (3fff hex), the limit of 14-bit 3270 buffer addressing.

  It can also be specified as auto, which causes wc3270 to fill the entire terminal or console window.

-port n
  Specifies a different TCP port to connect to. n can be a name from /etc/services like telnet, or a number. This option changes the default port number used for all connections. (The positional parameter affects only the initial connection.)
-proxy type:host[:port]
  Causes wc3270 to connect via the specified proxy, instead of using a direct connection. The host can be an IP address or hostname. The optional port can be a number or a service name. For a list of supported proxy types, see PROXY below.
-reconnect
  Causes wc3270 to automatically reconnect to the host if it ever disconnects. This option has effect only if a hostname is specified on the command line.
-sl n
  Specifies that n lines should be saved for scrolling back. The default is 4096.
-S
  Runs wc3270 in auto-shortcut mode. wc3270 will create a temporary shorcut (.LNK file) that matches the parameters in the session file (model number, characterset, etc.) and re-run itself from the shortcut.
+S
  Disables auto-shortcut mode. It is generally a good idea to put this option on the command lines of all shortcuts, to avoid infinite looping.
-scriptport [addr:]port
  Specifies a port and optional address to listen on for scripting connections. Addr can be specified as `*' to indicate 0.0.0.0; the default is 127.0.0.1. IPv6 numeric addresses must be specified inside of square brackets, e.g., [::1]:4081 to specify the IPv6 loopback address and TCP port 4081.

  Note that this option is mutually-exclusive with the -httpd option .

-scriptportonce
  Allows wc3270 to accept only one script connection. When that connection is broken, wc3270 will exit.
-set toggle
  Sets the initial value of toggle to true. The list of toggle names is under TOGGLES below. The -p option of x3270if causes it to use this socket, instead of pipes specified by environment variables.
-title text
  Sets the console window title to text, overriding the automatic setting of the hostname and the string wc3270.
-tn name
  Specifies the terminal name to be transmitted over the telnet connection. The default name is IBM-model_name-E, for example, IBM-3278-4-E.

  Some hosts are confused by the -E suffix on the terminal name, and will ignore the extra screen area on models 3, 4 and 5. Prepending an S: on the hostname, or setting the "wc3270.extended" resource to "false", removes the -E from the terminal name when connecting to such hosts.

  The name can also be specified with the "wc3270.termName" resource.

-trace
  Turns on data stream and event tracing at startup. The default trace file name is x3trc.pid.txt on the current user's Desktop.
-tracefile file
  Specifies a file to save data stream and event traces into. If the name starts with `>>', data will be appended to the file.
-tracefilesize size
  Places a limit on the size of a trace file. If this option is not specified, or is specified as 0 or none, the trace file size will be unlimited. The minimum size is 64 Kbytes. The value of size can have a K or M suffix, indicating kilobytes or megabytes respectively. When the trace file reaches the size limit, it will be renamed with a `-' appended and a new file started.
-user name
  Specifies the user name for RFC 4777 support.
-utf8
  Forces the local codeset to be UTF-8, ignoring the locale or Windows codepage.
-v
  Display the version and build options for wc3270 and exit.
-verifycert
  For TLS connections, verify the host certificate, and do not allow the connection to complete unless it can be validated. (This is the default setting.) This option is overridden by a Y: prepended to the hostname when connecting.
-xrm "wc3270.resource: value"
  Sets the value of the named resource to value. Resources control less common wc3270 options, and are defined under RESOURCES below.

## Modes

wc3270 has two basic modes: wc3270> prompt and session.

Interactive actions can be entered at the wc3270> prompt, to connect to a host, disconnect from a host, transfer files, display statistics, exit wc3270, etc. The complete list of interactive actions is listed under ACTIONS.

Session mode is where the emulated 3270 screen is displayed; keyboard actions cause the display buffer to be modified or data to be sent to the host.

To switch from display mode to wc3270> prompt mode, press the Escape key. To switch from wc3270> prompt mode to display mode, press Enter (without entering an action) at the wc3270> prompt.

## Code Pages

The -codepage option or the "wc3270.codepage" resource controls the EBCDIC host code page used by wc3270. Available pages include:

Name | Host Code Page |
belgian | 500 |
belgian-euro | 1148 |
bracket | 037 |
brazilian | 275 |
chinese-gb18030 | 1388 |
cp1047 | 1047 |
cp870 | 870 |
finnish | 278 |
finnish-euro | 1143 |
french | 297 |
french-euro | 1147 |
german | 273 |
german-euro | 1141 |
greek | 423 |
hebrew | 424 |
icelandic | 871 |
icelandic-euro | 1149 |
italian | 280 |
italian-euro | 1144 |
japanese-kana | 930 |
japanese-latin | 939 |
norwegian | 277 |
norwegian-euro | 1142 |
russian | 880 |
simplified-chinese | 935 |
slovenian | 870 |
spanish | 284 |
spanish-euro | 1145 |
swedish | 278 |
swedish-euro | 1143 |
thai | 1160 |
traditional-chinese | 937 |
turkish | 1026 |
uk | 285 |
uk-euro | 1146 |
us-euro | 1140 |
us-intl | 037 |

The default code page is bracket, which is useful for common U.S. IBM hosts which use EBCDIC codes AD and BD for the `[' and `]' characters, respectively.

Note that any of the host code pages listed above can be specified by adding cp to the host code page number, e.g., cp037 for host code page 037. Also note that the code pages available for a given version of wc3270 are displayed by the -v command-line option.

Note that DBCS character sets (Chinese, Japanese) display properly only on 32-bit Windows XP. Work is proceeding on other platforms.

## Menu Bar and Keypad

wc3270 supports a menu bar and pop-up keypad. The menu bar allows common functions to be executed without needing to switch to the wc3270> prompt. It is available by pressing Alt-N, or if the console supports a mouse, by clicking on the menu titles displayed at the top of the screen.

The on-screen menu title bar can be turned off via the "wc3270.menuBar" resource.

The pop-up keypad allows the 3270-specific keys (PF keys, PA keys, Clear, Reset, etc.) to be invoked without memorizing their key mappings or switching to the wc3270> prompt. The keypad can be popped up by pressing Alt-K, or can be invoked via a menu option.

## NVT Mode

Some hosts use an ASCII front-end to do initial login negotiation, then later switch to 3270 mode. wc3270 will emulate an ANSI X3.64 terminal until the host places it in 3270 mode (telnet BINARY and SEND EOR modes, or TN3270E mode negotiation).

If the host later negotiates to stop functioning in 3270 mode, wc3270 will return to NVT emulation.

In NVT mode, wc3270 supports both character-at-a-time mode and line mode operation. You may select the mode with a menu option. When in line mode, the special characters and operational characteristics are defined by resources:

Mode/Character | Resource | Default
Translate CR to NL | wc3270.icrnl | true
Translate NL to CR | wc3270.inlcr | false
Erase previous character | wc3270.erase | ^?
Erase entire line | wc3270.kill | ^U
Erase previous word | wc3270.werase | ^W
Redisplay line | wc3270.rprnt | ^R
Ignore special meaning of next character | wc3270.lnext | ^V
Interrupt | wc3270.intr | ^C
Quit | wc3270.quit | ^\
End of file | wc3270.eof | ^D

Separate keymaps can be defined for use only when wc3270 is in 3270 mode or NVT mode. See KEYMAPS for details.

## Toggles

wc3270 has a number of configurable modes which may be selected by the -set and -clear options. These names can also be used as the first parameter to the Toggle action, and are the names of resources that can be used to set or clear the value of each toggle at start-up.

aidWait
  Changes the behavior of actions that send an AID to the host (Enter, Clear, PA and PF). When set, these actions no longer block until the host unlocks the keyboard. It is up to the script to poll the prompt for the unlocked state, or to use the Wait(unlock) action to wait for the unlock.
altCursor
  If set, the cursor will be an underline. If clear, it will be a solid block.
blankFill
  If set, wc3270 modifies interactive 3270 behavior in two ways. First, when a character is typed into a field, all nulls in the field to the left of that character are changed to blanks. This eliminates a common 3270 data-entry surprise. Second, in insert mode, trailing blanks in a field are treated like nulls, eliminating the annoying `lock-up' that often occurs when inserting into an field with (apparent) space at the end.
crosshair
  When set, wc3270 will display a crosshair to help locate the cursor on the screen.
lineWrap
  If set, the NVT terminal emulator automatically assumes a NEWLINE character when it reaches the end of a line.
marginedPaste
  If set, pasting multi-line input via the Paste() action will maintain a left margin (it will not move the cursor further left than where the paste begins).
monoCase
  If set, wc3270 operates in uppercase-only mode.
overlayPaste
  If set, pasting over a protected field will simply increment the cursor position instead of locking the keyboard. This allows forms to be copied and pasted with the protected fields included. Setting this toggle also implicitly sets the marginedPaste toggle.
screenTrace
  Turns on screen tracing at start-up. Each time the screen changes, its contents are appended to the file x3scr.pid.txt on the current user's desktop.
showTiming
  If set, the time taken by the host to process an AID is displayed on the status line.
trace
  Turns on data stream and event tracing at start-up. Network traffic (both a hexadecimal representation and its interpretation) is logged to the file x3trc.pid.txt on the current user's desktop. The directory for the trace file can be changed with the "wc3270.traceDir" resource. Script actions are also traced.
typeahead
  If set, characters typed while the keyboard is locked will be stored and played back when the host unlocks the keyboard. If clear, these characters will be dropped.
underscore
  If set, wc3270 will display underlined fields by substituting underscore `_' characters for blanks or nulls in the field. Otherwise, these fields will be displayed with a highlighted background. Note that setting underscore also disables the highlighted background for blinking fields. underscore is set by default.
visibleControl
  If set, control characters (NULLs, SI/SO and field attributes), which are usually displayed as blanks, are visible on the display. NULs become periods, SO becomes `<', SI becomes `>'. Field attributes are mapped onto the characters 0 through 9 and A through V and are displayed in reverse-video yellow. Field attribute mappings are part of the wc3270 Resources documentation for the visibleControl resource.

## Status Line

The wc3270 status line contains a variety of information. From left to right, the fields are:

comm status
  The first symbol is always a 4. If wc3270 is in TN3270E mode, the second symbol is a B; otherwise it is an A. If wc3270 is in SSCP-LU mode, the third symbol is an S. Otherwise it is blank.
keyboard lock
  If the keyboard is locked, an "X" symbol and a message field indicate the reason for the keyboard lock.
typeahead
  The letter "T" indicates that one or more keystrokes are in the typeahead buffer.
temporary keymap
  The letter "K" indicates that a temporary keymap is in effect.
reverse
  The letter "R" indicates that the keyboard is in reverse field entry mode.
insert mode
  The letter "I" indicates that the keyboard is in insert mode.
printer session
  The letter "P" indicates that a pr3287 session is active.
secure connection
  A green letter "S" indicates that the connection is secured via TLS.
LU name
  The LU name associated with the session, if there is one.
cursor position
  The cursor row and column are optionally displayed, zero padded and separated by a "/". Location 001/001 is at the upper left, which is different from the row and columns parameters used with various actions, where the upper left corner is row 0, column 0.

Actions

## Actions

Here is a complete list of basic wc3270 actions. Script-specific actions are described on the wc3270-script(1) manual page.

Actions marked with an asterisk (*) may block, sending data to the host and possibly waiting for a response.

*Attn() | attention key
BackSpace() | move cursor left (or send ASCII BS)
BackTab() | tab to start of previous input field
Charset(charset) | change host code page
CircumNot() | input "^" in NVT mode, or "¬" in 3270 mode
*Clear() | clear screen
Cols | report screen size
Compose() | next two keys form a special symbol
*Connect(host) | connect to host
Copy() | copy highlighted area to clipboard
*CursorSelect() | Cursor Select AID
Cut() | copy highlighted area to clipboard and erase
Delete() | delete character under cursor (or send ASCII DEL)
DeleteField() | delete the entire field
DeleteWord() | delete the current or previous word
*Disconnect() | disconnect from host
Down() | move cursor down
Dup()([failonerror|nofailonerror]) | duplicate field
*Enter() | Enter AID (or send ASCII CR)
Erase() | erase previous character (or send ASCII BS)
EraseEOF() | erase to end of current field
EraseInput() | erase all input fields
FieldEnd() | move cursor to end of field
FieldMark()([failonerror|nofailonError]) | mark field
HexString(hex_digits) | insert control-character string
Home() | move cursor to first input field
Insert() | set insert mode
*Interrupt() | send TELNET IP to host
Keypad() | Display pop-up keypad
Key(keysym[,failonerror|nofailonerror]) | insert key keysym
Key(0xxx[,failonError|nofailonerror]) | insert key with character code xx
Left() | move cursor left
Left2() | move cursor left 2 positions
Menu() | Display menu bar
MonoCase() | toggle uppercase-only mode
MoveCursor(row,col) | move cursor to zero-origin (row,col)
Newline() | move cursor to first field on next line (or send ASCII LF)
NextWord() | move cursor to next word
*PA(n) | Program Attention AID (n from 1 to 3)
*PF(n) | Program Function AID (n from 1 to 24)
PreviousWord() | move cursor to previous word
Paste() | insert clipboard contents
PasteString(hex_digits) | insert string using pasting behavior
Printer(start[,lu]|stop) | start or stop printer session
PrintText([gdi|wordpad,][dialog|nodialog,][printer-name]) | print screen text on printer
Quit() | exit wc3270
Redraw() | redraw window
Reset() | reset locked keyboard
Right() | move cursor right
Right2() | move cursor right 2 positions
Rows() | report screen size
*Script(command[,arg...]) | run a script
Scroll(forward|backward) | scroll screen
*String(string) | insert string (simple macro facility)
*SelectDown | Extend selection down
SelectLeft() | Extend selection left
SelectUp() | Extend selection up
SelectDown() | Extend selection down
SysReq() | System Request AID
Tab() | move cursor to next input field
Toggle(option[,set|clear]) | toggle an option
ToggleInsert() | toggle insert mode
ToggleReverse() | toggle reverse-input mode
*Transfer(option=value...') | file transfer
Up() | move cursor up

Any of the above actions may be entered at the wc3270> prompt; these actions are also available for use in keymaps (see KEYMAPS). Command names are case-insensitive. Parameters can be specified with parentheses and commas, e.g.:

> PF(1)

or with spaces, e.g.:

> PF 1

Parameters can be quoted with double-quote characters, to allow spaces, commas, and parentheses to be used.

wc3270 also supports the following interactive actions:

Help()
  Displays a list of available actions.
ScreenTrace()
  Turns screen tracing (saving screen images to a file) on or off. The action ScreenTrace(on) enables screen tracing; the action ScreenTrace(off) disables it. After on, a filename may be specified to override the default trace file name of x3scr.pid.txt. The keyword on can also be followed by the keyword printer and an optional printer name to direct screen traces directly to the printer.
Show()
  Displays statistics and settings.
Trace()
  Turns tracing on or off. The action Trace(on) enables data stream and keyboard event tracing; the action Trace(off) disables it. The qualifier data or keyboard can be specified before on or off to enable or disable a particular trace. After on, a filename may be specified to override the default trace file name of x3trc.pid.txt.

Note that certain parameters to wc3270 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.

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.

## Keymaps

The -keymap option or the wc3270.keymap resource allow a custom keymap to be specified. If the option -keymap xxx is given (or the wc3270.keymap resource has the value xxx), wc3270 will look for a resource named wc3270.keymap.xxx. If no resource definition is found, it will look for a file named xxx.wc3270km.

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 wc3270.keymap.xxx.nvt or the file xxx.nvt.wc3270km will augment the definition of keymap xxx in NVT mode. Similarly, the resource definition wc3270.keymap.xxx.3270 or the file xxx.3270.wc3270km will augment the definition of keymap xxx in 3270 mode.

Temporary keymaps can also be added or removed while wc3270 is running with the Keymap action. See wc3270-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:

> [modifier...]<Key>key...: action[(param[,...])] ...

Here is a sample keymap definition from a file:

> ! Lines beginning with ! are ignored and can
> ! occur anywhere.
> ! The line below will be displayed
> ! by the New Session Wizard.
> !description: An example.
> ! Definition of keymap xxx
> ! When Alt-c is pressed, clear the screen.
> Alt<Key>c: Clear()
> ! When PageUp is pressed, send PF7 to the host.
> <Key>PRIOR: PF(7)
> ! When Ctrl-a is pressed, then F1, send PF13
> ! to the host.
> Ctrl<Key>a <Key>F1: PF(13)

Here is the same definition as a resource:

> ! Lines beginning with ! are ignored, but NOT
> ! within a definition.
> ! Note that the \ is required at the end of the
> ! first line, and \n\ is
> ! required at the end of every other line except
> ! the last.
> ! Definition of keymap xxx
> wc3270.keymap.xxx: \
> Alt<Key>c: Clear() \n\
> <Key>PRIOR: PF(7) \n\
> Ctrl<Key>A <Key>F1: PF(13)

The optional Shift, Alt or Ctrl modifiers specify that the Shift, Alt and Ctrl keys are pressed along with the specified key, respectively. The LeftCtrl, RightCtrl, LeftAlt, and RightAlt modifiers specifify a particular Ctrl or Alt key. The Enhanced modifier is also available; Enhanced <Key>ENTER is the keypad Enter key. Key is either an ISO 8859-1 symbol name, such as equal for `=' and a for `a', or a symbolic Windows 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.

Available symbolic key names are: ADD, ALT, APPS, BACK (BackSpace), BackSpace (alias for BACK), CLEAR, CTRL, DECIMAL, DELETE, DIVIDE, DOWN, END, Enter (alias for RETURN), ESCAPE, Esc (alias for ESCAPE), EXECUTE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, HELP, HOME, INSERT, LEFT, LMENU, LWIN (Left Windows key), MULTIPLY, NEXT (Page Down), NUMLOCK, NUMPAD0, NUMPAD1, NUMPAD2, NUMPAD3, NUMPAD4, NUMPAD5, NUMPAD6, NUMPAD7, NUMPAD8, NUMPAD9, PageUp (alias for PRIOR), PageDown (alias for Next), PAUSE, PRINT, PRIOR (Page Up), RETURN (Enter), RIGHT, RMENU, RWIN (Right Windows key), SCROLL, SELECT, SEPARATOR, SHIFT, SLEEP, SNAPSHOT, SUBTRACT, TAB and UP. In addition, any Windows VKey code can be specified in hexadecimal with the syntax VKEY-0x nn.

The base keymap is:

Key | Action
Alt<Key>1 | PA(1)
Alt<Key>2 | PA(2)
Alt<Key>3 | PA(3)
Alt Ctrl<Key>] | Key(0x1d)
Ctrl<Key>] | Escape()
Alt<Key>^ | Key(notsign)
Ctrl<Key>c | Copy()
Alt<Key>k | Keymap()
Alt<Key>l | Redraw()
Alt<Key>m | Compose()
Alt<Key>n | Menu()
Ctrl<Key>p | Paste()
Alt<Key>p | PrintText()
Ctrl<Key>x | Cut()
<Key>PRIOR | Scroll(backward)
<Key>NEXT | Scroll(forward)
Shift<Key>Fn | PF(n+12)

The base 3270-mode keymap adds:

Key | Action
Ctrl<Key>a | Attn()
Alt<Key>a | Attn()
Alt<Key>c | Clear()
Ctrl<Key>d | Dup()
Alt<Key>d | Dup()
Ctrl<Key>f | FieldMark()
Alt<Key>f | FieldMark()
Ctrl<Key>h | Erase()
Alt<Key>i | Insert()
Shift Ctrl<Key>i | BackTab()
Ctrl<Key>i | Tab()
Ctrl<Key>j | Newline()
Ctrl<Key>l | Redraw()
Ctrl<Key>m | Enter()
Ctrl<Key>r | Reset()
Alt<Key>r | Reset()
Ctrl<Key>u | DeleteField()
<Key>INSERT | ToggleInsert()
Shift<Key>TAB | BackTab()
<Key>BACK | Erase()
Shift<Key>END | EraseEOF()
<Key>END | FieldEnd()
Ctrl<Key>LEFT | PreviousWord()
Ctrl<Key>RIGHT | NextWord()
Shift<Key>LEFT | SelectLeft()
Shift<Key>RIGHT | SelectRight()
Shift<Key>UP | SelectUp()
Shift<Key>DOWN | SelectDown()
<Key>PRIOR | PF(7)
<Key>NEXT | PF(8)

## File Transfer

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 wc3270> 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 can take the unique form of option=value. They can also be given with their parameters separately. Options 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". With sequential options, this would be 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.

direction
  send to send a file to the host, receive to receive a file from the host.
hostfile
  The name of the file on the host.
localfile
  The name of the file on the local workstation.
host
  The type of host (which dictates the form of the IND$FILE command): tso (the default), vm or cics.
mode
  Use ascii (the default) for a text file, which will be translated between EBCDIC and ASCII as necessary. Use binary for non-text files.
cr
  Controls how newline characters are handled when transferring mode=ascii files. remove (the default) strips newline characters in local files before transferring them to the host. add adds newline characters to each host file record before transferring it to the local workstation. keep preserves newline characters when transferring a local file to the host.
remap
  Controls text translation for mode=ascii files. The value yes (the default) causes wc3270 to remap the text to ensure maximum compatibility between the workstation's character set and encoding and the host's EBCDIC code page. The value no causes wc3270 to pass the text to or from the host as-is, leaving all translation to the IND$FILE program on the host.
exist
  Controls what happens when the destination file already exists. keep (the default) preserves the file, causing the Transfer() action to fail. replace overwrites the destination file with the source file. append appends the source file to the destination file.
recfm
  Controls the record format of files created on the host. (TSO and VM hosts only.) fixed creates a file with fixed-length records. variable creates a file with variable-length records. undefined creates a file with undefined-length records (TSO hosts only). The lrecl option controls the record length or maximum record length for recfm=fixed and recfm=variable files, respectively.
lrecl
  Specifies the record length (or maximum record length) for files created on the host. (TSO and VM hosts only.)
blksize
  Specifies the block size for files created on the host. (TSO and VM hosts only.)
allocation
  Specifies the units for the primaryspace and secondaryspace options: tracks, cylinders or avblock. (TSO hosts only.)
primaryspace
  Primary allocation for a file. The units are given by the allocation option. Required when the allocation is specified as something other than default. (TSO hosts only.)
secondaryspace
  Secondary allocation for a file. The units are given by the allocation option. (TSO hosts only.)
avblock
  Average block size, required when allocation specifies avblock. (TSO hosts only.)
buffersize
  Buffer size for DFT-mode transfers. Can range from 256 to 32768. Larger values give better performance, but some hosts may not be able to support them.
windowscodepage
  Overrides the workstation code page used for ASCII file transfers. By default, the system ANSI code page is used.

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 and the option name capitalized. E.g., the default for the mode keyword is the wc3270.ftMode resource.

## The PrintText Action

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 name of the printer to use. The font defaults to Courier New and the point size defaults to auto (by default -- pick the widest font that will fit across the page) or 8 (if using WordPad). These can be overridden by the printTextFont and printTextSize resources, respectively. Unless the wordpad keyword is used to force the output to be run through the Windows WordPad utility, additional resources can control the output. printTextHorizontalMargin defines the left- and right-hand margins. printTextVerticalMargin defines the top and bottom margins. Both default to 0.5 inches; the values are in inches by default but can be suffixed with mm or cm. printTextOrientation defines the page orientation as portrait or landscape.

Multiple arguments can include keywords to control the output of PrintText():

gdi
  Print directly to the printer using GDI, instead of creating an RTF file and running WordPad to print it. (This is the default).
wordpad
  Create an RTF file and run WordPad to print it. (This was the former default).
dialog
  In GDI mode, pop up the Windows print dialog. (This is the default.)
nodialog
  In GDI mode, skip the usual Windows print dialog.
file,filename
  Save the output in a file.
html
  Save the output as HTML. This option implies file.
rtf
  Save the output as RichText. This option implies file. The font defaults to Courier New and the point size defaults to 8. These can be overridden by the printTextFont and printTextSize resources, respectively.
modi
  Render modified fields in italics.
caption,text
  Add the specified text as a caption above the output. Within text, the special sequence %T% will be replaced with a timestamp.

## Nested Scripts

The String Action
  The simplest method for nested scripts is provided via the String() action, which can be bound to any key in a keymap. The arguments to String() are one or more double-quoted strings which are inserted directly as if typed. The C backslash conventions are honored as follows. (Entries marked * mean that after sending the AID code to the host, wc3270 will wait for the host to unlock the keyboard before further processing the string.)

  \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

  Note that the numeric values for the \e, \u and \x sequences can be abbreviated to 2 digits. Note also that EBCDIC codes greater than 255 and some Unicode character codes represent DBCS characters, which will work only if wc3270 is built with DBCS support and the host allows DBCS input in the current field.

  An example keymap entry would be:

  > Alt<Key>p: String("probs clearrdr\n")

  Note: The strings are in ASCII and converted to EBCDIC, so beware of inserting control codes.

  There is also an alternate form of the String() action, HexString(), which is used to enter non-printing data. The argument to HexString() is a string of hexadecimal digits, two per character. A leading 0x or 0X is optional. In 3270 mode, the hexadecimal data represent EBCDIC characters, which are entered into the current field. In NVT mode, the hexadecimal data represent ASCII characters, which are sent directly to the host.

The Script Action
  This action causes wc3270 to start a child process which can execute wc3270 actions. wc3270 listens for connections from the child process on a dynamically-generated TCP port.

## Printer Session Support

wc3270 supports associated printer sessions via the wpr3287(1) program. The Printer action is used to start or stop a wpr3287 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 wc3270.printer.name specifies the Windows printer used to print each job. It defaults to the value of the $PRINTER environment variable, if set. Otherwise the default system printer is used. This resource also controls the printer used by the PrintText() action.

The resource wc3270.printer.options specifies extra options, such as -trace to pass to wpr3287.

See wpr3287(1) for further details.

The resource wc3270.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.

## Proxy

The -proxy option or the wc3270.proxy resource causes wc3270 to use a proxy server to connect to the host. The syntax of the option or resource is:

> type:[username:password@]host[:port]

The supported values for type are:

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. Note that only the http and socks5 proxies support a username and password.

## Resources

Certain wc3270 options can be configured via resources. Resources are defined in the session file, or by -xrm options. The definitions are similar to X11 resources, and use a similar syntax. The resources available in wc3270 are:

Resource | Default | Option | Purpose
blankFill | False | -set blankFill | Blank Fill mode
charset | bracket | -charset | EBCDIC character set
consoleColorForHostColorn | (note 6) |  | Color mapping
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
hostColorForDefault | green |  | Default color mapping
hostColorForIntensified | red |  | Default color mapping
hostColorForProtected | blue |  | Default color mapping
hostColorForProtectedIntensified | neutralWhite |  | Default color mapping
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
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
marginedPaste | False | -set marginedPaste | Keep left margin when pasting
monoCase | False | -set monoCase | Mono-case mode
noPrompt | False | -noprompt | Disable wc3270>-prompt mode
numericLock | False |  | Lock keyboard for numeric field error
oerrLock | False |  | Lock keyboard for input error
overlayPaste | False | -set overlayPaste | Overlay protected fields when pasting
oversize |  | -oversize | Oversize screen dimensions
port | telnet | -port | Non-default TCP port
printer.* | (note 4) |  | Printer session config
printerLu | (note 4) |  | Printer session config
printTextFont | Courier New |  | PrintText font name
printTextSize | 8 |  | PrintText font size
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
title |  |  | Console window title
traceFile | (note 3) | -tracefile | File for trace output
visualBell | False |  | Disable bell sound
werase | ^W |  | NVT-mode word-erase character

> Note 1: m3279 defaults to True. It can be forced to False with the proper -model option.

> 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.txt on the current user's desktop.

> Note 4: See PRINTER SUPPORT for details.

> Note 6: The default console color mappings for host colors 0 through 15 are: 0, 9, 12, 13, 10, 11, 14, 15, 0, 1, 12, 5, 2, 3, 7, and 15.

If more than one -xrm option is given for the same resource, the last one on the command line is used.

## See Also

wpr3287(1), ws3270(1), wc3270-script(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

## Copyrights

Copyright © 1993-2020, 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:

*
  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
  Neither the names of Paul Mattes, Don Russell, Dick Altenbern, Jeff Sparkes, GTRC nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

## Version

wc3270 4.0ga10

This HTML document and the accompanying troff document were generated with a set of write-only m4 macros and the powerful vi editor.
Last modified 07 July 2020.