(edited 2-Apr-91, Chapter 3) (Managing Files\int_manag_chap)

This chapter describes how to manage files, including how to: (unnumbered) Display files Print files Copy files Combine files Compare similar files Rename files Delete files Protect and unprotect files from deletion Backup files on a volume Restore backed-up files to their original state Consolidate fragmented free space on your storage volume

The exercises in this chapter assume you have created the logical disk file INTRO.DSK on your default storage volume, mounted the file as logical device LD0, initialized it, and assigned it as your default storage volume. If you have not, issue the following command sequence (for information on the commands, see (int_start_chap), (uld_sec)): (.)(CREATE INTRO.DSK/ALLO:400 (RET)) (.)(MOUNT LD0: DK:INTRO.DSK (RET)) (.)(INIT/NOQ LD0: (RET)) (.)(ASSIGN LD0: DK: (RET))

Whenever you start your computer, RT--11 assigns your system device as your default storage device. So, if you have followed the instructions in (int_start_chap), but have restarted your computer since reading that chapter, reassign your logical disk device as your default storage device: (.)(ASSIGN LD0: DK: (RET)) (Displaying Files)

The TYPE command displays the contents of a file on your terminal screen. This command runs the PIP (peripheral interchange program) utility contained in the file PIP.SAV on your system volume. Issue the command in the following format: TYPE filespec

If you are displaying a file that contains more than 24 lines of information, the file scrolls off the screen. The contents of the file appear at the bottom of the screen and eventually disappear off the top as if the file were on a scroll being unrolled at the bottom and rolled at the top.

Display the contents of the file DEMOF3.FOR: (.)(TYPE SY:DEMOF3.FOR (RET))

Since this file contains more than 24 lines, when the contents of the file stop scrolling, you will not be able to see the beginning of the file.

Issue the preceding command again, but this time press (NO SCROLL) or (HOLD SCREEN) before the beginning of the file scrolls from view. Pressing (NO SCROLL) or (HOLD SCREEN) once stops the screen display from scrolling.

Resume the scrolling by pressing (NO SCROLL) or (HOLD SCREEN) a second time. (Printing Files)

RT--11 supports many kinds of printers from line printers to laser printers. (Checking the Printer Interface)

Check your hardware manual to see which interface your printer uses. PDP--11 computers can use either serial- or parallel-interface printers.

RT--11 uses the LS handler for serial-interface printers and the LP handler for parallel-interface printers. However, by default RT--11 utilities send print jobs to a device named LP. So, if your printer is a serial-interface printer, you must logically associate the name LP with the LS handler by issuing the following ASSIGN command before you use the PRINT command for the first time: (.)(ASSIGN LS LP (RET))

Since you must use the ASSIGN command each time you start RT--11, you may want to include this command in your startup command file (see (int_startup_chap)). (Managing the Printing Process)

The PRINT command prints one or more files on your printer. This command runs the PIP utility and can cause the SPOOL utility (if it is running) to manage the printing process, freeing your terminal for your use while your file is printing. See (int_sysjob_chap) for an explanation of how to use SPOOL.

If you do not use SPOOL, you may be delayed in getting the monitor prompt back until your file has finished printing. (Issuing the PRINT Command)

Issue the PRINT command in the following format: PRINT filespec

Print a listing of the file DEMOF3.FOR: (.)(PRINT SY:DEMOF3.FOR (RET))

If you do not use wildcards, you can specify up to six individual files with the PRINT command. Separate each filespec with a comma: PRINT MEMO1.TXT,MEMO2.TXT,MEMO3.TXT,MEMO4.TXT,MEMO5.TXT,MEMO6.TXT

By using wildcards in a filespec, you can print more than six files at a time. PRINT MEMO%.*

Issue the following command to print two short FORTRAN demonstration files located on your system volume: (.)(PRINT SY:DEMOF1.FOR,SY:DEMOF2.FOR (RET))

One of the several options of this command is the /COPIES:n option. For example, if you wanted to print three copies of the file DEMOF2.FOR, you would issue the command: (.)(PRINT SY:DEMOF2.FOR/COPIES:3 (RET)) (Stopping a File from Printing)

You can stop RT--11 from sending file text to the printer while it is printing in several ways. (Note that if your printer has a large text storage buffer, the file will not stop printing until the buffer is empty.) (unnumbered) If you are not running SPOOL, then press (CTRL/C) twice to stop the print job. If you are running the SPOOL utility, issue the following KMON command to stop the print job: (.)(SET SP KILL (RET))

SP is the handler for the SPOOL utility. See the (sum_book) for a description of all SPOOL SET commands. (Copying Files\cf_sec)

