.; NEWLD.IND, IND Control File. .; .; Creates a new logical disk file and mounts it as an LD .; with a specified logical assignment. The LD unit used will be .; the one specified by 'LDSTRT', unless that one is already in use .; because of a previous DOWN command. In that case, the file uses .; READLD to locate an unused LD unit. .; .; The filespec will be parsed and defaults provided if necessary. .; The default device on which new files are to go can be specified .; in this file. .; File sizes can be specified in one of two ways: .; Either as a number of blocks or as a disk "type". Currently defined .; disk types are DX (494 blocks), DU (800 blocks), DY (988 blocks), .; FW (2432 blocks) or DL (10210 blocks). .; The number of directory segments will either be automatically chosen .; or can be specified at runtime. .; For files specified by numerical size, the default is to add the .; directory size onto the number specified (thus a specification of .; 300 blocks would result in a 308-block file). This gives you the .; "gross" amount of space specified. This can be overridden .; with a switch to cause the useable blocks in the file to be the "net" .; amount after subracting off the directory from the specified .; file size. .; If a logical name assignment is not given, the new file is .; assigned to DK. .; .; The parameters of the control file are: .; P1 Filespec (default is $DEFDV:xxxxxx.$DEFXT). .; P2 Number of file blocks or disk type. .; P3 Logical assignment (default is DK). .; P4 Number of directory segments (default is automatic .; specification). .; P5 "Net" or "Gross" file size (N or G, default is N). .; .; The file SY:CURDK.TMP holds the current default information. .; NOTE... The logical name WF: must be assigned to some device. .; .; Written by: .; R. W. Barnard .; BIO/Comp Applications .; Albuquerque, NM 87185 .; .; Version 2.3 6-May-87. .; .enable global .enable quiet .disable lowercase .disable prefix,suffix .disable octal SET TT QUIET .; .; Specify default LD unit number. .setn LDSTRT 6 .; Change disk types and sizes here (separate by spaces). .sets DSKTYP "DX DU DY FW DL " .;Two-char disk types only. .sets TYPSIZ "494 800 988 2432 10210" .;Corresponding sizes. .; NOTE! If you add any disk types, add another SIZn below! .parse TYPSIZ " " SIZ1 SIZ2 SIZ3 SIZ4 SIZ5 .; Specify default device for the new file here. .sets $DEFDV "DK:" .; Specify the default extension for the new file here. .sets $DEFXT "DSK" .; Specify Volume ID owner name here. .sets OWNAME "RWB" .; ************************ End of User Changeable Information *********** .; .start: .if P1 ne "" .goto 10 .asks P1 What is the filespec for the new subdevice .parse P1 " " P1 P2 P3 P4 P5 .goto start .; .10: @SY:PARSE 'P1' .; .sets LOGICL "DK" .;Establish the logical name. .if P3 ne "" .sets LOGICL "'P3'" .; .; See if the disk is mounted, etc. .testdevice '$DEV' .parse "," DEV A A A A A ONL A A .if ONL eq "OFL" .goto baddsk .;Something is wrong. .; See if the file already exists. .testfile '$FILSP' .if eq .goto exists .sets FILSPC .;This is the complete name. .parse FILSPC ":" A FILNAM .; .sets DS P2 .if DS ne "" .goto 45 .;File size or type specified. .getsiz: .asks DS Enter file size or disk type (? for help) .if gt 1 .goto 45 ;ESizes are >10 blocks; types are 'DSKTYP' .goto getsiz .; .45: .sets DQ DS[1:1] .if DQ le "9" .goto 49 .;Numerical file size. .; Get rid of :, if typed. .parse DS ":" DS A .setn COUNT 1 .;Get length of disk type string. .test DSKTYP .disq: .;Figure out disk type. .sets DISKS DSKTYP[COUNT:COUNT+1] .if DS eq DISKS .goto 47 .;Now compare entry with list .setn COUNT COUNT+3 .;of disks. .if COUNT lt .goto disq ;No disk type with that name .goto getsiz .;Try again. .; .47: .setn INDX COUNT/3+1 .;Compute index for disk we are using. .sets DS SIZ'INDX' .;Now get the size. .sets P5 "G" .;Specified file types are always "gross". .; .49: .if P4 eq "" .sets P4 "0" .;Can't set numerics to blank. .setn SS 'P4' .;Determine number of segments. .if SS ne 0 .goto 50 .setn SS 3*('DS'/800)+1 .;First cut at number of segments. .if SS gt 16 .setn SS 16 .;That's enough. .; .50: .setn DSKSIZ 'DS' .;Now specify the file size. .sets GORN P5 .;Make upper case. .if GORN ne "G" .setn DSKSIZ DSKSIZ+(SS*2)+6 .;Add direc size. CREATE 'FILSPC'/ALL:'DSKSIZ' .if ne .exit .; .; Now do the logical assignment. ASS 'DEV' 'LOGICL' .sets CURLD "LD'LDSTRT':" .testdevice 'CURLD' .parse "," DEV A A A A A ONL MOU A .if MOU ne "MTD" .goto mount .;The LD is free. RU WF:READLD .if ne .exit .openr WF:LDLGCL.TMP .setn COUNT 7 .;Find a free LD unit. .again: .read LINE .parse LINE " " LD A .if LD eq "" .or .if LD eq "No" .goto 60 .if LD ne "LD'COUNT'" .goto found .;Look for an unused .dec COUNT .;LD unit. .goto again .; .found: .if COUNT lt 0 .goto nolds .;Are all units used? .sets CURLD "LD'COUNT':" .;Use this LD. .60: .close .; .mount: MOUNT 'CURLD' 'FILSPC' 'LOGICL' .if gt .exit .; .open WF:INI.TMP .enable data R DUP 'CURLD'/Z/V/Y/N:'SS'. 'FILNAM' 'OWNAME' ^C SET TT NOQUIET .disable data .close $@WF:INI.TMP DELETE/NOQ WF:INI.TMP .; .; Show where we are. .open SY:CURDK.TMP .data E 'FILSPC' is 'LOGICL', mounted on 'CURLD'  .close .; Message is printed bold, and is positioned better on screen. TYPE SY:CURDK.TMP DIR/VOL 'LOGICL': .; .exit .; .exists: ;E File '' already exists - .ask [] QQ Do you want to attach it [N] .ift QQ @SY:DOWN '' 'LOGICL' .exit .; .baddsk: ;E Device 'DEV' is not mounted, or other problem .exit .; .nolds: ; All LD units are in use! .exit