Operating System - OpenVMS

$TYPE/TAIL returns error while using it for big files

Go to solution
Pradeep K P
Occasional Advisor

$TYPE/TAIL returns error while using it for big files

Dear All,

I was trying to type/tail of a large file in Open VMS and ends up in an error.
%TYPE-W-OPENIN, error opening as input
-SYSTEM-E-UNSUPPORTED, unsupported operation or function
-RMS-F-ORG, invalid file organization value

Open VMS Version :7.3-2 on Alpha.

Appreciate if someone suggests any alternate way to achive this. Thanks in advance.
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files

I'd guess this might be an RMS relative or indexed file.

Various of these can be displayed with TYPE.

Post a DIRECTORY /FULL on the target file, please? That'll tell us the organization, format, record length and file size, among other key details.
Pradeep K P
Occasional Advisor

Re: $TYPE/TAIL returns error while using it for big files

Thanks for the quick response.
Herewith posting the full attributes of the file.

$ dir/full ;

Directory :

;1 File ID: (Xxxx,X,X)
Size: 24494770/24496416 Owner: <[Owner Name]>
Created: 25-MAR-2009 14:36:52.15
Revised: 25-MAR-2009 16:59:49.58 (1)
Linkcount: 1
File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 24496416, Extend: 0, Global buffer count: 0, No version limit
Record format: Stream_LF, maximum 0 bytes, longest 32767 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWD, Owner:RWD, Group:R, World:
Access Cntrl List: None
Client attributes: None

Total of 1 file, 24494770/24496416 blocks.
Hein van den Heuvel
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files

That's a good sized file.

Anyway, try: SET FILE/ATTR=LRL=0
Or if you know a proper Longest-Record-Length, then use that value.
Now try again.


Jon Pinkley
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files

$ help type/tail




Displays the last several lines of a log file. The value, n,
defaults to p-2 where p is the current terminal page length. You
can use TYPE/TAIL only if all of the following criteria are true:

o File organization is sequential.

o The longest record is less than 512 bytes.

o The record format is either VAR, VFC, STM, STRCM or STMLF (for
more information, refer to the description of FAB$B_RFM in the
OpenVMS Record Management Services Reference Manual).

o The file being typed is on a device that supports random
access. The TYPE/TAIL command does not work on magnetic tape

Even with this criteria, some file conditions cannot be
anticipated and may not allow display of the last several lines
of a log file, resulting in the following error message:

-SYSTEM-E-UNSUPPORTED, unsupported operation or function
it depends
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files

If this file gets periodically re-created, you might try to define the logical name DECC$DEFAULT_LRL within the context of whatever tool or process creates this file, and set the longest record length (LRL) to a more appropriate value for the file.

Or tweak the code to specify the LRL itself.

Or yes, try slamming this file with a SET FILE to reset the LRL.

Or alter the file or log processing so that it doesn't generate large wads of file data.

Or implement some form of more log monitoring or error recovery processing through something other than TYPE /TAIL, as this volume of data is comparatively incompatible with manual monitoring and tools.

Jon Pinkley
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files


Give Hein 10 points.

Here is a file that was created by HSZTERM with the same Record format as yours, except that it is a much smaller file in allocation size.

The longest record was in fact 79 bytes.

Using Hein's work around allowed type/tail to work.

See attachment for details.

If Type/tail is told that the longest record is longer than 512 bytes, it gives up without trying. Your file is telling it that the longest record is 32767. Setting longest record length to zero is saying, "I don't know how long the longest record is".

If type/tail doesn't find a record delimiter in the last 512 bytes of the file's data, it will still fail, but at least it will examine the data, instead of just giving up.

So it is still possible that you will get an error, if the records at the end of the file are longer than 512 bytes, but you will at least have the possibility of seeing the end without resorting to reading the whole file.

it depends
John Gillings
Honored Contributor

Re: $TYPE/TAIL returns error while using it for big files

The attachment is a procedure I use to find files with long LRLs, in order to make TYPE/TAIL work on them.

The procedure just lists the files. The simplest "fix" to make TYPE/TAIL work is:


(assuming there are no records longer than 511 bytes).

Long term, you need to find how the files are being created and if the LRL is real or artifact. Change the code to set an accurate LRL. Most likely it's a consequence of the rather ugly kludge in the DECC RTL which, by default, sets LRL of stream_lf files to the maximum possible value. The logical name DECC$DEFAULT_LRL can be used to control that behaviour.

A "big hammer" fix might be:


but you'd need to confirm that all the stream_lf files on your system have real LRLs less than 512.

The error itself is a consequence of the way RMS finds the tail of a file. Not a pretty sight! Remember, RMS has to deal with multiple record formats, and it doesn't have record backlinks. To find the last "n" records, it has to guess the byte offset, based on the LRL hint, then hunt for a likely looking record boundary.

The 512 limit could, in theory, be increased, but at the expense of the performance of TYPE - sequential searches are slow.
A crucible of informative mistakes
Pradeep K P
Occasional Advisor

Re: $TYPE/TAIL returns error while using it for big files

Thanks for all the replies and work arounds. I tried to set file/attr=LRL=0 and its working fine. Since i was not sure about the LRL of this current file, though it shows 32767. Defining DECC$DEFAULT_LRL is too complicated, since this file is generated from PL/SQL script.Setting LRL=0 is appropriate choice for me and it works.

Once again thank you all for your suggestions.

Pradeep K P
Occasional Advisor

Re: $TYPE/TAIL returns error while using it for big files

Once again thank you all.