Requesting Nowaited Writes
Accessing Files
107365 Tandem Computers Incorporated
4–9
Use the routine in Figure 4-4,
nowaited_write
, to perform nowaited writes to the
file specified in the first argument in the invocation. If the file already contains data,
this routine appends the new data to the end of the file. To invoke this routine, load
the file and type:
nowaited_write
filename
Figure 4-4. Reading From a Terminal and Performing a Nowaited Write
?SECTION nowaited_write ROUTINE
#FRAME
#PUSH open_error write_error write_data write_prompt line
#PUSH write_file rslt
#SET #INPUTEOF 0
#SET rslt [#ARGUMENT /VALUE write_file/ FILENAME OTHERWISE]
[#CASE [rslt]
|1|
== Open the file:
#SET open_error [#REQUESTER WRITE [write_file]
write_error write_data]
[#IF [open_error] |THEN|
#OUTPUT *** Error opening [write_file]: [open_error]
#RETURN
]
[#LOOP |DO|
[#CASE [#VARIABLEINFO/VARIABLE/
[#WAIT write_data write_error]]
|write_data |
#APPEND write_data [#INPUT b_:]
|write_error|
#OUTPUT Error [write_error] on write
]
|UNTIL| [#INPUTEOF]
]
|OTHERWISE|
#OUTPUT *** Error: Invalid file ***
#RETURN
] == end #CASE
SINK [#REQUESTER/WAIT/CLOSE write_data]
#UNFRAME