HELP
An object that spawns a child process, either
directly or through a command shell.

USE
Use HP-UX Escape to communicate with programs
external to HP VEE.  Communication to the
external program is handled through the
standard UNIX* mechanism of stdin and
stdout.  

Use HP-UX Escape to run any executable
user written program or HP-UX system
commands.

In general, you need to add or modify
transactions to accomplish useful results.
To add a transaction, select Add Trans in the
object menu.  To edit a transaction,
double-click on the transaction and complete
the resulting dialog box.

LOCATION
I/O ==> HP-UX Escape

OBJECT MENU

* Config - Allows you to view and edit the
formatting configuration for data transmitted
to and from the spawned process.

* Add Trans - Adds a transaction to the end
of the list.

* Insert Trans - Inserts a transaction before
the currently highlighted transaction.

* Delete Trans - Deletes the currently
highlighted transaction.

OPEN VIEW PARAMETERS
* Shell - The HP-UX shell to communicate
with.  If the Shell field is set to none, the
first token in the Pgm with params field is
assumed to be the name of an executable file.
Each token after the first is assumed to be a
command-line parameter.  The executable is
spawned directly as a child process of 
HP VEE.  All other things being equal, HP-UX
Escape operates fastest when Shell is set to
none.

If the Shell field specifies a shell, 
HP VEE spawns a process corresponding to the
specified shell.  The string contained in the
Pgm with params field is passed to the
specified shell for interpretation.
Generally, the shell spawns additional
processes.

* Wait for child exit - If Wait for child
exit is set to Yes, HP VEE performs the
following tasks:

1.  Spawns a child process.

2.  Executes all transactions specified in
the HP-UX Escape object.

3.  Closes all pipes to the child process
(thus sending an EOF to the child).

4.  Waits until the child process
terminates before activating the sequence
output pin of the HP-UX Escape object.

If Wait for child exit is set to No,
HP VEE performs the following tasks:

1.  Checks to see if a child process
corresponding to the HP-UX Escape object is
active.  If one is not already active, HP VEE
spawns one.

2.  Executes all transactions specified in
the HP-UX Escape object.

3.  Activates the sequence output pin of
the HP-UX Escape object.  The child process
remains active and the corresponding pipes
still exist.

All other things being equal, HP-UX Escape
operates fastest when Wait for child exit is
set to No.

* Pgm with params - The program you want to
run.

Here are examples of what you typically
type into the Pgm with params field:

To run a custom C program (Shell field set
to none):

ls -t *.dat

To run a shell command (Shell set to ksh):

MyProg -optiona -optionb

To run a program using one of the shell
dependent features, you could set "shell" to
"sh" and enter the command into the "shell
command" line:  MyProg *.dat.  This forces
the "sh" to pass as command line parameters
all the files that end in ".dat".  NOTES
If you use shell-dependent features in the
Pgm with params field, you must set a shell
in the Shell field to achieve the desired
result.  Common shell-dependent features are:
* Standard input/output redirection 
(< and >).
* File name expansion using wildcards (*, ?,
and [a-z]).
* Pipes ().

When using HP-UX commands, the input to
the commands must not come from HP VEE.
There is no way to close the input pipe to
the child process under programmatic control,
to tell the HP-UX program that you have
finished sending input and for it to finish
sending input and it can operate.  For
example, you cannot use "sort" to sort an
arbitrary list of things.  Another programs
that cannot be used is "wc."

If you use a program like "ls" that only
lists files in a directory, you need to know
how many lines to read into HP VEE with the
READ transaction.  There READ transaction
cannot read until it finds an EOF.

EXAMPLE
Here is a simple C program to read a number
from stdin, add one to it, and send it back
to HP VEE by way of stdout.  The stdout
buffering must be turned off.  This is done
in one of two ways.  The first way is with
the "setbuf(stdout,NULL)" statement, which
turns buffering off.  The second technique is
to leave the stdout buffering on then use the
"fflush(stdout)", command to flush the output
buffer back to HP VEE.

#include <stdio.h>
main ()
{
  int c; double val;
  setbuf(stdout,NULL); 
     /* turn stdout buffering off */
  while (((c=scanf("%lf",&val))!=EOF) & c>0) { 
     /* read a value */
  fprintf(stdout,"%g\n",val+1; 
     /* add one to the input value */
  fflush(stdout); 
    /* force output back to main pgm */ 
  } 
  exit(0); 
}

SEE ALSO
HP BASIC/UX, From StdIn, To/From
Named Pipes, and To StdOut.

"Using Transaction I/O" in "Using HP VEE",
chapter 9.

* UNIX is a registered trademark of UNIX  
System Laboratories Inc. in the U.S.A. 
and other countries.
