EasyManua.ls Logo

HP TACL - Figure 4-2 Performing a Nowaited Read

HP TACL
235 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Requesting Nowaited Reads
Accessing Files
107365 Tandem Computers Incorporated 4–5
This routine uses #VARIABLEINFO/VARIABLE/ to return a variable name to the
#CASE statement. #VARIABLEINFO/VARIABLE/ returns the name of a variable
without the level number so that it will match one of the labels. The #WAIT built-in
function, when used alone, returns the variable name with the level number.
Figure 4-2. Performing a Nowaited Read
?SECTION nowaited_read ROUTINE
#FRAME
#PUSH open_error read_error read_data read_prompt line
#PUSH read_file rslt
#SET rslt [#ARGUMENT /VALUE read_file/ FILENAME OTHERWISE]
[#CASE [rslt]
|1|
== Open the file:
#SET open_error [#REQUESTER /WAIT/ READ [read_file]
read_error read_data read_prompt]
[#IF [open_error] |THEN|
#OUTPUT *** Error opening [read_file]: [open_error]
#RETURN
]
#SET read_error 0
[#LOOP |WHILE| NOT [read_error] |DO|
#APPEND read_prompt *start*
[#CASE [#VARIABLEINFO/VARIABLE/
[#WAIT read_data read_error]] |THEN|
|read_data |
#EXTRACTV read_data line
#OUTPUTV line
|read_error|
== exit loop
] == end case
] == end loop
|OTHERWISE|
#OUTPUT *** Error: Invalid file ***
#RETURN
] == end #CASE
[#IF read_error = 1 |THEN|
#OUTPUT *** End of file ***
|ELSE|
#OUTPUT *** Error reading [read_file]: [read_error]
]
SINK [#REQUESTER/WAIT/CLOSE read_data]
#UNFRAME

Table of Contents

Related product manuals