MPE CI Programming for 7.5
July 22, 2008
Page 43
hp e3000
strategy
file i/o
• why not use INPUT in WHILE to read a flat file?, e.g.:
while not eof do
input varname < filename
endwhile
• answer: the CI opens and closes “filename” each iteration, thus
you will be reading the 1
st
record over and over…
• three main alternatives:
• write to (create) and read from a MSG file via I/O redirection
• use :PRINT and I/O redirection to read file 1 record at a time
• use entry points and I/O redirection
• MSG file works because each read is destructive, so next INPUT
reads next record