Operating System - OpenVMS
1752777 Members
6072 Online
108789 Solutions
New Discussion юеВ

Physical Memory size unit differs from platform to platform

 
SOLVED
Go to solution
RBrown_1
Trusted Contributor

Re: Physical Memory size unit differs from platform to platform


I think that using the lexicals to get the information will be much better for you, because you won't have to do any parsing at all.

You send WRITE SYS$OUTPUT F$GETSYI ("MEMSIZE")

You get back the number of pages.

You send WRITE SYS$OUTPUT F$GETSYI ("PAGE_SIZE")

You get back the page size. You multiply them together and get your memory size in bytes. Dealing with overflow from the multiply is left as an exercise.

For device names, use F$GETDVI. Check out SYS$MANAGER:SYLOGICALS.COM. I think it has some code in it that finds all disk drives and tape drives (search for $DISK and $TAPE). You could use the same method for you application.
Willem Grooters
Honored Contributor

Re: Physical Memory size unit differs from platform to platform

Vineet,

Creating one single software package that will work on all VMS versions and all hardware platforms, _without_ taking the differences into account, is impossible. Different hardware means differences in DCL; between VMS versions there are differences as well; what may work in more recent versions may probably not work in older versions. Output formats may differ as well.

It means you will have to do some math, since DCL won't do it for you, depending on VMS version and hardware.

DCL is capable of supplying most infotrmation you want. Use lexical functions like F$GETDVI and F$GETSYI; these are a far more robust way to get the information than parsing output, but I know you cannot always avoid it.
What possibilities you have can be found in the DCL manual, there are several sources for procedures you can use and integrate.
Willem Grooters
OpenVMS Developer & System Manager
Vineet Deshpande
Frequent Advisor

Re: Physical Memory size unit differs from platform to platform

Yes I agree that DCL command output is going vary. So I guess the best option I have right now if to use Lexical Functions wherever possible and if not then only use DCL commands..

- Vineet
Richard W Hunt
Valued Contributor

Re: Physical Memory size unit differs from platform to platform

Note that on big enough systems, the product of MEMSIZE * PAGE_SIZE will overflow and produce zero.

Your page size will always be an integer multiple of 512 bytes. So divide the page size by 512 bytes before you multiply by memory size. Then divide the result by 2 and you have an exact number of KB (where K = 1024).

I.e.

$ MEMKB = ( F$GETSYI( "MEMSIZE" )/ 2 ) * ( F$GETSYI( "PAGE_SIZE" ) / 512 )

Sr. Systems Janitor
Jon Pinkley
Honored Contributor

Re: Physical Memory size unit differs from platform to platform

RE:"This code of mine is expected to work on all the platoforms(VAX, Alpha and Itanium) and on all versions."

While that seems like a nice goal, I don't think it is realistic.

"All versions" includes V1.0 from August 1978, where many of the current commands did not exist. At that time there was one platform that ran VMS, the VAX/11-780, and VMS would boot on a system with 256KB (that's right, 512 pages of physical memory). The maximum memory supported was 2MB (2048 pages of physical memory).

My point is that there are few systems in existence that are running any version of VMS prior to Version 5, which was released over 20 years ago. You need to come up with a workable minimum version you will support. DCL has evolved along with the new features and increased capabilities of new machines.

If you have to support all versions, you will spend the majority of your time dealing with cases that in all likelihood will never be seen in the field.

Jon
it depends