[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

262.0. "Problem in converting a directory with DCL convert" by HGOSPS::KENNETH () Fri Feb 28 1997 04:38

Hi,

There is a customer would like to use the DCL convert command to change a 
file's attribute on VMS V5.5-2H4.  The steps are as follow:

1) analy/rms/fdl kenneth.dir to produce kenneth.fdl 

2) convert/fdl=KENNETH.FDL test.dir test1.dir  - where test.dir is the 
   original directory file and test1.dir will be the directory that have
   the file attribute from kenneth.dir.

However, after the conversion, the file test1.dir is not a directory file.
Is it normal?  Anything missing from the steps above?  Any other methods to
do it?

The file information are as attached.  

Thanks for your help in advance.

Kenneth Leung

===============================================================================
$dir/fu kenneth.dir
KENNETH.DIR;1                 File ID:  (50,188,0)
Size:           48/54         Owner:    [KENNETH]
Created:  23-JAN-1991 09:13:37.21
Revised:  23-JAN-1991 09:13:37.41 (1)
Expires:   <None specified>
Backup:   16-MAR-1992 19:24:52.54
File organization:  Sequential
File attributes:    Allocation: 54, Extend: 0, Global buffer count: 0
                    No default version limit, Contiguous, Directory file
Record format:      Variable length, maximum 512 bytes
Record attributes:  No carriage control, Non-spanned
RMS attributes:     None
Journaling enabled: None
File protection:    System:RWE, Owner:RWE, Group:RE, World:E
Access Cntrl List:  None


$ dir/fu test.dir

Directory DSA4:[KENNETH]

TEST.DIR;1                    File ID:  (35,46,0)
Size:            1/3          Owner:    [KENNETH]
Created:   5-DEC-1996 16:27:04.81
Revised:   5-DEC-1996 16:27:05.02 (1)
Expires:   <None specified>
Backup:    <No backup recorded>
File organization:  Sequential
File attributes:    Allocation: 3, Extend: 0, Global buffer count: 0
                    No default version limit, Contiguous, Directory file
Record format:      Variable length, maximum 512 bytes
Record attributes:  No carriage control, Non-spanned
RMS attributes:     None
Journaling enabled: None
File protection:    System:RWE, Owner:RWE, Group:RE, World:E
Access Cntrl List:  None


$ dir test1.dir/fu

Directory DSA4:[KENNETH]

TEST1.DIR;1                   File ID:  (541,52,0)
Size:            1/54         Owner:    [KENNETH]
Created:  28-FEB-1997 17:00:46.62
Revised:  28-FEB-1997 17:00:46.83 (1)
Expires:   <None specified>
Backup:    <No backup recorded>
File organization:  Sequential
File attributes:    Allocation: 54, Extend: 0, Global buffer count: 0
                    No version limit, Contiguous
Record format:      Variable length, maximum 34 bytes
Record attributes:  No carriage control, Non-spanned
RMS attributes:     None
Journaling enabled: None
File protection:    System:RWE, Owner:RWE, Group:RE, World:E
Access Cntrl List:  None
 
T.RTitleUserPersonal
Name
DateLines
262.1UTRTSC::thecow.uto.dec.com::JurVanDerBurgChange mode to Panic!Fri Feb 28 1997 05:546
Directories are not normal files on VMS, they are maintained by the XQP, and a 
user should not be concearned with their format. You should not CONVERT such a
file. What is the customer REALLY trying to do?

Jur.

262.2Look at the Freeware CD!COPCLU::JORNNew European Champions...Mon Mar 03 1997 11:549
    Hello,
    
    
    If you're trying to compress the directory file in some way, this is
    not the way to do it. But, how a look at the OpenVMS Freeware CD-ROM,
    there's an excellent utility called DFU (Disk File Utility), - it
    handles directory compression (among other things) quite nice.
    
    Jorn.
