S3270 protocol

Description
The s3270 protocol is a script framing protocol originally defined for s3270. It is the protocol used by s3270 on its standard input and standard output, and optionally by x3270 in the same way. It is the protocol used on TCP sockets between peer scripts and any x3270 family emulator, defined by the scriptPort resource. It can also be used between the emulator and a script started by the Script action.

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 with a prompt.

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 prompt line has twelve fields, separated by spaces, containing the current state of the emulator. It has largely been superseded by the Query action. The fields are:
 * Keyboard status
 * unlocked
 * locked
 * locked due to operator error


 * Formatting status of the screen
 * formatted
 * unformatted


 * Protection status of the current field
 * unprotected
 * protected


 * Host connection status
 * not connected
 * connected or connection pending


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


 * Model number
 * ,    or


 * 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