1824993 Members
2179 Online
109678 Solutions
New Discussion юеВ

Re: DIsplaying a table

 
SOLVED
Go to solution
Katherine Elliott
Occasional Contributor

DIsplaying a table

This question is kind of piggybacking on my first one. As you saw in the attachment, at the end of every "This computer is clear statement" there is a :-). Is there some way to create and display a table from a .rpt file that has two different columns - one would list all workstations whose results report contained a :-) and the other column would list the workstations that didn't contain a :-)? I have reattached the document do you can see exactly how the print out looks.
9 REPLIES 9
Katherine Elliott
Occasional Contributor

Re: DIsplaying a table

Using DCL...sorry I forgot to include that.
Jan van den Ende
Honored Contributor

Re: DIsplaying a table

Katherine,

to begin with:
Welcome to the VMS forum!

I am not sure if I understand your question correct.
Is your attachment showing your .RPT file proper? In other words, do you just need a reformatting program? If not, can you post a .RPT file?
If the top halve of your post _IS_ the .RPT, then a simple DCL will be all you need (and I am sure Hein will show up with a perl solution).

Please supply more info.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Katherine Elliott
Occasional Contributor

Re: DIsplaying a table

First, thanks for the welcome! Yes the .rpt file is showing up fine. It is being displayed as a list and since I have 21 work stations, the list is quite lengthy and carries over onto about 3 screens. What I would like to do is to be able to display all 21 .rpt files on one screen - either in columns or in a table.
Hein van den Heuvel
Honored Contributor
Solution

Re: DIsplaying a table

Hello Katherine,

fwiw... Your questions are close enough, that they would have best been left as a single topic IMHO.

Do you have any (DCL) starting point already?

Your first question is pretty tricky. Not hard hard, but probably a fair amount of work. If you insist on using DCL, then I'd suggest check out F$FAO. This is not the easiest lexical function to get going, but it is the best/only way to get clean formatting.

I would recommend PERL for text processing challenges like this one. DCL can do it, but it'll be tedious.

But anyway, I like the current question/direction better.

Why not list all 'happy' nodes at the bottom, and give problematic systems the full line space they deserve?!

Here is a sample script to get you going on that:

$ type x.com
$OPEN/READ in 'p1
$header = "Node Name ="
$clear = ""
$header_length = F$LEN(header)
$loop:
$READ/end=done in record
$IF F$EXTR(0,header_length,record).EQS.header
$THEN
$node = F$EXTR(header_length,99,record)
$READ in record
$IF F$LOC(":-)",record).NE.F$LEN(record)
$THEN
$clear = clear + node
$ELSE
$WRITE SYS$OUTPUT header, node
$WRITE SYS$OUTPUT record
$ENDIF
$ELSE
$WRITE SYS$OUTPUT record
$ENDIF
$GOTO loop
$done:
$WRITE SYS$OUTPUT ""
$WRITE SYS$OUTPUT "These computers are all clear: ", clear
$CLOSE in
$

And here is sample output for that script:

$ @x x.tmp

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

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


These computers are all clear: OWS1 OWS4




Hope this helps,

Hein.
Jan van den Ende
Honored Contributor

Re: DIsplaying a table

Katherine,

so, your MAIN issue is getting them on one screen?

My quickest take would be to append the data concerning a node on the node ID line.

Here is a try:

$ OPEN /READ IFI
$ OPEN/WRITE OFI
$LOOP:
$ READ IFI REC/END=DONE
$ REC = F$EDIT(REC,"TRIM"")
$ IF REC .EQS. "" THEN GOTO LOOP
$ IF F$ELEMENT(0," ",REC) .EQS. "Node"
$ THEN
$ LINE = F$FAO("!20AS",REC)
$ GOTO LOOP
$ ENDIF
$! data line:
$ LINE = LINE + REC
$ WRITE OFI LINE
$ GOTO LOOP
$
$DONE:
$ CLOSE IFI
$ CLOSE OFI
$ TYPE
$! Cleanup or save, as needed.

DISCLAIMER: UNtested!


Of course, you WILL get a pretty loaded screen, but that is what you asked for!.

Success.

Proost.

Have one on me.

jpe

Don't rust yours pelled jacker to fine doll missed aches.
Doug Phillips
Trusted Contributor

Re: DIsplaying a table

Katherine,

Do you want to modify the program that generates the report or do you need to create a new program that reformats the output before it's displayed?

It would be easier if you can modify the generating program.

The current report has too much redundant text:

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.

You know it's the node name. Just display it.
You know it's a computer. You really only want to know the status. So all you need is:

OWS1 clear
OWS2 a,b,c
OWS3 c

Write a title like "Node Status" at the top.

Now, loop to build your display line with as many nodes "up" as you want (5 max will fit).

Why not just display the "not-clear" nodes if those are the ones you're concerned with? Then at the end display count totals for clear & un-unclear nodes.

It's just programming.

-Doug
Katherine Elliott
Occasional Contributor

Re: DIsplaying a table

Doug,
This sounds like a good plan but I still need the output to be in preferrably 3 columns so that all results can be seen on one screen.
Doug Phillips
Trusted Contributor

Re: DIsplaying a table

Look at help for the lexical F$FAO.

$ HELP LEX F$FAO

While it seems complicated at first, the examples should show you how you can format the display line.

To process the .rpt file you have (q&d, not tested):

$!...do housekeeping stuff
$ open/read rpt filename.rpt
$!...
$loop1:
$ c1 = ""
$ c2 = ""
$ c3 = ""
$ cnt = 0
$!
$loop2:
$ read/end=finish rpt inrec
$ if f$extract(0,4,inrec) .eqs. "Node"
$ then
$ cnt = cnt + 1
$ nodex = inrec - "Node Name = "
$ read/end=error1 rpt inrec
$ if f$extract(0,4,inrec) .eqs. "This"
$ then
$ statusx = inrec - "This computer" -
- "is all " - " :-)" -
- "still contains data of type" -
- "s" - "& "
$ c'cnt' = f$fao("!6AS!10AS",nodex,statusx)
$ else
$ goto error1 !missing record
$ endif
$ goto loop2 !skip blank lines
$ endif
$!
$ if cnt .lt. 3 then goto loop2
$ call showit
$ goto loop1
$finish:
$ if cnt then call showit
$! display whatever eoj data you want.
$ write sys$output ""
$ read/prompt="Press ENTER " sys$command inp
$ goto quit
$error1:
$! incorrect or missing report record,
$! display error message and ask for ack.
$quit:
$ close rpt
$ exit
$!
$showit: subroutine
$ write sys$output -
f$fao(" !#(20AS)",cnt,c1,c2,c3)
$exit
$endsubroutine

You could test statusx .eqs. "clear" and increment a count which you display at the end instead of loading clear into column.

Please forgive any typo's. I haven't really tested this code ('cause I don't have your file;-)
Doug Phillips
Trusted Contributor

Re: DIsplaying a table

Katherine,

I had a couple of minutes to test the q&d code against your 4 examples and made a couple of revisions. See attachment. The code is between the $!----<>---- lines. You'll need to add error testing & change the filename.rpt to whatever you need & polish it up some.


-Doug