I have two scripts. One performs certain job of processing the data. Let say - for the simplicity - it simply calls the DIR on a designated directory and pipes the results to the second script, which is supposed to number the lines. It is easy to implement. However, when the output is too long I would like to break it in pages similar to how DIR /PAGE command does it. To do that I count the output lines in the second script - and try stopping the output while waiting for the user's input.
It does not work. Therefore, how can I achieve this goal?
My simple example.
Script 1:
Code: Select all
$ s_cnt == 3 ! Line counter starts from an arbitrary value
$ if p1 .EQS. "" then p1 := "sys$login"
$ pipe dir 'p1' | @a2
$ exit
Code: Select all
$ page_size = f$getdvi( "SYS$OUTPUT", "TT_PAGE" )
$BEGIN:
$ read /end=EOF sys$pipe line
$ my_line := "''f$string(s_cnt)'. ''line'"
$ write sys$output my_line
$ s_cnt == s_cnt + 1
$ if s_cnt .EQ. page_size - 1
$ then
$ read /end=EOF /error=ERF /prompt="PROMPT: " sys$input sss
$! Debugging output
$ write sys$output "It was ''sss' of length ''f$length(sss)'"
$ s_cnt == 0
$ endif
$ goto BEGIN
$EOF:
$ exit
$ERF:
$ write sys$output "Error!"
$ exit
Mike
Hope this illustrates the problem