TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-324
#REQUESTER Built-In Function
WRITE file-name error-var write-var
creates a write requester and opens file-name for output. For each line added to
write-var with #APPEND(V), the requester writes a record containing that line to
file-name.
If you include the WAIT option, TACL begins executing subsequent code, but if it
encounters #APPEND(V) or #EXTRACT(V) that refers to a requester variable, it
waits until the I/O operation is finished.
If you do not use WAIT, TACL resumes execution. To avoid writing over valid data,
use #WAIT write-var; use #APPEND(V) write-var instead of using #SET(V).
If an error occurs, error-var is set to the error number and further I/O operations
on the requester stop until you clear error-var by setting it to a null value.
file-name
is the name of the file to be written to. If file-name does not exist, TACL
creates an edit-format file; if it does exist, data is appended to the end of the
file.
error-var
is the name of a variable level to hold error codes.
write-var
is the name of a variable level containing the data that is to be written.
Result
#REQUESTER returns zero if it is successful; otherwise, it returns a file-system error
indicating the reason for failure. A TACL error causes an exception rather than
returning an error.
Considerations
The #REQUESTER function does not create a separate requester function. It runs
as part of the TACL process. You read and write data through the use of
associated variables (read-var, prompt-var, and write-var).
The first call to #REQUESTER opens the file and associates the variables with the
file, but does not perform any input or output to the file.
To initiate input for a READ operation, place data in prompt-var (in this
example, defined as pvar):
#APPEND pvar *read next*
Caution. TACL truncates data appended to a write variable associated with a #REQUESTER,
but does not return an error.