S3270 protocol

Description
The s3270 protocol is a script framing protocol originally defined by s3270. It is the protocol used by s3270 on its standard input and standard output. It is the protocol used on TCP sockets between peer scripts and the emulator, defined by the scriptport resource. It is the default protocol used between the emulator and a script started by the Script action on Windows, and optionally on POSIX.

The basic model is:
 * The script sends a line containing actions and parameters, terminated by a newline character.
 * The emulator responds with two or more lines of output, also terminated by newline characters. (On s3270 on Windows standard output, the lines are terminated by a CR-LF sequence.)

Note that because the script has to initiate the sequence, the behavior of s3270 run from the command-line appears to be a little disappointing -- it does nothing. Pressing the Return key will send it an action to process (actually no action) and it will respond appropriately.

Data
Each line of output produced by the action is prefixed by the string. (Many actions produce no output, of course). If the command succeeds, this is the result of its operation. If it fails, it is an error message. The script must examine the success indication to determine which it is.

Prompt line
The s3270 prompt is a twelve-field line containing the current state of the emulator. It has largely been superseded by the Query action. The fields are:
 * Keyboard status
 * for unlocked
 * for locked
 * for locked due to operator error


 * Formatting status of the screen
 * for formatted
 * for unformatted


 * Protection status of the current field
 * for unprotected
 * for protected


 * Host connection status
 * for not connected
 * for connected


 * Emulator mode
 * for not connected
 * for connected in NVT character node
 * for NVT line mode
 * for negotiation pending
 * for connected in 3270 mode


 * Model number
 * 2, 3 4 or 5


 * Number of rows on the display
 * Number of columns on the display
 * Cursor row (0 is the top row)
 * Cursor column (0 is the leftmost column)
 * Main window ID
 * The X11 window ID in hexadecimal, if applicable,  if not


 * Timing
 * The time required to execute the last command in seconds, a decimal value with millisecond resolution

Success indication
The last line of output is a single token:  if the command succeeded, and   if the command failed

Examples
The result of running  on an idle s3270. data: UTF-8 L U U N N 4 24 80 0 0 0x0 0.000 ok The result of running  on an idle s3270. data: Query: Unknown parameter L U U N N 4 24 80 0 0 0x0 0.000 error