Operating System - OpenVMS
1748223 Members
4731 Online
108759 Solutions
New Discussion юеВ

Is there a utility to open and display/copy a file via FILE ID?

 
SOLVED
Go to solution
Tom O'Toole
Respected Contributor

Is there a utility to open and display/copy a file via FILE ID?


Before I reinvent the wheel... I would basically like:

copy/id=(x,y,z) device: [outputfile]

The undocumented dump/id would be usable, but doesn't really seem to open a file by ID, it seems to just look up that file header to get the filename and then open it normally, so I think it doesn't work for files without directory entries.

I haven't found anything out there so far...

Can you imagine if we used PCs to manage our enterprise systems? ... oops.
20 REPLIES 20
Tom O'Toole
Respected Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

Some background, I'm asking because spooled print files get created on the intermediate disk device without directory entries. I can get their file IDs using getqui. I'd like to write a procedure that can display or copy the files, given a queue entry number.

This would be much better than the current alternative of running an/dis/rep, and then poking around for a file that's the same size/owner/date of the relevant entry.
Can you imagine if we used PCs to manage our enterprise systems? ... oops.
Jon Pinkley
Honored Contributor
Solution

Re: Is there a utility to open and display/copy a file via FILE ID?

I think you used to be able to enter a name into a file directory using PIP. But that doesn't help here.

Joe Meadow's FILE program allows you to do this: From the FILE.HLP file

/FID

You may use this qualifier to specify the file id of a
file to enter, with the name passed on the command line. For
instance:
$ FILE GARBAGE.SPOOLED/FID=(1234,56,0)

This will enter the file specified by the file id
(1234,56,0) into your current directory with a name of
GARBAGE.SPOOLED. You may at this point do other things to the
file (such as make a backup copy).

The original intent behind this was to be able to recover
temporary spool files (which don't get created in any
directory, and are created "delete on close", thus having the
"marked_for_delete" flag set).


Here's a something Hein wrote a while ago:

http://mvb.saic.com/freeware/vmslt04b/vu/type-file-by-fid-vms.txt

Jon
it depends
David B Sneddon
Honored Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

Tom,

I have a patch_file utility (available on the freeware CDs in
the DBS-PATCH package) that can open a file by file id.

The following example uses a file that IS in a directory
but since you will know the device and file id...

tardis_FTA7> dir /file zap.obj

Directory DBS0:[SCRATCH]

ZAP.OBJ;1 (20967,9,0)

Total of 1 file.

tardis_FTA7> pfile dev dsa6000: id 20967 9 0
Patch_File V2.0
Patching file DISK$DALEK:[SYSPROG.DSNEDDON.SCRATCH]ZAP.OBJ;1
DSA6000: (20967,9,0)

PatchFile set disp ascii read 1 disp
Reading VBN 1 (00000001)

Modified VBN 1 (00000001)
0-[@...@.............├Г┬╕.....MAIN..V113-DEC-2006 01:17...............]
64-[..........AMAC V5.0-120......................... ABS .........]
128-[├Г ....... BLANK ................HELP.............├Г .<....CODE.....]
192-[...............DATA............. ......$ABS$...................$]
256-[LINKAGE.....(..............................BUF......(...J.p.....]
320-[...................START..├Г ...├Г .....................=...........]
384-[....................4...=..........## read VBN ##......X fo]
448-[llowed by hexadecimal number to read VBN ##....S followed by ]

PatchFile Exit


The source is available and it should be easy to add a copy function.

Dave
Hoff
Honored Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

What might arising here that causes a need to reference files by FID? Some background, please?

I'm guessing at some possibilities here...

There's a bug that causes spooled entries to get stuffed up and left in in the file structure. That was fixed a while back (XQP?), and patches are available for various versions.

There are queue symbionts that allow you to process files available via Freeware or such. Here's one, and it can serve as a Google target for finding others.

http://mvb.saic.com/freeware/freewarev80/execsymb/
John Gillings
Honored Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

Tom,

If you're running V8.2 or higher, it might be interesting to see what F$FID_TO_NAME returns.

>then poking around for a file that's the
>same size/owner/date of the relevant entry.

If you "repair" the file into SYSLOST, you can positively identify it by comparing F$FILE(f,"FID") with your known FID.

If you don't want to use ANALYZE/DISK/REPAIR, it's fairly simple to create a directory entry for it using an ACP $QIO (see I/O Users Guide).
A crucible of informative mistakes
Hein van den Heuvel
Honored Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

Just ENTER the file into a directory.
Then manipulate / copy / display the file to your hearts content.
Attached is a trivial tool to do just that.
It is much similar to the type tool Jon already posted a link to.

hth,
Hein
Tom O'Toole
Respected Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?


Thanks for the responses. I KNEW there were utilities out there already, I just couldn't remember/find them...

FILE and VERB are a couple of the most useful add-ons ever...
Can you imagine if we used PCs to manage our enterprise systems? ... oops.
Derek Garson
Frequent Advisor

Re: Is there a utility to open and display/copy a file via FILE ID?

> If you "repair" the file into SYSLOST, you can positively identify it by comparing F$FILE(f,"FID") with your known FID.

If the file exists in any known directory then you can use FID syntax to access it e.g.

$ type DDcu:[syslost]~[x,y,z]

Unfortunately that doesn't seem to work unless the file exists in a directory and you know the directory path.
Hein van den Heuvel
Honored Contributor

Re: Is there a utility to open and display/copy a file via FILE ID?

In case folks are wondering, Derek is refering to the little known "FID-Abbreviated Names" as documented (somewhat) in:

http://h71000.www7.hp.com/doc/731FINAL/4506/4506pro_019.html#fid_abbrev_names

These are only valid on ODS5 disks,
swith process parse style set to extended.

Notice how they are call abbreviated NAMES, not specification.
It refers only to the name part of a name. RMS still does a Directory lookup, but it hunts for the FID not just a name.

Derek, and myself, feel this is a missed opportunity to allow for FID-only file specifications in general. I suspect this was not carried through as parse output gets difficult/partial. I would happily accept that restriction (gigo), but it was deemed too different from the norm.

Sample usage session below.
There are also DID-Abbreviated Directories

Hein.

$ set def myods5
$ dir
%DIRECT-W-NOFILES, no files found
$ crea aap.txt
:
$ dir/fil
Directory USR_ODS5:[HEIN]
aap.txt;1 (213,1,0)
:
$ type USR_ODS5:[HEIN]~[213,1,0]
:
$ type USR_ODS5:[xxxx]~[213,1,0]
%TYPE-W-SEARCHFAIL, error searching for USR_ODS5:[XXXX]~[213,1,0].LIS;
-RMS-E-DNF, directory not found
-SYSTEM-W-NOSUCHFILE, no such file
$ dir USR_ODS5:[hein]~[213,1,0]
Directory USR_ODS5:[HEIN]
aap[213,1,0].txt;1
:
$ set def [test]
$ dir USR_ODS5:~[213,1,0]
%DIRECT-E-OPENIN, error opening USR_ODS5:[TEST]~[213,1,0].*;* as input
-RMS-E-DNF, directory not found
-SYSTEM-W-NOSUCHFILE, no such file