The COPY command makes a duplicate of a file or files and places it on the volume and with the file name you specify. The original version of the file is unaffected; that is, a copy of the original version is made and moved to the new location. You should copy important files to a backup volume for safekeeping.

Issue the command in the following format: COPY in-filespec out-filespec

This command has a wide selection of options letting you perform many types of copy operations such as copying the bootstrap code to the bootstrap blocks on the same volume or copying all the files on a large volume to several small volumes.

Do the following exercise: (numbered) Copy the file DEMOF1.FOR from the system volume to your storage volume and name it EXAMP.ONE: (.)(COPY SY:DEMOF1.FOR EXAMP.ONE (RET)) Next, copy the file DEMOF2.FOR from the system volume to your storage volume and name it EXAMP.TWO: (.)(COPY SY:DEMOF2.FOR EXAMP.TWO (RET)) Then, issue the DIRECTORY command to verify that your storage volume contains the two files EXAMP.ONE and EXAMP.TWO. You should get a listing similar to the following: (.)(DIR (RET)) ( 11-SEP-88 EXAMP .ONE 1P 26-AUG-88 EXAMP .TWO 1P 26-AUG-88 2 Files, 2 Blocks 390 Free blocks)

Notice that the files have a P next to their block size. When you copied those two files from the system volume, you not only copied the files' contents but also automatically copied the protected status and creation dates of the original files. The P means these two files cannot be deleted by the DELETE command unless you first unprotect them with the UNPROTECT command (see (UF_sec)). Finally, verify that the original files are still on the system volume, by issuing the following command: (.)(DIR SY:DEMOF%.FOR (RET)) (Combining Files)

Use the COPY/CONCATENATE form of COPY to combine several input files into one output file.

You can use wildcards in the input filespec. For example, the following command copies all files on volume DU1 with a .TXT file type into the one file MEMOS.TXT on that volume. (.)(COPY/CON DU1:*.TXT DU1:MEMOS.TXT (RET))

If you do not use wildcards, you must use commas. For example: (.)(COPY/CON DU1:MEMO1.TXT,MEMO2.TXT,MEMO3.TXT DU1:MEMOS.TXT (RET))

In these two examples, the input files remain the same and the output file MEMOS.TXT is either created (if it does not exist) or is replaced to include only the joined files (if it already exists and is (unprotected) --- See Sections (pro_sec\value) and (uf_sec\value)).

Combine the two files EXAMP.ONE and EXAMP.TWO into one file EXAMPS.TXT: (.)(COPY/CON EXAMP.* EXAMPS.TXT (RET))

Check your directory to verify that you now have the new file EXAMPS.TXT; and note that the new file is two blocks in length, since it is a combination of two 1-block files. (.)(DIR (RET)) ( 11-SEP-88 EXAMP .ONE 1P 26-AUG-88 EXAMP .TWO 1P 26-AUG-88 EXAMPS.TXT 2 10-Sep-88 3 Files, 4 Blocks 388 Free blocks)

The file EXAMP.ONE is almost identical to the file EXAMP.TWO. So the file EXAMPS.TXT has repetitious information. For a further check of EXAMPS.TXT, display the file with the TYPE command: (.)(TYPE EXAMPS.TXT (RET)) (Comparing Text Files)

The DIFFERENCES command compares two ASCII text files and produces a listing of any differences between them. This command runs the SRCCOM (source comparison program) utility and requires that the file SRCCOM.SAV be on the system (SY) volume.

Issue the command in the following format: DIFFERENCES filespec-1 filespec-2

During a text comparison, RT--11 compares the two specified files, character for character, and lists any lines that contain differences. Differences between uppercase and lowercase characters are listed. By default, the listing is displayed on the terminal screen. However, you can redirect the listing from the terminal to a file by using the /OUTPUT:(filespec) option, or to the printer, by using the /PRINTER option.

Usually, you perform a text comparison between two files that you expect to be the same or at least similar. For example, if an individual has copied one of your files to make changes to it, you can quickly scan the changes by performing a text comparison between the new version and your original.

Another use of a text comparison is to check edits you have made to a file yourself. By comparing the backup file against the edited version, you can proofread the changes since only the portions of text that are different are printed.

If you compare two files that are identical, RT--11 does not create a listing, but displays the following message on the terminal screen: ?SRCCOM-I-No differences found

If you compare two files that are different, RT--11 produces a listing of the differences and displays the following message on the terminal screen: ?SRCCOM-W-Files are different (Two Example Files)

