Operating System - OpenVMS
1828667 Members
1768 Online
109984 Solutions
New Discussion

Need help scripting a show free disk space script.

 
SOLVED
Go to solution
Victor Mendham
Regular Advisor

Need help scripting a show free disk space script.

I moved a DCL script for a VAX OpenVMS 6.2 to an Alpha running 7.3-1. The Vax had several 4 Gb drives, the Alpha has 2 24 GB drives. The size seems to mess up the script, so that I report 2205 free space. Can anyone help fix the script?

Now I have several scripts, each slighly different, and 2 that are not reporting correctly.

*** DISK SPACE STATISTICS OF MOUNTED DISKS ***
*****************************


Disk Stats 26-MAY-2004 12:31:28.10

Device Logical Free Total Open
Name Name Blocks Blocks Usage Files I/Os Errors
------------- ---------- --------- --------- ------- ----- --------- ------
$1$Dka1: OVMS731 24017282 48828160 0.* % 625 13486555 0
$1$Dka2: Application 39993146 48828160 18.0 % 190 21962506 0
------------- ---------- --------- --------- ------- ----- --------- ------
64010428 97656320 34.0 % 815 35449061 0

I/Os are cumulative since 1-JAN-2004 21:12:27.00.


*** DISK SPACE STATISTICS IN MEGS ***
*****************************

Megs Megs Megs Percent
Disk Total Used Free Free Volume
-------------- ------- ------- ------- ------- ------------
_$1$Dka1: 23841 12114 11727 49.19% OVMS731
_$1$Dka2: 23841 4313 19527 81.91% Application
-------------- ------- ------- ------- ------- ------------
Totals 47683 16428 31255 65.55%

This one shows as

Device Type Blks Free Blks Used Pcnt 0% 25% 50% 75% 100%
$1$DKA1: DGX0 24017282 24810878 220% |8* |
$1$DKA2: DGX0 39993146 8835014 18% | |


16 REPLIES 16
Victor Mendham
Regular Advisor

Re: Need help scripting a show free disk space script.

The other script which is having a problem is included here.

Note, These are not proprietry scripts as they were originally pulled pre 2000 from comp.os.vms and modified by myself for use on various OpenVMS servers.
Antoniov.
Honored Contributor

Re: Need help scripting a show free disk space script.

Hi Victor,
you go in arithmetic overflow in this statement:
$ PERCENTUSED = ((USEDBLOCKS*100) + (TOTALBLOCKS/2)) / TOTALBLOCKS
because USEDBLOCKS*100 is greater then 2147483647 that's the biggest value of DCL integer.
You could evaluate all value in Kb or Mb such as:
$ USEDMB = USEDBLOCKS / 2048
then evaluate using MB

H.T.H.
Antonio Vigliotti
Antonio Maria Vigliotti
Hein van den Heuvel
Honored Contributor
Solution

Re: Need help scripting a show free disk space script.


$ USEDBLOCKS = TOTALBLOCKS -FREEBLOCKS ! Used blocks
$ PERCENTUSED = ((USEDBLOCKS*100) + (TOTALBLOCKS/2)) / TOTALBLOCKS

The factor with the divide by 2 is for roundup right?

Anyway, there is a 32 bit problem if you multiplly on the left. It is safer to divide on the right first, or go to MB all the way by dividing all blocks values by 2048

Suggested change:

$ USEDBLOCKS = TOTALBLOCKS - FREEBLOCKS ! Used blocks
$ PERCENTUSED = (USEDBLOCKS + (TOTALBLOCKS/200)) / (TOTALBLOCKS/100)


Hein.



Victor Mendham
Regular Advisor

Re: Need help scripting a show free disk space script.

Hein,

Many Thanks, it works great.
Jan van den Ende
Honored Contributor

Re: Need help scripting a show free disk space script.

Victor,

if you are looking for a ready-to-run procedure, a while back I posted one at dcl.openvms.org
http://dcl.openvms.org/stories.php?story=04/01/27/9890517

(mind the wrap!)

And if you like one that gives a continues display, update every (you decide) minutes,
to run in a Decwindows display, have a look at
http://dcl.openvms.org/stories.php?story=04/01/27/5207367
as well.

Enjoy!

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Victor Mendham
Regular Advisor

Re: Need help scripting a show free disk space script.

Jan,

I may have made a mistake when I copied the space.com file over as I get the following error when I test on my dev system. I will have to spend some time looking over the script.

@space
%DCL-W-MAXPARM, too many parameters - reenter command with fewer parameters
\DISK\
%SYSTEM-F-BADPARAM, bad parameter value
\!5!13!11!6!9!9!10!9!13!3!8\

The other file seems to run ok.

Very interesting site. Seems to have a ton of scripts.
Martin P.J. Zinser
Honored Contributor

Re: Need help scripting a show free disk space script.

Hello Victor,

