# USER

Syntax:

Then: USER label = progname

Version Ref: 3.x NIX only (not included in filePro Lite)

Version Ref: 5.7.04 Windows supports this command (not included in filePro Lite)

Version Ref: 5.8.02 Added timeout parameter (not included in filePro Lite)

Description:

Send/receive data to/from user supplied program. (UNIX/XENIX only)

Examples:

As in lookups, there are two steps. First you identify the user program name:
Then: user prgname

Then: user prgname=pathname

where:

"prgname" is the name you assign to the external program. You must use the complete pathname if the user program is not in the current directory. Next, you set up field assignments. To write to a user program, use this syntax:

Then: prgname=m

where "prgname" is the external program and "m" is a filePro Plus field or expression. To write a number of arguments, repeat the statement: prgname=m; prgname=n; prgname=o; and so on.

To read from a user program:

Then: m=prgname

where:

"m" is a filePro Plus field
"prgname" is the external program

To read in a number of assignments, repeat the statement: m=prgname: n=prgname: o=prgname; and so on.

To test for an end-of-file or program termination, put the user program name on the condition line.

You can now also specify a timeout (in milliseconds):
user alias = ( command, timeout )
When reading from the user command, if nothing is received within that many milliseconds, the read will return a null string -- "" -- and you can put "timeout(alias)" on an "if" line to see if the null string was because of a timeout.

When you make an assignment to a user program, filePro Plus writes to the user program's standard input. The field ent will be terminated with a "\n" (new-line character). When you read in values or otherwise reference the userprogram, filepro Plus will read from the standard output of the user program (up to a new-line character).

When you read in values or otherwise reference the user program, filePro Plus will read from the standard output of the user program (up to a new-line character).

IMPORTANT: When reading from a user program, filePro Plus executes the program only once, not over and over. Therefore, make sure the user program itself loops until it reaches an end-of-file. If you wish to run the same user command more than once you must close it before rerunning it.

close 'prgname'

Also, when using the user command, do not add any other functions to the same line as the user command as it will render the command invalid.