To understand how to interpret the output listing, first look at the following two sample FORTRAN text files. These are the two files, EXAMP.ONE and EXAMP.TWO, that you copied onto your default storage device according to the instructions of the preceding section. Note the two differences between the files: (unnumbered) In line 7, the first file has (go to 10), while the second file has (go to 100). In line 14, the first file has the variable (radamg), while the second file has the variable (radang).

(Example 1: FORTRAN File with Errors (EXAMP.ONE)\bold) real function ASIND( x) real x c c This FORTRAN callable function returns the ARCSINE c of a specified value as an angle in degrees. c if (ABS( x) .lt. 1.0) go to 10 ASIND = x * 90.0 return c c Use trigonometric identity to calculate ARCSINE of X. c Then convert radians to degrees. c 100 radamg = ATAN( x / SQRT( 1.0-x**2)) ASIND = radang * 57.29577951 return c end

(Example 2: FORTRAN File Without Errors (EXAMP.TWO)\bold) real function ASIND( x) real x c c This FORTRAN callable function returns the ARCSINE c of a specified value as an angle in degrees. c if (ABS( x) .lt. 1.0) go to 100 ASIND = x * 90.0 return c c Use trigonometric identity to calculate ARCSINE of X. c Then convert radians to degrees. c 100 radang = ATAN( x / SQRT( 1.0-x**2)) ASIND = radang * 57.29577951 return c end

Display the files so you can see their contents on your terminal screen and can compare them with the display in this manual: (.)(TYPE EXAMP.ONE (RET)) (.)(TYPE EXAMP.TWO (RET)) (Comparing the Example Files)

Issue the following command to compare the two files EXAMP.ONE and EXAMP.TWO and to create the file EXAMP.DIF containing a listing of any differences: (.)(DIFFERENCES/OUTPUT:EXAMP EXAMP.ONE EXAMP.TWO (RET))

Since the files are different, RT--11 will display the following message on your screen: ?SRCCOM-W-Files are different

Next, issue the DIRECTORY command to verify that you have a new file EXAMP.DIF and then display that file. You will get a directory listing similar to the following plus the following file display: (.)(DIR (RET)) ( 10-Sep-88 EXAMP .ONE 1P 26-Aug-88 EXAMP .TWO 1P 26-Aug-88 EXAMPS.TXT 2 10-Sep-88 EXAMP .DIF 1 10-Sep-88 4 Files, 5 Blocks 387 Free blocks) (.)(TYPE EXAMP.DIF (RET)) (1 DK:EXAMP.ONE 2 DK:EXAMP.TWO ********** 11 if ABS x .lt. 1.0 go to 10 1 ASIND = x * 90.0 **** 21 if ABS x .lt. 1.0 go to 100 2 ASIND = x * 90.0 ********** 11 100 radamg = ATAN x / SQRT 1.0-x**2 1 ASIND = radang * 57.29577951 **** 21 100 radang = ATAN x / SQRT 1.0-x**2 2 ASIND = radang * 57.29577951 **********)

The first two lines identify the two files being compared. Each file name and the device on which the file resides are printed. For example: 1 DK:EXAMP.ONE 2 DK:EXAMP.TWO

The numbers at the left margin have the form (n())m), where (n) specifies the files (either 1 or 2) and (m) specifies the page of that file on which the specific line is located. In this case, both input files contain only one page.

RT--11 displays 10 asterisks both before and after a section showing one or more differences between two files. In addition, within each section, a line of 4 asterisks separates the two files being compared, thus dividing each difference section into two subsections. For example: ********** 11 if (ABS( x) .lt. 1.0) go to 10 1 ASIND = x * 90.0 **** 21 if (ABS( x) .lt. 1.0) go to 100 2 ASIND = x * 90.0 **********

Each difference section ends with a matching line, used as a reference to identify the location of the differing lines. For example: ASIND = x * 90.0

and ASIND = radang * 57.29577951 (Renaming Files)

The RENAME command assigns a new name (or a new file type or both) to a file in a volume directory without altering or moving the file itself. Since this command does not move a file, the volume indicated in the input and output portions of the command must be the same; otherwise, you get an error message. The command uses the PIP utility. Issue the command in the following format: RENAME in-filespec out-filespec

Rename the file EXAMP.ONE to EXAMP1.FOR and the file EXAMP.TWO to EXAMP2.FOR: (.)(RENAME EXAMP.ONE EXAMP1.FOR (RET)) (.)(RENAME EXAMP.TWO EXAMP2.FOR (RET))