262.3EPS::VANDENHEUVELHeinTue Mar 11 1997 10:2797
    
    You can NOT use the Convert utility to manipulate directories.
    Trust me, I've been there, I've done that, and while it may
    appear to work on some directories, it will break on others.
    
    The directory file format is _very_ close to a normal sequential
    file with variable length record and non-block-spanning attribute
    but is NOT exactly the same. The specific differences are in the
    the 0xFFFF end-of-block marker handling.
    
>However, after the conversion, the file test1.dir is not a directory file.
    
    	The FDL file does NOT take the directory attribute into account.
    	This is a specific 'UCHAR' bit that SET FILE/NODIR can switch OFF
    	but there is no build in command to switch it ON. I'll include a
    	little C program to switch the bit on in case you like to play
    	with fire and can not find your matches.
    
    Have fun,
    		Hein.
    
#include atrdef
#include fibdef
#include fchdef
#include iodef
#include rms
#include stdio
#include stdlib
#include string

main(argc,argv)
int argc;
char *argv[];
    {
    int status, channel, uchar;
    struct FAB fab;
    struct NAM nam;
    short iosb[4];
    struct { long count; long address; } fibdes;
    struct fibdef fib;
    struct atrdef atr[2];
    char usage[] = "Usage: $ SET_DIR filename\n";

    if (argc != 2) printf("%s",&usage), exit(1);

    fab = cc$rms_fab;
    fab.fab$l_fna = argv[1];
    fab.fab$b_fns = strlen(fab.fab$l_fna);
    fab.fab$l_dna = ".DIR;1";
    fab.fab$b_dns = strlen(fab.fab$l_dna);
    fab.fab$b_fac = FAB$M_GET | FAB$M_PUT;
    fab.fab$l_fop = FAB$M_UFO;
    fab.fab$b_org = FAB$C_SEQ;	/* ebk and ffb are only valid for seq files */
    fab.fab$l_nam = &nam;

    nam = cc$rms_nam;

    status=sys$open(&fab);
    if (!(status & 1)) lib$stop(status);
    channel = fab.fab$l_stv;

    fibdes.count = sizeof(fib);
    fibdes.address = &fib;

    fib.fib$r_acctl_overlay.fib$l_acctl  = ( FIB$M_WRITE );
    fib.fib$r_fid_overlay.fib$r_fid_fields.fib$w_fid_num =
	nam.nam$w_fid[0];
    fib.fib$r_fid_overlay.fib$r_fid_fields.fib$w_fid_seq =
	nam.nam$w_fid[1];
    fib.fib$r_fid_overlay.fib$r_fid_fields.fib$r_fid_rvn_overlay.fib$w_fid_rvn =
	nam.nam$w_fid[2];

    atr[0].atr$w_type  = ATR$C_UCHAR;
    atr[0].atr$w_size  = ATR$S_UCHAR;
    atr[0].atr$l_addr  = &uchar;
    atr[1].atr$w_type  = 0;
    atr[1].atr$w_size  = 0;

/*  Get the file's current uchar */

    status = SYS$QIOW(0,channel,IO$_ACCESS,iosb,0,0,&fibdes,0,0,0,&atr,0);
    if (status & 1) status = iosb[0];
    if (!(status & 1)) lib$stop(status);

/*  Set the new uchar */

    uchar |= FCH$M_DIRECTORY;

    status = SYS$QIOW(0,channel,IO$_MODIFY,iosb,0,0,&fibdes,0,0,0,&atr,0);
    if (status & 1) status = iosb[0];
    if (!(status & 1)) lib$stop(status);

/*  Release the file */

    status = SYS$QIOW(0,channel,IO$_DEACCESS,iosb,0,0,&fibdes,0,0,0,0,0);

    }
262.4UTRTSC::DORLANDThe Wizard of Odz2Wed Mar 12 1997 02:114
    RE .2 : The DFU utility is also capable of 'flipping' the
    	directory bit back on (DFU> SET xxx.dir/DIRECTORY). 
    
    	Rgds, Ton