Operating System - OpenVMS
1752812 Members
5660 Online
108789 Solutions
New Discussion юеВ

Using hint values from rms to get filesize

 
Tom Gates
New Member

Using hint values from rms to get filesize

Hi all,

I was wondering, how do i use the hint values provided by VMS for FIX and VFC files.
The data part is said to be with out any extra paddings ...
So how can we get the file size?
record_count + data_count or as every record is terminated with CRLF, shouldn't it be appropriate to use (2*record_count + data_count) for getting file size ... but then will it hold good for all the cases?
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: Using hint values from rms to get filesize

> [...] the hint values [...]

The what?

> [...] said to be [...]

Who says what, exactly?

> So how can we get the file size?

Define "file size". VMS normally keeps track
of the disk space occupied by a file, but
whether that can be translated into a useful
byte count can depend on what's in the file.

To see what's really in a file:

HELP DUMP

Don't expect to see actual CR or LF
characters in a non-stream record format
file.

Is there some actual problem which you are
trying to solve?
John Gillings
Honored Contributor

Re: Using hint values from rms to get filesize

Tom,

Depends on what you mean by "filesize"

From DCL, F$FILE_ATTRIBUTES ALQ will give you the allocated disk space, some of which will probably be unused.

> (2*record_count + data_count) for getting
>file size ... but then will it hold good
>for all the cases?

No. Metadata size depends on the record format, and record lengths as odd lengths are padded.

For sequential files, EOF and FFB can be used to find the space in use (including both data and metadata).

If positive, FILE_LENGTH_HINT should be accurate to give you the data size, but if it's negative (invalid) you'll need to count.
A crucible of informative mistakes
GuentherF
Trusted Contributor

Re: Using hint values from rms to get filesize

Like this?

$ filesize = F$FILE_ATTRIBUTES("LOGIN.COM","EOF") * 512 + F$FILE_ATTRIBUTES("LOGIN.COM","FFB") - 1
$ SHOW SYMBOL filesize
FILESIZE = 2019 Hex = 000007E3

This gives you the used space of a file with file organization = SEQ (=sequential).

You didn't tell which file organization nor did you tell whether this is needed in a program or a command procedure. And then you didn't tell what you need that number for at all.

I would give you 3 lemons for a poorly asked question. ;-)

/Guenther