Issue the DIRECTORY command to verify that your files are renamed. You should get a listing similar to the following: (.)(DIR (RET)) ( 10-Sep-88 EXAMP1.FOR 1P 26-Aug-88 EXAMP2.FOR 1P 26-Aug-88 EXAMPS.TXT 2 10-Sep-88 EXAMP .DIF 1 10-Sep-88 4 Files, 5 Blocks 387 Free blocks) (Deleting Files)

Use the DELETE command when you no longer need a file. DELETE removes information about a file from a volume's directory; and the space that the file occupies on the volume becomes available for reuse. You can specify up to six individual files at a time for deletion, though if you use wildcards, you can delete any number of files at once. Issue the command in the following format: DELETE filespec,filespec,...

If you use wildcards with the DELETE command or if you use the /QUERY option, RT--11 requests confirmation from you for each file to be deleted. The /QUERY option is a helpful way of making sure you do not delete the wrong file by accidentally typing in a wrong letter or letters in the file specification. Typing Y in response to the confirmation prompt instructs RT--11 to delete the indicated file; typing N in response instructs RT--11 not to delete that file and go on to the next.

The DELETE command, however, will not delete files that have a protected status, indicated by the P next to their file size in a directory listing. You must first UNPROTECT such files before you can delete them (see (uf_sec)).

Issue the DELETE command either with the asterisk wildcard and factoring or with the /QUERY option, as in the following examples. Then, delete the file EXAMPS.TXT: (.)(DELETE *.(FOR,TXT) (RET)) (PIP-W-Protected file LD0:EXAMP1.FOR) (PIP-W-Protected file LD0:EXAMP2.FOR) ( Files deleted:) (LD0:EXAMPS.TXT ?) (Y (RET))

or (.)(DELETE/QUERY EXAMP1.FOR,EXAMP2.FOR,EXAMPS.TXT,EXAMP.DIF (RET)) (PIP-W-Protected file LD0:EXAMP1.FOR) (PIP-W-Protected file LD0:EXAMP2.FOR) ( Files deleted:) (LD0:EXAMPS.TXT ?) (Y (RET)) (LD0:EXAMP.DIF ?) (N (RET))

Issue the DIRECTORY command to see that you still have the files EXAMP1.FOR, EXAMP2.FOR, and EXAMP.DIF, but not the file EXAMPS.TEX. You should get a listing similar to the following: (.)(DIR (RET)) ( 10-Sep-88 EXAMP1.FOR 1P 26-Aug-88 EXAMP2.FOR 1P 26-Aug-88 EXAMP .DIF 1 10-Sep-88 3 Files, 3 Blocks 389 Free blocks)

If you use wildcards with the DELETE command, RT--11 automatically excludes from deletion any files with a .SYS file type. To include .SYS files in a deletion command that uses wildcards, you must include the /SYSTEM option and you must first have unprotected the files. (Protecting Files\pro_sec)

A file that has a (protected) status cannot be deleted or modified by an editor until that status is removed.

DIGITAL gave the files DEMOF2.FOR and DEMOF3.FOR a protected status so that you would not accidentally delete them. These files kept their protected status both when you copied the files with the COPY command and when you renamed them with the RENAME command. RT--11 does this so you do not accidentally delete a protected file after you copy or rename it.

The PROTECT command, which runs the PIP utility program, gives a file protected status. You can include up to six file specifications (separated by commas) with this command, and wildcards are supported. However, if you specify the /QUERY option with the command, RT--11 requests confirmation for each file specified before it will be protected.

Issue the command in the following format: PROTECT filespec

Give the file EXAMP.DIF protected status and then display a listing of that file to verify that a P is placed to the right of the file's block number (size): (.)(PROTECT EXAMP.DIF (RET)) (.)(DIR (RET)) ( 10-Sep-88) (EXAMP1.FOR 1P 26-Aug-88 EXAMP2.FOR 1P 26-Aug-88) (EXAMP .DIF 1P 10-Sep-88) ( 3 Files, 3 Blocks) ( 389 Free blocks) (Unprotecting Files\uf_sec)

The UNPROTECT command removes a file's protected status so you can delete the file or edit it with an editor. This command also runs the PIP utility program. Issue the command in the following format: UNPROTECT filespec

You can include up to six file specifications (separated by commas) with this command, and wildcards are supported. However, if you specify the /QUERY option with the command, RT--11 requests confirmation for each file specified before it will be unprotected. You can specify up to six separate files (separated by commas) with this command, or you can specify any number of files if you include wildcards in your specification. However, if you specify the /QUERY option with the command, RT--11 requests confirmation for each file specified before it will unprotect it.

