Operating System - OpenVMS
1827851 Members
1694 Online
109969 Solutions
New Discussion

Re: Spacing - Columns/Tabs

 
SOLVED
Go to solution
Katherine Elliott
Occasional Contributor

Spacing - Columns/Tabs

I am working on a program that is already set up to write the results of a test to a report file which then displays the .rpt file to the screen in list format (see example attached). My question is, can I display the report that is already being generated to the DECTerm in columns with a fixed column width that would allow word wrap if necessary?
8 REPLIES 8
Katherine Elliott
Occasional Contributor

Re: Spacing - Columns/Tabs

Using DCL...sorry I left that out.
Duncan Morris
Honored Contributor

Re: Spacing - Columns/Tabs

Hi Katherine,

welcome to the OpenVMS itrc forum!

From a quick look at your attachment, I would suggest that the lexical f$fao() will provide you with the necessary formatting ability. Have a look at HELP LEXICAL F$FAO DIRECTIVES for a pretty good description.

You can set up the width of each element to suit yourself.

Whether the display will word wrap or not will depend upon the setting of the individual display, rather than any characteristic of your report.
Duncan Morris
Honored Contributor

Re: Spacing - Columns/Tabs

Hmmm. Having checked out your other thread and taking a closer look at your report, I realise that you want the word wrap within a "column". As Hein pointed out, you can do it in DCL - but it will be very convoluted.

Stick with the suggestions in the other thread for this particular report.
Hein van den Heuvel
Honored Contributor
Solution

Re: Spacing - Columns/Tabs

Actually... it wasn't all that hard and kinda fun.

Cheers,
Hein.

------------------------


$ @x x.tmp 20
Node Name = OWS1 | Node Name = OWS2 | Node Name = OWS3
This computer is all | This computer still | This computer still
clear :-) | contains data of typ | contains data of typ
| es a, b, & c. | e c.
| |

Node Name = OWS4 | |
This computer is all | |
clear :-) | |


---------------------------------------

$ @x x.tmp 10 x
OWS1 | OWS2 | OWS3
:-) | types a, b | type c.
| , & c. |
| |

OWS4 | |
:-) | |


------------------------------------

$type x.com
$OPEN/READ in 'p1
$fluff_1 = "This computer is all clear"
$fluff_2 = "This computer still contains data of "
$header = "Node Name ="
$header_length = F$LEN(header)
$GOSUB init_some
$width = 'p2
$
$loop:
$READ/end=done in record
$IF F$EXTR(0,header_length,record).EQS.header
$THEN
$nodes = nodes + 1
$line = 0
$IF nodes .gt. 3
$THEN
$ GOSUB print_some
$ GOSUB init_some
$ nodes = 1
$ lines = 1
$ENDIF
$ENDIF
$
$IF p3.NES."" THEN record = record - header - fluff_1 - fluff_2
$save_chunk:
$line = line + 1
$IF line.GT.lines THEN lines=line
$x_'nodes'_'line' = F$EXTR(0,width,record)
$record = F$EXTR(width,999,record)
$IF F$LEN(record).GT.0 THEN GOTO save_chunk
$GOTO loop
$done:
$gosub print_some
$CLOSE in
$EXIT
$
$print_some:
$l = l + 1 ! Setup in init
$write sys$output f$fao("!#AS | !#AS | !#AS", -
width, x_1_'l, width, x_2_'l, width, x_3_'l)
$if l.lt.lines then goto print_some
$write sys$output ""
$return
$
$init_some:
$nodes = 0
$lines = 0
$line = 0
$n = 0
$node_loop:
$l = 0 ! Still 0 on entry to print_some
$n = n + 1
$if n.gt.3 then return
$line_loop:
$l = l + 1
$if l.gt.10 then goto node_loop
$x_'n'_'l' = ""
$goto line_loop

$type x.tmp
Node Name = OWS1
This computer is all clear :-)

Node Name = OWS2
This computer still contains data of types a, b, & c.

Node Name = OWS3
This computer still contains data of type c.

Node Name = OWS4
This computer is all clear :-)
Duncan Morris
Honored Contributor

Re: Spacing - Columns/Tabs

or another short DCL skeleton attached...

John Gillings
Honored Contributor

Re: Spacing - Columns/Tabs

Katherine,

You might be able to do something clever with control sequences, setting left and right margins, with wrap, just before sending each block of data. I think the sequences you want are:

[?69h (enable margins)
[?7h (enable auto wrap)
[;s (set left and right margins)

What might work is to set the margins to the left of the screen, then output a few report blocks. These should wrap within the margins. Next set the margins to the middle of the screen and reset your cursor to the top ([1;H) and output the next block. Reset margins to the right of the screen and repeat, then set margins back to normal.

[?69l (disable margins)
[?7l (disable auto wrap)

I haven't been able to make this work, but at the moment I have only VERY old DECterms to play with.
A crucible of informative mistakes
John Gillings
Honored Contributor

Re: Spacing - Columns/Tabs

Katherine,

Yes, this can be done with control sequences, BUT it needs VT420 or better. DECterms only do VT340 :-(

Attached is a text file with some of your data, and the necessary control sequences added. just TYPE the file at a VT4xx or VT5xx terminal or emulator.

A crucible of informative mistakes
Michelle Popejoy
Frequent Advisor

Re: Spacing - Columns/Tabs

All interesting solutions.

Playing just a bit more with the VT400+ escape sequences, if you put the terminal in 132 column mode and use 4 columns of slightly wider width instead of 3, you should get all 21 on a single screen.
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931)