DOS file attributes on OpenVMS

Monday, 02 November 2009 05:10

A few years ago, four according to the source, I was asked if it was possible to set the DOS file attributes on an OpenVMS file that existed on an Advanced Server (aka Pathworks) share.  I wasn't sure, but it took only a minute or so to check it out.  Sure enough, from Windows Explorer it was easy enough done.  A right-click and a couple left-clicks later and it was confirmed.  Then came the real reason for the question, "Can we do it from VMS?"  The story goes that, apparently a manufacturer required that a previous employer's software output data files to a Windows share.  The manufacturer in question then used their own special tool to open the files and process the data.  However, in order to be compliant with their requirements we needed to set the readonly attribute on the data files.  Given the possibilities of ACLs and everything else available to Windows users it seemed crazy, but that wasn't the point.  So, to solve this problem I came up with an OpenVMS version of the ATTRIB utility.

I started with looking at the output from a DIRECTORY/FULL of the file I had tested with and came up with something like the following output:

Directory USER$:[TSNEDDON.SOURCE.ATTRIB.NEW]

TEST.TXT;1                    File ID:  (142221,34,0)
Size:            0/0          Owner:    [VMSUSER,TSNEDDON]
Created:    18-OCT-2009 22:45:19.94
Revised:    18-OCT-2009 22:45:19.94 (1)
Expires:    <None specified>
Backup:     <No backup recorded>
Effective:  <None specified>
Recording:  <None specified>
Accessed:   <None specified>
Attributes: <None specified>
Modified:   <None specified>
Linkcount:  1
File organization:  Sequential
Shelved state:      Online
Caching attribute:  Writethrough
File attributes:    Allocation: 0, Extend: 0, Global buffer count: 0
                    No version limit
Record format:      Variable length, maximum 0 bytes, longest 0 bytes
Record attributes:  Carriage return carriage control
RMS attributes:     None
Journaling enabled: None
File protection:    System:RE, Owner:RWED, Group:RE, World:RE
Access Cntrl List:  Suppressed 1 PATHWORKS ACE
Client attributes:  Read-Only, System, Hidden

Total of 1 file, 0/0 blocks.

As you can see, the 'Client attributes' field lists the DOS file attributes.  So I started looking at the source listings for the DIRECTORY command.  In particular the source module [DIR]DISPLAY.B32 and the routines DIR$GET_CLIENT_ATTRIB and DIR$SHOW_CLIENT_ATTRIB.  Together, these routines have knowledge of the Pathworks ACE that holds the DOS file attributes as they are responsible for the output of the field 'Client attributes' in the listing above.

Unfortunately I could not locate a routine to write these attributes and nothing public that could read them.  So I searched through the source listings and eventually came up with the SDL module [F11X]PWACLDEF.SDL.  This had more than enough information for me to work with.  So, coupled with this module and the listings for DIRECTORY I wrote an OpenVMS ATTRIB utility.  The complete source code and executable for all architectures are here.

Advanced Server stores the attributes as one of many Pathworks ACEs.  These are suppressed (as shown above) in later version of the directory command, but a dump of the data can still be retrieved using either the SHOW ACL (obsolete) or SHOW SECURITY commands, like so:

freja_FTA9> SHOW SECURITY TEST.TXT

USER$:[TSNEDDON.SOURCE.ATTRIB.NEW]TEST.TXT;1 object of class FILE
     Owner: [VMSUSER,TSNEDDON]
     Protection: (System: RWED, Owner: RWED, Group, World)
     Access Control List:
          (UNKNOWN=%X80,SIZE=%D46,FLAGS=%X0000,ACCESS=%X00006900,DATA=
          %X00000008,%X00000000,%X0000041E,%X00000007,%X00000000,%X00000000,
          %X00000000,%X3B530000,%X3B53059B,%X00000971)

The type of %X80 (128) is equal to PWRK$C_PATHWORKS_ACE indicating the ACE is a for Pathworks.  The first word of the fourth longword (%X00000007) in the data contains the bitmask indicating which DOS attributes are active. 

ATTRIB acts almost exactly like the DOS/Windows equivalent.  It even supports the undocumented ',' operator.  The HELP reported by the /? qualifier is shown below.

Displays or changes Pathworks file attributes.

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [filespec[,...]]

  +   Sets an attribute.
  -   Clears an attribue.
  R   Read-only file attribute.
  A   Archive file attribute.
  S   System file attribute.
  H   Hidden file attribute.
  filespec[,...]
      Specifies a file or files for attrib to process.
      There is no support for the /S and /D qualifiers.  These
      can be performed using OpenVMS syntax.

  ,   Specifying the comma immediately after the command
      will cause all attributes to be cleared from all
      files in the following filespec

However, I don't imagine that there will be too much use for this utility these days.  The Advanced Server product has been placed into maintenance mode and will not be ported to the Integrity platform.  Unfortunately the licensing arrangement between Microsoft, HP and AT&T fell apart and so the next step in keeping up with the ever evolving WIndows network on OpenVMS is the HP Common Internet File System (CIFS) product.  It is an officially supported port of the open source Samba software.

Software

The ATTRIB utility and complete (BLISS) source code can be downloaded below:

Fell free to use it to your heart's content.  Maybe even post something below and let me know how you got on.

[PRINT]  [PRINT]