Remove the protected status from the file EXAMP1.FOR. Then list the directory of your default storage volume to verify that the P is removed from the block number beside the listing of the file: (.)(UNPROTECT EXAMP1.FOR (RET)) (.)(DIR (RET)) ( 10-Sep-88) (EXAMP1.FOR 1 26-Aug-88 EXAMP2.FOR 1P 26-Aug-88) (EXAMP .DIF 1P 10-Sep-88) ( 3 Files, 3 Blocks) ( 389 Free blocks)

Finally, to verify that the file EXAMP1.FOR is unprotected, delete that file from your directory, and check the directory listing to see that the file is no longer there: (.)(DELETE EXAMP1.FOR (RET)) (.)(DIR (RET)) ( 10-Sep-88) (EXAMP2.FOR 1P 26-Aug-88 EXAMP .DIF 1P 10-Sep-88) ( 2 Files, 2 Blocks) ( 390 Free blocks) (Backing Up and Restoring Files)

Issue the BACKUP command to make a backup copy of a whole disk, many files, or a large file. The BACKUP command runs BUP, the backup utility program, contained in the file BUP.SAV on your system volume. BUP is especially designed to efficiently and speedily back up large amounts of information. Unlike the COPY command, the BACKUP command can copy files across volumes; that is, the backup procedure can copy one portion of a backed-up file to one volume and the rest of the file (if it does not fit on the first volume) to a second volume.

Issue the BACKUP command in the following format: BACKUP in-filespec out-filespec

The BACKUP command can do three kinds of back up operations. It can backup: (unnumbered) One or more files into a container saveset file An entire disk into a container saveset file One or more files into a new logical disk file that BUP creates as part of the operation

While you can use the first two operations with a disk, diskette, or magtape as the backup volume, you can use the last operation only with a disk or large enough diskette as the backup volume. Unless you are doing the third backup operation, the directory structure of a backup volume made by BUP is not the same as the directory structure of a volume made by other RT--11 utilities, such as PIP. This means you have to (restore) a backup volume before you can use the files on that volume (except for logical disk backup volumes).

This section describes how to use the BACKUP command to do the following: (unnumbered) Back up files on a volume List a directory on a backup volume Restore backed-up files

For a complete description of the BACKUP command and utility, see (int_bup_chap). (Backing Up Files)

One advantage of backing up only files, rather than an entire disk, is that you do not copy unused areas on a disk.

Use the /VERIFY option with the BACKUP command to verify that the copied (backed-up) files are an exact match of the original ones. The verification procedure for the BACKUP command is relatively fast since it is especially designed to compare large areas of a volume at a time.

It is not necessary to initialize a new volume separately when using the BACKUP command, since the backup procedure has its own initialization procedure as a part of the backup. Once, however, BACKUP initializes a volume, the backup procedure does not automatically reinitialize it if the procedure uses the same backup volume again. This is useful since it lets you store more than one set of backed-up files on a volume having extra storage space.

BACKUP compartmentalizes all the files it backs up at one time; that is, it saves them in one file called a (saveset). The default file type for this file is .BUP, and the default file name with file type is BACKUP.BUP. The following example command, however, gives the name MYBACK.BUP to the backup file: (.)(BACKUP/VERIFY *.* DU1:MYBACK (RET))

During the BACKUP procedure, RT--11 prompts you with messages asking for operator confirmation. For example, BACKUP prompts you to confirm the initialization of a new backup volume. In response to the initialization prompt, type Y if there are no files on the new backup volume that you want to save. Otherwise, type N and start over with a volume you can use as a backup.

When you issue the BACKUP command, your interaction with RT--11 should be similar to what follows, depending on the type of volume you use as a backup and your response to the prompts. The ellipsis indicates the names of the files that are copied: (.)(BACKUP/VERIFY DU0:*.* DU1:MYBACK (RET)) (Mount output volume in DU1: Continue?) (Y (RET)) (?BUP-W-Not a BACKUP volume) (DU1:/BUP Initialize; Are you sure?) (Y (RET)) (?BUP-I-Bad block scan started) (?BUP-I-No bad blocks detected) (?BUP-I-Creating output volume 1) ( Files backed up:) ( .) ( .) ( .) (?BUP-I-Verify pass started) (?BUP-I-Backup/Verify operation is complete) (Listing a BACKUP Volume Directory)

Backup volumes are uniquely formatted and have directories structured differently from other RT--11 volumes. So, you need the /DIRECTORY option of the BACKUP command (rather than the DIRECTORY command) to get a directory listing of what is on a backup volume.

