From: Hein van den Heuvel [hein_netscape@eps.zko.dec.com]
Sent: Tuesday, June 04, 2002 2:29 PM
To: Info-VAX@Mvb.Saic.Com
Subject: Re: Copying a file via FID



Jack Trachtman wrote:

> I can get the FID via F$GETQUI and I can look at the directory entry
> using DFU. But I can't figure out (without writing a program) how to
> copy the file within DCL using just its FID.

How about creating a directory entry for the file ID?
I don't think there is a standard tool for this, but it was trivial to
write .. .see below.
This would be a nice function for SET FILE/ENTER or DFU:
/ID=(NUM=x,SEQ=x,RVN) | I1=x,I2=x,I3=x)
The first format would be for 'proper' 24/16/8 bits entries, the second
for 16/16/16 entries.
Both should ofcouse have a hex alternative input.
My program below just does decimal (24/16).. or at least I hope it does
:-)

/*
**    enter.C    create directory entry for a file ID.
**
** Have fun, Hein van den Heuvel, HP 6/4/2002
*/
#include ssdef
#include rms
#include stdio
#include string
#include stdlib

main(int argc, char *argv[])
{
int             i, status, sys$parse(), sys$enter();
char            *p, expanded_name[256], resultand_name[256];
struct FAB      fab;
struct NAM      nam;

if (argc < 4) {
    printf ("Usage $%s [x]<file-id> [x]<file-seq> <file-name>\n",
argv[0]);
    return 268435456;
    } else {

    fab = cc$rms_fab;
    fab.fab$l_fop = FAB$M_NAM;
    fab.fab$l_dna = ".DAT";
    fab.fab$b_dns = strlen(fab.fab$l_dna);
    fab.fab$l_fna = argv[3];
    fab.fab$b_fns = strlen (argv[3]);
    fab.fab$l_nam = &nam;

    nam = cc$rms_nam;
    nam.nam$b_nop = NAM$M_NOCONCEAL;
    nam.nam$l_rsa = resultand_name;
    nam.nam$b_rss = 255;
    nam.nam$l_esa = expanded_name;
    nam.nam$b_ess = 255;


    status = sys$parse( &fab );
    if (status & 1) {
        i = atoi (argv[1]);
        nam.nam$w_fid_num = (short) i;
        nam.nam$b_fid_nmx = (unsigned char) (i >> 16);
        nam.nam$w_fid_seq = (short) atoi ( argv[2] );
        status = sys$enter ( &fab );
        }
    return status;
    }
}