From: djesys [David.Dachtera@advocatehealth.com]
Sent: Thursday, January 06, 2000 5:18 PM
To: Info-VAX@Mvb.Saic.Com
Subject: MKDIR.COM (was Re: VMS wish list)

Larry Kilgallen wrote:
> 
> Now somebody willing to spend more time on an experiment than I just
> spent could try creating a directory with $QIO calls and determine if
> the file system will honor initial allocation requests.

Well, actually, I did it in DCL. Here it is:

$!
$!      MKDIR.COM -      6-Jan-2000 by David J. Dachtera
$!
$!      Procedure to create a pre-extended directory.
$!
$!      Pre-requisite software: the freeware DFU utility.
$!
$!      Parameters:
$!      P1 =    The device and path for the new directory file.
$!              Example: [ddcu:[<path>]]dirname
$!              The current default disk/directory will be used
$!              to provide defaults for fields not specified.
$!              "dirname" is required, at a minimum.
$!      P2 =    The allocation quantity for the new directory.
$!              If not specified, defaults to the square of the
$!              cluster size on the target disk. The value of
$!              P2 may not exceed the number of free blocks on
$!              the target volume.
$!
$!----------------------------------------------------------------------
$!
$ dflt = f$environ( "default" )
$ now = f$cvtime( ,, "time" ) - ":" - ":" - "."
$!
$! See if we can find DFU.
$ fsp = f$search( "dfu.exe", now )
$ got_dfu = ( fsp .nes. "")
$ if got_dfu then dfu := $'dflt'dfu
$ if got_dfu then goto got_dfu
$ got_dfu = ( f$search( "dcl$path:dfu.exe", now ) .nes. "")
$ if got_dfu then dfu := $dcl$path:dfu
$ if got_dfu then goto got_dfu
$ got_dfu = ( f$search( "sys$system:dfu.exe", now ) .nes. "")
$ if got_dfu then dfu := $dfu
$ if got_dfu then goto got_dfu
$ write sys$output f$fao( f$message( %x130A ), "DFU" )
$ exit %X1000130A
$!
$got_dfu:
$ devc = f$parse( p1, dflt,, "device", "syntax_only" )
$ drct = f$parse( p1, dflt,, "directory", "syntax_only" )
$ dirn = f$parse( p1, dflt,, "name", "syntax_only" )
$ if dirn .eqs. "" then exit %x12
$ if .not. f$getdvi( devc, "exists" ) then exit %x12
$ clsz = f$getdvi( devc, "cluster" )
$ if p2 .eqs. "" then p2 = clsz * clsz
$ if f$type( p2 ) .nes. "INTEGER" then -
$ exit %x12
$ fbks = f$getdvi( devc, "freeblocks" )
$ if p2 .gt. fbks then exit %x852
$ path = drct - "]" + "." + dirn
$ ndir = devc + drct + dirn + ".DIR;1"
$ tmp := 'f$getjpi( 0, "pid" )'_'now'
$ create/direct [.'tmp']
$ pmsk = f$edit( f$file( "''tmp'.dir", "pro" ), "collapse" )
$ set file/nodirect/prot=o:rwed 'tmp'.dir
$ copy/noconfirm/nolog 'tmp'.dir,nla0: &ndir/alloc=&p2
$ define/user sys$output nla0:
$ dfu set 'ndir'/directory
$ set file/prot=('pmsk') &ndir
$ delete/noconfirm/nolog 'tmp'.dir;
$ exit 1

Absolutely free and totally unsupported. I tested this on our
OpenVMS-Alpha V7.1-2 system here using DFU ALP V2.4-0, and on
OpenVMS-VAX V6.2 (VAXstation 4000/VLC) using DFU VAX V2.4-2. Otherwise,
you're entirely on your own.

This will be in the freeware area of my website sometime soon. MKDIR.ZIP
will contain this proc. and a README.TXT file to explain it.

-- 
David J. Dachtera
dba DJE Systems
http://home.earthlink.net/~djesys/

Unofficial Affordable OpenVMS Home Page and Message Board:
http://home.earthlink.net/~djesys/vms/soho/