Use the BACKUP/DIRECTORY command to display on your terminal a directory listing of what is on your your backup volume. For example: (.)(BACKUP/DIRECTORY DU1: (RET)) ( RT-11 BACKUP) ( 10-Sep-88 10:59) ( Saveset Section Blocks Date) ( MYBACK.BUP 1/1 11/11 10-Sep-87) ( 1 Saveset Section, 11 Blocks) ( 781 Free blocks)

The following explains the (section) and (blocks) columns of the preceding display: (unnumbered) (Section\bold)

A section of a saveset is the amount of the saveset that fits on one backup volume. So, the number of sections in a saveset is the same as the number of volumes used to back up a disk.

The number after the slash in the (section) column indicates how many sections a saveset file is divided into. And the number before the slash in that column indicates the number of the saveset section on that backup volume. For example, the 1/1 for the saveset MYBACK.BUP means the saveset is undivided and the entire saveset file is on that volume. However, a section column of 1/2 means the saveset file is divided into 2 sections (since it did not fit on the volume), and the first section is contained on that backup volume. (Blocks\bold)

The number after the slash in the (blocks) column indicates how many blocks a saveset has. The number before the slash in that column indicates how many of those blocks are on that volume.

For example, the saveset MYBACK.BUP has 11 blocks and all of them are on the one backup volume. However, if MYBACK.BUP had 1200 blocks, the entire saveset would not fit on one diskette. In that case, the (blocks) column would indicate 792/1200; that is, the saveset contains 1200 blocks, but only 792 of them are on that backup volume.

Though the two files contained in the saveset file MYBACK.BUP contain only 2 blocks, a directory of 9 blocks is also part of the saveset file, making the total block number 11.

One or more additional backup savesets (depending on their block size) could also be copied to the example backup volume since that volume still has 781 free blocks. (Restoring BACKUP Files)

BACKUP volumes cannot be used as you would use other volumes of RT--11 files. The purpose of a backup volume is only to store files. To use backed-up files, you must (restore) them onto another volume.

Issue the BACKUP/RESTORE command (as in the following example) to restore a volume(s) of files from one saveset file back into one volume of separate, usable files.

The /SAVESET option tells RT--11 which saveset on the specified device you want restored. If you do not use this option, RT--11 retrieves the files from the default saveset BACKUP.BUP on disk volumes or from the first available saveset on tape volumes.

After the /SAVESET option, type a comma and indicate which files in the saveset you want to restore. The wildcards in the following example tell RT--11 to restore all the files in the saveset. However, you do not have to restore all the files in a saveset, and you can put individual file names here rather than wildcards.

Specify the SAVESET option after the saveset filespec as in the following example. In this example, only one backup volume was used to back up the files. The ellipsis indicates the names of the files contained in the saveset: (.)(BACKUP/RESTORE DU1:MYBACK/SAVESET,*.* DU0:*.* (RET)) (Mount input volume 1 in DU0; Continue?) (Y (RET)) (?BUP-I-Restore operation started from volume 1) ( Files restored:) ( .) ( .) ( .) (?BUP-I-Restore operation is complete) (An Exercise in Backing Up and Restoring Files)

To see what happens when you use the BACKUP utility both to (back up) and to (restore) files, do the following exercise: (numbered) Insert a diskette (either a new one or one having files you do not want to save) into one of your diskette drives so it can be used as a backup diskette. Issue the following command to back up your logical disk files onto the diskette and type Y in response to the prompts. The example presumes a new, unused diskette: (.)(BACKUP/VERIFY *.* DU1:MYBACK (RET)) (Mount output volume in DU1; Continue? )(Y (RET)) (?BUP-W-Volume not RT-11 initialized) (DU1:/BUP Initialize; Are you sure?) (Y (RET)) (?BUP-I-Bad block scan started) (?BUP-I-No bad blocks detected) (?BUP-I-Creating output volume 1) ( Files backed up:) (LD0:EXAMP2.FOR) (LD0:EXAMP.DIF) (?BUP-I-Verify pass started) (?BUP-I-Backup/Verify operation is complete) Unprotect and delete the files on LD0, the logical disk device you should be using as your default storage volume (DK): (.)(UNPROTECT *.* (RET)) ( Files unprotected:) (DK:EXAMP2.FOR) (DK:EXAMP.DIF) (.)(DELETE *.* (RET)) ( Files deleted:) (DK:EXAMP2.FOR ? )(Y (RET)) (DK:EXAMP.DIF ? )(Y (RET)) Check the directory of your default storage device to see that it is now empty: (.)(DIR (RET)) ( 10-Sep-88) ( 0 Files, 0 Blocks) ( 392 Free blocks) With the BACKUP/DIRECTORY command, check the directory of your backup volume to see what is recorded: (.)(BACKUP/DIRECTORY DU1: (RET)) ( RT-11 BACKUP) ( 10-Sep-88 10:59) ( Saveset Section Blocks Date) ( MYBACK.BUP 1/1 11/11 10-Sep-87) ( 1 Saveset Section, 11 Blocks) ( 781 Free Blocks) With the BACKUP/RESTORE command and the /SAVESET input option, restore your backed-up files on LD0. Type Y in response to the mount prompt: (.)(BACKUP/RESTORE DU1:MYBACK/SAVESET,*.* LD0:*.* (RET)) (Mount input volume 1 in LD0; Continue? )(Y (RET)) (?BUP-I-Restore operation started from volume 1) ( Files restored:) (DK:EXAMP2.FOR) (DK:EXAMP.DIF) (?BUP-I-Restore operation is complete)

