David Swanger Academic Computing Services 200 L Bldg. Auburn University, Al 36849 205-826-4813 I am submitting three programs to the DECUS library. These programs are: o NO_FRAGMENTS - a disk de-fragmenting utility o SMART - Shows all interactive processes o XMODEM_AU - A modified version of Jim Belonis' XMODEM Information about each program is contained in the following pages. If you have any questions or comments, please contact me at the above address or telephone number. David Swanger Page 2 NO_FRAGMENTS by David Swanger Academic Computing Services 200 L Bldg. Auburn University, Al 36849 205-826-4813 INTRODUCTION o NO_FRAGMENTS is a program that performs pseudo on-line disk compression for VAX systems that use the VMS operating system. NO_FRAGMENTS was written in VAX FORTRAN. NO_FRAGMENTS consists of two executable images, NOFRAG_MAIN.EXE and NOFRAG_SUB.EXE. The source files for these images are NOFRAG_MAIN.FOR and NOFRAG_SUB.FOR. I have included both source and executable files. If you want to recreate the executable files, simply compile and link each program (you must have a FORTRAN compiler). o This program was developed on a VAX 11/785 running VMS version 4.3. However, it runs fine with VMS version 4.5 and should probably work on all 4.x systems. NO_FRAGMENTS spawns some DCL commands (COPY, DIRECTORY, DELETE, and SORT), so I am unsure if it will work correctly with VMS 3.x systems because I don't now if the syntax for these particular commands changed with the upgrade to VMS 4.0. Anyone who wants to try this program should read this entire handout before proceeding. WHAT DOES IT DO? o NO_FRAGMENTS will make each file in a particular directory tree contiguous if there is sufficient contiguous space available on the disk. If the chosen directory tree is the main [000000] directory, then all of the files on the disk will be restructured. WHAT DOESN'T IT DO? o NO_FRAGMENTS doesn't group all of the files in a directory tree into one huge contiguous block. In other words, although each file in the directory will be de-fragmented, the boundaries of each successive file aren't guaranteed to be adjacent. Also, A "feature" of NO_FRAGMENTS is that it sets the Date/Time Revised field of each file it restructures to today's date and time. If you find this to be an undesirable feature, then you should not use NO_FRAGMENTS. Page 3 INSTALLING NO_FRAGMENTS o Choose a directory in which you want to put the NO_FRAGMENTS executable files. DEFINE the logical name NO_FRAGMENTS$ to point to this directory. For example, if you want to put the files in SYS$SYSTEM, put the following command in the SYSTARTUP.COM file in SYS$MANAGER: $ DEFINE/SYSTEM NO_FRAGMENTS$ SYS$SYSTEM o Copy NOFRAG_MAIN.EXE and NOFRAG_SUB.EXE to NO_FRAGMENTS$. o Include the following line in the SYSTARTUP.COM file in SYS$MANAGER: $ NOFRAG :== $NO_FRAGMENTS$:NOFRAG_MAIN RUNNING NO_FRAGMENTS o Before running NO_FRAGMENTS, you should first set default to the desired directory to be defragmented. o Then, enter the command: $ NOFRAG o You should now see the following display: NO FRAGMENTS v. 1.0 Restructuring device_name:[directory_name...] Creating Data Base Sorting Data Base NO FRAGMENTS subprocess starting - date time o When the subprocess has finished, you should see the following display: NO FRAGMENTS subprocess finished - date time HOW DOES IT DO IT? o First, NO_FRAGMENTS figures out what directory it is in. o Next, NO_FRAGMENTS executes a DIRECTORY/NOHEAD/NOTRAIL/SIZE=ALLOCATION command for the files in the directory and sends the output to the file SYS$SYSTEM:LIST_OF_FILES.FRG. o Then, NO_FRAGMENTS sorts the records of filenames in SYS$SYSTEM:LIST_OF_FILES.FRG by file size (smallest to largest) into the file SYS$SYSTEM:SORTED_LIST_OF_FILES.FRG. Page 4 o At this point, a subprocess will be spawned that will read SYS$SYSTEM:SORTED_LIST_OF_FILES.FRG a record at a time and will attempt to perform a COPY/CONTIGUOUS/REPLACE/NOLOG for the file listed in each record. In other words, an attempt will be made to copy each file contiguously over itself (no attempt is made to copy .DIR or .SYS files)! If a file is locked when the attempt is made to copy it, an error message will be sent to the terminal and the subprocess will continue. o When the subprocess is finished, the user will be notified and all temporary files created by NO_FRAGMENTS will be deleted. WHEN SHOULD I USE NO_FRAGMENTS ? o BACKUP does a much better (and faster) job of defragmenting a disk than NO_FRAGMENTS does. However, you must take a disk offline for BACKUP to defragment it. If you have a VAX that needs to run continuously for days or weeks at a time, it is not always practical or possible to bring down the system to defragment a disk. NO_FRAGMENTS allows individuals to defragment their personal directory tree and system managers to defragment an entire disk (or rooted directory) without taking the system down. COMMENTS o NO_FRAGMENTS can be very SLOW when handling large numbers of files. One reason that it is slow is due to the large number of LIB$SPAWN commands that are executed. If anyone out there in DECUS land can reprogram these spawned parts of NO_FRAGMENTS so that it will run faster, please send me your revisions. If I incorporate your revisions, I will give you credit in future releases. o You must remain logged in when running NO_FRAGMENTS (if you LOG OUT before being notified that the program is finished, the subprocess will abort prematurely). This shouldn't be a problem for an individual on a moderately busy system who is trying to defragment a personal directory tree of 1000 blocks or so. However, a system manager may have to remain logged in for several hours when defragmenting a large disk on the same system. I would suggest running NO_FRAGMENTS from the system console in a situation like this. Page 5 o The command: $ DUMP/HEADER/BLOCKS=COUNT=0 filename will display several items of information about a file, including how fragmented it is. This information is contained under the heading 'Retrieval pointers'. There are two columns under this heading. These columns are 'Count:' and 'LBN'. Each LBN (logical block number) tells the location on a disk where the file fragment begins. The Count tells how many blocks begin at this location. If there is only one LBN and one Count, then the file is not fragmented. The following two examples show the retrieval pointers for a fragmented 50 block file and a non-fragmented 50 block file. -------------------------------------------------------- Retrieval pointers Count: 12 LBN: 902 Count: 2 LBN: 918 Count: 18 LBN: 940 Count: 6 LBN: 962 Count: 8 LBN: 970 Count: 2 LBN: 980 Count: 2 LBN: 992 Example 1 - fragmented 50 block file -------------------------------------------------------- Retrieval pointers Count: 50 LBN: 15414 Example 2 - nonfragmented 50 block file -------------------------------------------------------- o Some DCL commands that create new files allow a /CONTIGUOUS qualifier that allow you to create contiguous files (if there is enough contiguous space available). Some of these are: COPY LINK It is a good idea to use the /CONTIGUOUS qualifier when using these commands. LIABILITIES The author and Auburn University accept no responsibility for any damage caused by this software. Use at your own risk !! Page 6 SMART by David Swanger Academic Computing Services 200 L Bldg. Auburn University, Al 36849 205-826-4813 INTRODUCTION o SMART is a semi-intelligent program that displays all of the interactive processes on a VAX next to the Username for each process (in other words, it is a Smart Show Users). SMART is written in VAX FORTRAN and was developed on VAX 11/785 running VMS version 4.3. However, it runs fine with VMS version 4.5 and should probably work on all 4.x systems. o SMART consists of one executable image, SMART.EXE. The source file for this image is SMART.FOR. I have included both source and executable files. If you want to recreate the executable file, simply compile and link the program (you must have a FORTRAN compiler). INSTALLING SMART o Since this program should probably only be executed by the System Manager, copy SMART.EXE to SYS$SYSTEM. Then include the following line in the System Manager's LOGIN.COM file: $ SM*ART :== $SYS$SYSTEM:SMART RUNNING SMART o Enter the command: $ SMART o You should now see a list of all of the users on the system. To the right of each user will be the name of the executable image (if any) the user is executing. HOW DOES IT DO IT? o SMART reads all of the users on the system into an array using a series of LIB$GETJPI calls. The array is sorted alphabetically by username. The array is then printed to the terminal. It's easy! Page 7 o This program is reasonably well commented. Most questions about the program can probably be answered just by reading the code and comments. WHEN SHOULD I USE SMART ? o SMART lets you know what people are doing on the system. This knowledge can be very helpful in many situations (such as in a secure environment). Use SMART whenever you need this information (It's kind of Big Brotherish, I guess, but most System Managers have to be Big Brother now and then). COMMENTS o SMART will sometimes show more interactive processes than SHOW USERS will. This is because users sometimes have processes that spawn other processes. SMART will show you all of the processes for each user. o SMART will ocassionally react sluggishly when executed. This seems to happen when there are a lot of compute intensive jobs working in the system at the same time. It is rarely a problem with most systems. LIABILITIES The author and Auburn University accept no responsibility for any damage caused by this software. Use at your own risk !! Page 8 XMODEM_AU by David Swanger Academic Computing Services 200 L Bldg. Auburn University, Al 36849 205-826-4813 INTRODUCTION o XMODEM_AU is a revised version of Jim Belonis' XMODEM 5.60. I have rewritten the user interface to the program. All of the really good communications routines are Jim's. XMODEM_AU is written in VAX FORTRAN and works fine with VMS 4.3 through 4.5. XMODEM_AU consists of one executable image, XMODEM_AU.EXE. The source file for this image is XMODEM_AU.FOR. I have included both source and executable files. I have also included a help file named XMODEM_AU that should be included into the System Help library. If you want to recreate the executable file, simply compile and link the program (you must have a FORTRAN compiler). WHAT'S NEW ? o When XMODEM_AU is executed, the following prompt is displayed: $ XMODEM XMODEM> XMODEM_AU is now waiting for you to enter a command. Although compatibility with version 5.60 has been retained to a degree, several new commands have been added. These commands are: SEND RECEIVE CRC NOCRC BINARY TEXT EXIT HELP SHOW Complete descriptions of these commands are available in the XMODEM_AU.HLP file. o XMODEM 5.60 would quit working after one action whether it was successful or not. XMODEM_AU attempts to handle every situation, successful or not. Although XMODEM_AU crashes occasionally, it usually will give you an error message for incorrect syntax and will return the XMODEM> prompt after every operation. Page 9 COMMENTS o The source code for XMODEM_AU has been reasonably well commented. If you have any questions, comments, or improvements, please feel free to contact me. LIABILITIES The author and Auburn University accept no responsibility for any damage caused by this software. Use at your own risk !!