you might be interested in the /size=bytes
qualifer to various commands. I think it was introduced with 7.3-1 (it definitly is in 7.3-2)

Plus there is the "free" utility from Hunter Goatley, which should do pretty exactly what you are looking for.

http://vms.process.com/scripts/fileserv/fileserv_search.exe?package=free&description=&author=&system=Either&language=All

Greetings, Martin
Jan van den Ende
Honored Contributor

Re: Need help scripting a show free disk space script.

Victor,

thanks for the error message!.

I checked my routine again, and it works fine.
So, I took a very close look at the procedure as posted, and at first I couldn't understand. Your message pointed to the FAO params, and then I saw it:
The problem stems from HTML processing.
The roots of SPACE.COM are lost in time, but way back when I started with some procedure that had a good example of extensive f$FAO use.
It uses as FAO syntax to specify a counted string output specification:
!5 for string symbol, or
!9 for space-filled numeric.
This syntax isn't even in the manuals (anymore?).
And here is the root of the problem: HTML parsing assumes "< ... >" to be a directive.
In this case, un unknown directive, so it is simply removed....
I converted the F$FAO statement directives to new syntax, and that works (on my system) just the same.

I am rather surprised no-one complained before..

I will do an upload of the new version, and ask Ken to replace the old one.

Thanks again for the notification!

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Victor Mendham
Regular Advisor

Re: Need help scripting a show free disk space script.

Jan,

Please let me know when the new version is uploaded and I will download it and try it out.
Jan van den Ende
Honored Contributor

Re: Need help scripting a show free disk space script.

Victor,

Ken has found my upload & released it.
He named it SPACE.COM V2
At a quick glance it looks like the f$fao params now seem OK.

Success, have fun!

Jan


Don't rust yours pelled jacker to fine doll missed aches.
Art Wiens
Respected Contributor

Re: Need help scripting a show free disk space script.

No need to wait if you're anxious ;-), view the source of the page ... the "tags" are still there.

Just for fun, let's put them in this box and see if they show up:

1st one:

$ TEXT= F$FAO -
("!28!7!9!9!10!9!13!3!8",-
space,unt,FRE_t,USE_t,tot_t,mag_t,gaatut,PERCFULL,eind)

2nd one:

$ TEXT= F$FAO -
("!28!7!9!9!10!9",-
space,unt,FRE_t,USE_t,tot_t,mag_t)

3rd one:

$ text= f$fao -
("!5!13!11!6!9!9!10!9!13!3!8",-
space,name,disk,hw,freeblocks,usedblocks,max,mag,gaatut,percfull,eind)

Thanks for the com!
Art
Art Wiens
Respected Contributor

Re: Need help scripting a show free disk space script.

I can play around with it myself to tweek it, but just a note Jan, it has a few alignment issues w/ larger array sizes.

This isn't a complaint, I read the disclaimer, I know I'm getting what I paid for! ;-)

What you don't see in the attached text file though, is that the shading used for the warning percentages does work very nicely! Cool!

Thanks again,
Art
Jan van den Ende
Honored Contributor

Re: Need help scripting a show free disk space script.

Art,

Like you say, you get what you pay for.
But then again, I got hit by my own (usually absent!) exagerated sense of neetness.
What I did do before posting was a 'nice' cleanup of traces of all debug & modification and change-comments & whatever.
Next, the filter between our intranet & the "evil big world" does (among a lot of other misery) block any .EXE & .COM
So, I converted it to a nice, clean .TXT

And thereafter we also got bigger disks, so for the ACTIVE .COM procedure we did update the formatting, and the version on dcl.openvms.org missed that.

But for now, I leave it to anyone needing it do do the excersize him/herself.
Hit: cannibalise the leading spaces!

fwiw

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Steve Reece
Advisor

Re: Need help scripting a show free disk space script.

I took an alternative approach to this by writing (or, more accurately, canibalizing someone else's) C program to do the arithmetic for me. I had a number of raidsets and stripesets in a previous job that were in the region of 54GB so the DCL arithmetic I'd used on my previous workstation environments didn't work...
"Try not! Do, or Do not. There is no try!"
Victor Mendham
Regular Advisor

Re: Need help scripting a show free disk space script.

Steve, Is your's proprietary or can you send it as an attachment, so I can take a look?

Also to any our American Neighbors to the South (I'm in Canada), Happy Memorial Day.

Vic..
Art Wiens
Respected Contributor

Re: Need help scripting a show free disk space script.

Boy, I had forgotten how much "fun" F$FAO was!! Still not perfect, but for what it's worth (exactly what you paid for it ;-), here's my "anglo-sized" version of Jan's procedure.

Same disclaimer plus:

IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED, OR INTENDED FOR USE OR RESALE AS ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF TECHNOLOGY COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE.

But I'ld be real sorry if any of that did happen!!

Cheers,
Art