When RT--11 restores files in this way, it does not initialize the volume it is restoring, but rather adds the restored files to the volume. This is useful when you do not want to delete files already on a volume, but only want to add some backed-up files to that volume.

However, if a file of the same name as a backed-up file already exists on a volume, BACKUP does either of two things. If the file already on the restoration volume is unprotected, the backed-up file of the same name takes its place. But if the file already on that volume is protected, the backed-up file is not restored. Check the directory of your restored volume: (.)(DIR (RET)) ( 10-Sep-88) (EXAMP2.FOR 1P 26-Aug-88 EXAMP .DIF 1P 10-Sep-88) ( 2 Files, 2 Blocks) ( 390 Free blocks) (Consolidating Fragmented Free Space)

At some point, you may run out of room to expand or add more files to a volume. If you run out of room on a volume, RT--11 displays a message telling you the device is full or that RT--11 is unable to open the output file.

Sometimes, however, there is still plenty of free space on a volume, but as you create and delete files, the free space becomes fragmented and therefore not always usable. For example, a large file might not fit on a volume because no single area of free space is large enough to accommodate the file, though if the free spaces were gathered together in one place, the large file could fit on the volume.

When the free space on a volume becomes too fragmented, use the SQUEEZE command to consolidate all the free space into a single area on the volume.

The SQUEEZE command runs DUP, the device utility program contained in the file DUP.SAV on your system volume. SQUEEZE consolidates all free space or unused areas on a random-access volume into a single area on that volume. This command is useful, since the RT--11 file system requires that each file occupy one contiguous space on a volume.

Issue the command in the following format: SQUEEZE ddn:

To prevent you from using bad blocks on a volume, the SQUEEZE command does not move files with a .BAD file type. Because monitor or handler files might be moved if you perform a squeeze operation on the system device, RT--11 automatically reboots the running monitor when the compressing operation finishes. (Caution) (unnumbered) You should not squeeze the system volume (SY) while a foreground job is running since the job may be using the volume and squeezing the volume at this time could destroy data or cause a system crash. (See (int_fb_chap) and (int_sysjob_chap) for information on foreground jobs.) You should be careful when squeezing any disk volume while a foreground job is loaded. If foreground jobs have open files on the volume being squeezed, you could lose data in those files and/or corrupt that volume. If a computer error or a power failure occurs during a squeeze operation, the contents of the volume will be lost. Make a backup copy of an important or large volume before using the SQUEEZE command. (A Procedure for Using the SQUEEZE Command)

A general procedure for using the SQUEEZE command follows: (numbered) With the DIRECTORY/FULL command, check your volume directory for unwanted files and for how much free space you have between files. Delete all unwanted files. For example, files with a .BAK file type (backup files made by the editor program) might be files to delete. Having deleted unwanted files, get the directory size (the number of occupied blocks left on your storage volume) by issuing the DIRECTORY/SUMMARY command. With the BACKUP/VERIFY command, make a backup copy of your volume: (.)(BACKUP/VERIFY *.* DU1:MYBACK (RET)) Issue the SQUEEZE command: (.)(SQUEEZE DK: (RET)) With the /FREE option of the DIRECTORY command, check that all free blocks are now contiguous: (.)(DIR/FREE DK: (RET)) Once you have verified that the SQUEEZE operation performed as you expected, you can if necessary use the backup volumes for other purposes. (An Exercise in Using the SQUEEZE Command)

To familiarize yourself with the SQUEEZE command, do the following exercise: (numbered) Issue the DIRECTORY command with the /FULL option to see how much free space is on your default storage volume (INTRO.DSK) and to see where the free space is located. You should get a display similar to the following: (.)(DIR/FULL (RET)) ( 10-Sep-88) (< UNUSED > 1 EXAMP2.FOR 1P 26-Aug-88 ) (< UNUSED > 2 EXAMP .DIF 1P 10-Sep-88 ) (< UNUSED > 387) ( 2 Files, 2 Blocks) ( 390 Free blocks)

