x3270if is a utility program for interfacing with the x3270 family. It implements the client side of the s3270 protocol, making it easy for simple scripts to communicate with the emulator. It also implements the x3270> prompt on all of the emulators except c3270 and wc3270.

If the method to connect to the emulator is not specified on the command line, x3270if will use the environment variables set by the Script() action to make the connection via pipes or a TCP socket. It will not use HTTP.

New in 4.4 x3270if will place error messages on its standard error output, and ordinary messages on its standard output. Prior to 4.4, all messages from the emulator went to standard output.

Command-line parameters

-i
Shuttle raw data between stdin/stdout and the emulator.
-H action
Display action as the name of the action to invoke for help information. Requires -I.
-I prompt
Implement the x3270> prompt with prompt as the prompt string.
-p pid
Connect to the emulator via the Unix-domain socket associated with process ID pid. (POSIX only.)
-P
Use pipe file descriptors instead of a socket, if both are available from the environment. (POSIX only.)
-s index
Display the prompt field index (0..12).
-S
Display the entire prompt string.
-t port
Connect to the emulator via 127.0.0.1, port port , using the s3270 protocol.
-v
Enables verbose operation, tracing input and output data to standard error output.
--version
Display version information and exit.

Unless -i, -I, -s, -S or --version is given, a single positional option must be supplied, which specifies an action and optional parameters. The output of the action will be written to standard output. Exit status from x3270if will be 0 if the action succeeds, 1 if it does not.

The -i, -I and -s/-S parameters are mutually-exclusive.

Security cookies

New in 4.4 Except when -i or p is specified, x3270if automatically supplies a security cookie to the session if X3270COOKIEFILE is defined in the environment.

Examples

Run a simple command from a script.

x3270if "String(hello)"

Run a command from an external script, connecting to a port specified by the emulator option -scriptport 9999.

x3270if -t 9999 "String(hello)"

Implement the x3270>, with xyz3270> as the prompt.

x3270if -I xyz3270