From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 12-AUG-1988 04:13
To:	ARISIA::EVERHART
Subj:	Re: dangerous utility wishlist


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 12 AUG 88 00:24:29 PDT
Received: from CitHex.Caltech.Edu by KL.SRI.COM with TCP; Fri, 12 Aug 88 00:02:15 PDT
Date:     Fri, 12 Aug 88 00:00:07 PDT
From:     carl@CitHex.Caltech.Edu (Carl J Lydick)
Message-Id: <880811234819.f26@CitHex.Caltech.Edu>
Subject:  Re: dangerous utility wishlist
In-Reply-To: Your message dated  8-Aug-1988
To:       SEYMOUR%phast.phys.washington.edu@CUNYVM.CUNY.EDU,
         info-vax@CitHex.Caltech.Edu

 > I would like as a supported utility under VMS the equivalent to
 > RSX's (and it works under the AME on VMS, so I can do it):
 > 
 >    [mcr]   PIP filename/en=/fi:nnn:mmm
 > 
 > which creates a directory entry FILENAME for a file referenced by
 > its File ID.  (set file/enter cannot use a file ID as the input reference).

It's pretty easy to write a program that does that, as long as the file has  a
valid header.

 > I use it for manual retrieval of lost files.  especially "scratch"
 > files which never had a directory entry  (fortran  OPEN (type="scratch")),
 > also files directly OPENed to the lineprinter queue. (you scan indexf.sys
 > for "marked for delete" headers, and then attach)

Certainly you can do this, as long as the file is simply "marked for  delete".
In  fact, once you've done so, you can even copy the file to elsewhere, if the
person who has it open  and  marked  for  delete  specified  appropriate  file
sharing options.  However, when the last close is done on the file, it's going
to go from being "marked for delete" to having a "deleted file header".   Even
if  you went into INDEXF.SYS and reset the "marked for delete" bit in the file
header, when RMS closes the file, it will remember  that  it  was  marked  for
delete and modify the header accordingly.

 > there probably are DECUS utilities which have the ability (altho i haven't
 > fallen into one).  it's also possible to patch a directory file to perform
 > the same operation (very unclean). i'd just like it to be a supported
 > operation (especially to undo someone's set file/remove, without doing
 > a full analyze/disk).

As long as the file still has a valid header, it  IS  a  supported  operation.
There's just no utility to provide a convenient user interface.  The operation
is implemented via the RMS $ENTER service.  The  following  code  demonstrates
it:
********************************************************************************
#include fab.h
#include nam.h
main()
{   struct FAB fab;
    struct NAM nam;
    char name[255], buff[8];
    char esabuf[64];
    int i, stat;

    printf("Enter the name of file to be entered: ");
    gets(name);
    fab = cc$rms_fab;
    nam = cc$rms_nam;
    fab.fab$l_fna = name;
    fab.fab$b_fns = strlen(name);
    fab.fab$w_ifi = 0;
    fab.fab$l_nam = &nam;
    nam.nam$l_esa = esabuf;
    nam.nam$b_ess = 64;
    (((stat = SYS$PARSE(&fab)) & 7) != 1)
        exit(stat);
    puts("A FID looks like: (File_Num, Seq_Num, Rel_Vol_Num");
    printf("Enter the File_Num for the file: ");
    nam.nam$w_fid[0] = atol(gets(buff));
    printf("Enter the Seq_Num for the file: ");
    nam.nam$w_fid[1] = atol(gets(buff));
    printf("Enter the Rel_Vol_Num for the file: ");
    nam.nam$w_fid[2] = atol(gets(buff));
    exit(SYS$ENTER(&fab));
}
********************************************************************************