The preceding display means that there is one block of unused space before the file EXAMP2.FOR, two blocks of unused space between the two files listed, and the remaining unused blocks after the listed files. To make the free blocks contiguous, issue the SQUEEZE command and type Y in response to the confirmation prompt: (.)(SQUEEZE DK: (RET)) (LD0:/Squeeze; Are you sure?) (Y (RET)) Issue the DIRECTORY/FREE command to verify that your files and the free block have been moved. You should get a display similar to the following: (.)(DIR/FREE (RET)) ( 10-Sep-88) (< UNUSED > 390) ( 0 Files, 0 Blocks) ( 390 Free blocks)

The one (< UNUSED >) entry means that all the unused blocks are together. (Chapter Summary)

This chapter describes the major KMON commands that help you manage files. You should use these commands to manage and maintain your files. The rest of this book presumes that you know how to do this. See the (SUG_book) for further information on these commands and for other less commonly used commands. The next two sections list the commands that run each utility named in this chapter and summarize those commands. (Commands and Utilities)

(candu_table) contains the commands and utilites discussed in this chapter. Each command is matched with the utility it runs. That utility must reside on your system (SY) device. (simple) (#) (Commands and Utilities\candu_table) (multipage) (2\29\) (Command\Required Utility) (BACKUP/DIRECTORY\BUP) (BACKUP/RESTORE\BUP) (first) (BACKUP/VERIFY\BUP) (COPY\PIP) (COPY/CONCATENATE\PIP) (DELETE\PIP) (DELETE/QUERY\PIP) (DIFFERENCES\SRCCOM) (DIFFERENCES/OUTPUT:filespec\SRCCOM) (DIFFERENCES/PRINTER\SRCCOM) (DIRECTORY/FREE\DIR) (DIRECTORY/FULL\DIR) (PRINT\PIP #(and SPOOL, if running)) (PROTECT\PIP) (RENAME\PIP) (SQUEEZE\DUP) (last) (TYPE\PIP) (UNPROTECT\PIP) (File Management Commands)

The following alphabetical list gives the monitor commands discussed in this chapter: (BACKUP/DIRECTORY)(ddn:) (simple) Lists on the terminal screen the saveset files on a volume. (BACKUP/RESTORE)(in-filespec/SAVESET,file-1,file-2, out-filespec) (simple) Restores one or more files from the specified saveset to a one or more files on an output volume. (BACKUP/VERIFY)(in-filespec,filespec, out-filespec) (simple) Backs up (copies) one or more files from an input volume to one or more output backup volumes and verifies that the input matches the output. (COPY)(in-filespec,filespec, out-filespec) (simple) Copies a file or files from one location to another. (COPY/CONCATENATE)(in-filespec,filespec, out-filespec) (simple) Combines two or more input files into one output file. (DELETE)(filespec,filespec,) (simple) Deletes a file or files from a volume's directory. (DELETE/QUERY)(filespec,filespec,) (simple) Deletes a file or files from a volume's directory only if you confirm each deletion at each confirmation prompt. (DIFFERENCES)(filespec-1 filespec-2) (simple) Compares two files and lists on the terminal screen the differences between them. (DIFFERENCES/OUTPUT:filespec)(filespec-1 filespec-2) (simple) Compares two files and lists in the file specified by the /OUTPUT option the differences between them. (DIFFERENCES/PRINTER)(filespec-1 filespec-2) (simple) Compares two files and prints on the system printer a listing of the differences between the files. (DIRECTORY/FREE)(ddn:) (simple) Lists the size of all free areas on a volume directory. (DIRECTORY/FULL)(ddn:) (simple) Lists an entire volume directory including unused areas and their sizes in blocks. (PRINT)(filespec,filespec,) (simple) Prints the contents of one or more files on the system printer. (PROTECT)(filespec,filespec,) (simple) Protects files so they cannot be deleted, or changed by an editor program. (RENAME)( in-filespec,filespec, out-filespec,filespec,) (simple) Assigns a new name (or names) to an existing file (or files). (SET)(SP KILL) (simple) Stops a file from printing, if SPOOL is managing the print job. (SQUEEZE)(ddn:) (simple) Consolidates all unused blocks and directory entries on a volume. (TYPE)(filespec,filespec,) (simple) Displays the contents of one or more files on the terminal screen. (UNPROTECT)(filespec,filespec,) (simple) Removes the protected status from files so they can be deleted or changed by an editor program.