How to break output in pages from within a pipe-invoked DCL script?

Post Reply

Topic author
mfaynberg
Member
Posts: 5
Joined: Wed Oct 04, 2023 6:17 pm
Reputation: 0
Status: Offline

How to break output in pages from within a pipe-invoked DCL script?

Post by mfaynberg » Mon Apr 22, 2024 5:38 pm

Hello,
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
Script2:

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
Thank you!
Mike

Hope this illustrates the problem


dgordon
VSI Expert
Valued Contributor
Posts: 63
Joined: Tue May 09, 2023 7:57 am
Reputation: 1
Status: Offline

Re: How to break output in pages from within a pipe-invoked DCL script?

Post by dgordon » Mon Apr 22, 2024 6:04 pm

Try the following example:

$ PIPE DIRECTORY/COLUMN=1 | SEARCH/MATCH=NOR/NUMBER SYS$INPUT: "GOBBLDYGOOK" | TYPE/PAGE SYS$INPUT:

Hopefully that will give you a start in the direction you wish to go.
Executive Vice President of InfoServer Engineering at VSI.


Topic author
mfaynberg
Member
Posts: 5
Joined: Wed Oct 04, 2023 6:17 pm
Reputation: 0
Status: Offline

Re: How to break output in pages from within a pipe-invoked DCL script?

Post by mfaynberg » Mon Apr 22, 2024 6:57 pm

Dgordon, thank you!
It does the thing! That's the lesson for me: I did not consider another piping stage...
Best regards,
Mike

Post Reply