# x3270if Manual Page

## Contents

> Name
> Synopsis
> Description
> Options
> Exit Status
> Environment
> See Also
> Copyright

## Name

x3270if - command interface to x3270, c3270 and s3270

## Synopsis

x3270if [option]... [ action ]
x3270if -i

## Description

x3270if provides an interface between scripts and the 3270 emulators x3270, c3270, and s3270.

x3270if operates in one of two modes. In action mode, it passes a single action and parameters to the emulator for execution. The result of the action is written to standard output, along with the (optional) status of the emulator. (The action is optional as well, so that x3270if can just reports the emulator status.) In iterative mode, it forms a continuous conduit between a script and the emulator.

The action takes the form:

action-name(param[,param]...)

The parentheses are manatory, and usually must be quoted when x3270if is called from a shell script.

If any param contains a space or comma, it must be surrounded by double quotes.

## Options

-s field
  Causes x3270if to write to stdout the value of one of the emulator status fields. Field is an integer in the range 0 through 11. The value 0 is a no-op and is used only to return exit status indicating the state of the emulator. The indices 1-11 and meanings of each field are documented on the x3270-script(1) manual page. If an action is specified as well, the status field is written after the output of the action, separated by a newline. The -s option is mutually exclusive with the -S and -i options.
-S
  Causes x3270if to write to stdout the value of all of the emulator status fields. If an action is specified as well, the status fields are written after the output of the action, separated by a newline. The -S option is mutually exclusive with the -s and -i options.
-i
  Puts x3270if in iterative mode. Data from x3270if's standard input is copied to the emulator's script input; data from the emulator's script output is copied to x3270if's standard output. The -i option is mutually exclusive with the -s and -S options. x3270if runs until it detects end-of-file on its standard input or on the output from the emulator. (This mode exists primarily to give expect(1) a process to run, on systems which do not support bidirectional pipes.)
-p process-id
  Causes x3270if to use a Unix-domain socket to connect to the emulator, rather than pipe file descriptors given in environment variables. The emulator must have been started with the -socket option.
-v
  Turns on verbose debug messages, showing on stderr the literal data that is passed between the emulator and x3270if.

## Exit Status

In action mode, if the requested action succeeds, x3270if exits with status 0. If the action fails, x3270if exits with status 1. In iterative mode, x3270if exits with status 0 when it encounters end-of-file. If there is an operational error within x3270if itself, such as a command-line syntax error, missing environment variable, or an unexpectedly closed pipe, x3270if exits with status 2.

## Environment

Unless the -socket option is given when they are started, x3270, c3270, and s3270 use a pair of pipes for communication with each child script process. The values of the file descriptors for these pipes are encoded as text in two environment variables, which are required by x3270if:

X3270OUTPUT
  Output from the emulator, input to the child process.
X3270INPUT
  Input to the emulator, output from the child process.

## See Also

x3270(1), c3270(1), s3270(1), x3270-script(1)

## Copyright

Copyright © 1999, 2000, 2001, 2004, 2005 by Paul Mattes.

> Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

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 28 August 2008.