
Data can be stored on magnetic tape, on magnetic disks, and on various other devices. Disk storage is reliable and fast, but suffers from its scarcity, cost, and lack of portability from one computer system to the next, particularly for very large disk files.
Tapes can suffer physical damage over long usage or improper storage conditions, but they are relatively cheap and portable, and offer a good medium for backing up important disk files. Compatibility can be a problem however, so before you commit data to tape determine whether the tape formats supported on CMS are usable on any other computer systems you may need to access.
The material below describes how tapes can be used on CMS. There are two sections: "Physical Characteristics", which defines a number of terms related to the physical recording of data on tape; and "Using Tapes on CMS", which gives the operating system commands for reading and writing tapes.
A 9 track tape is a 1/2 in. wide strip coated with magnetic material. Tape reels come in varying lengths - a full size reel contains 2400 feet of tape. Cartridge tapes..... Information is stored on the tape surface in the form of magnetized areas. One polarity represents 0; the opposite is 1. Information is recorded on the tape as patterns of 1's and 0's (bits). Eight bits make up a "byte" which is the fundamental data unit. A 9-track tape has 9 stripes running the length of the tape where bits can be stored. Each byte of data is written across the width of the tape, one bit per track, with the extra track used for error checking. The "density" with which data is stored on a tape is measured in "Bytes Per Inch" or BPI. Thus theoretically, a 1600 BPI tape that is 2400 feet long can hold 1600 x 12 x 2400 = 46 million bytes. In fact, data is not recorded in a continuous stream end to end of a tape, so the actual capacity of a 1600 BPI full reel of 9-track tape is somewhat less (there is unused tape at the beginning and end of the reel, each block of data is terminated by special checksum bytes and some blank tape that separates one data block from the next - roughly 1/2 inch between blocks).
The machine that records data on and retrieves data from a tape is called a tape drive. The process of storing data is called "writing" and the retrieval of data is called "reading" the tape.
The method used by large IBM computers for translation of characters into 8-bit patterns of 1's and 0's is called EBCDIC. Different computer systems may use different translation schemes, so if the tape will be taken to another computer installation it is important to know that UNET uses IBM mainframes and therefore uses EBCDIC. (Note that UNET can work with other character codes. See the UNET consultants for assistance.)
Logical records can be written one at a time on the tape or be collected into groups of several logical records which are then written as a unit. In either case, the collection of data actually transmitted to the tape is called a physical block or a physical record. Thus a block can contain a single logical record or several.
On the tape, each physical block is separated from the next by a gap of unused tape approximately .6 inch long. Recall that an 80-character line or record occupies only .05 inch of tape at density 1600 BPI. If a tape is to be used for such short records and each block contains only one logical record, then a great deal of tape will be wasted (approximately .65 inch per block, of which only .05 inch contains data).
The person using the tape may request a "blocking factor" - i.e., may specify how many logical records are to be combined into each physical block. The greater the physical block length, the more efficient the usage of tape will be (less unused tape). For most programs, the user need only specify the logical record length (measured in characters or bytes) and the block length (a multiple of the logical record length) and the computer system will automatically collect logical records into blocks and transmit the blocks to the tape. The user need not be concerned with how this process is accomplished.
The means used to inform the computer system of the logical record length and block length vary somewhat with the programming language. Some information on this is found below in Part II. The CMS "keywords" used to refer to this information are LRECL for logical record length and BLOCK for block size or length. Thus a file containing 80-character lines blocked with 15 lines per physical block would have LRECL 80 and BLOCK 1200. CMS limits the BLOCK and LRECL lengths to 64K or less.
The command language keyword used to specify what record format is desired is RECFM. Some of the possibilities for RECFM are F, FB, U, V, VB, VS, VBS.
F, FB, and U are the most common formats for tape files on our system.
F means fixed format with one logical record per physical block (LRECL = BLOCK). FB means fixed format with more than one logical record per block (BLOCK is a multiple of LRECL).
U stands for "undefined format" and is used for records that vary in length. For U format, the LRECL = BLOCK = the max. record length. (Note that tape format U is similar to disk file format V.)
Record formats V, VB, VS and VBS are seldom used for tape files. We describe them below for the sake of completeness.
V stands for varying format with one logical record per block, and with LRECL equal to the maximum record length plus 4. BLOCK must equal LRECL + 4. The extra 4s in the LRECL and BLOCK are to hold length information which the system needs to process the varying length records. VB is similar to V except that there are multiple logical records per block and BLOCK is a multiple of LRECL plus 4. (e.g. BLOCK = 408 where LRECL = 104 and the actual max. record has length less than or equal to 100).
VS and VBS are used for so-called "binary files" -- tape files written without conversion to EBCDIC. VS is similar to V and VBS to VB, except that the LRECL does not have to be a maximum. VS and VBS files can handle logical records that exceed the LRECL length.
For example:
RECFM F LRECL 80 BLOCK 80
RECFM FB LRECL 80 BLOCK 1600
RECFM U LRECL 100 BLOCK 100
RECFM V LRECL 304 BLOCK 308
RECFM VS LRECL 304 BLOCK 308
RECFM VB LRECL 304 BLOCK 1220
RECFM VBS LRECL 20004 BLOCK 20008
If a user brings a labeled tape from some other computer installation, the labels on the tape can be read as short files. Tape labels normally are terminated by standard tapemarks and can therefore be treated in the same way as data files. Alternatively, the user can request tape label processing via the FILEDEF command.
The advantage of unlabeled tapes is that tape handling is simplified. On the other hand, labels have the advantage that file information (such as file name, RECFM, LRECL and BLOCK) is automatically written to the tape along with the data.
The tape's owner (or renter) should choose one or two passwords for the tape. One password controls read-only access to the tape, the other controls read/write access. The passwords are written on a paper label on the outside of the tape reel. When anyone requests the tape, that person must supply the appropriate password. The computer center operators check the supplied password against the paper label on the tape reel, and if there is a mismatch, will not allow the tape to be used. Do not confuse the tape passwords with your CMS logon password.
All inquiries, rentals, and purchases of tapes should be directed to the UNET Tape Librarian at 581-3552 at the Orono offices.
To mount a tape, the user must request that a tape drive be assigned to him/her, then that the operator retrieve the tape from the tape racks and place the tape on the tape drive. Please recall that there are a limite number of tape drives available, so that it is possible that a request for a tape drive will be denied or delayed because all the drives are already in use.
In CMS you request that a tape be mounted by typing the MOUNT command.
MOUNT TAPE xxnnnn ON 181 RING cc PASS pword DEN mmmwhere "xxnnnn" is the tape reel id number assigned to the tape, "cc" is either "IN" or "OUT" (see below), "pword" is the appropriate password for the tape, and "mmm" is the recording density (800 or 1600). If the default density of 1600 is desired, DEN 1600 can be omitted.
RING IN means that the user can either read from or write to the tape. The password supplied must be the "read/write" password.
RING OUT means that the user can read data from the tape, but cannot alter the tape contents in any way. The password supplied must be the "read-only" password.
181 is the device number used for the tape drive by the virtual machine. If the user has already requested a tape using 181, and now wants a second tape drive (for example to copy one tape to another, necessitating two tape drives simultaneously), the second MOUNT request should use 182 as the device number:
MOUNT TAPE xxnnnn ON 182 etc.Having typed in the MOUNT request, the user should proceed to do other work until the operator responds. The operator will send a message to the user, either to tell him/her that no tape drives are available, or that the tape drive has been assigned to the user and that the requested tape is mounted. The user should not attempt to use the tape until the operator has said that the tape is actually mounted on the tape drive.
When the CMS user is finished with the tape, he/she should type in the command to rewind and "unload" the tape reel:
TAPE RUN (TAP1
If desired, another tape can then be requested - the same tape drive will
be used (issue another MOUNT request). If the user is finished with the
tape drive, type the following command after the TAPE RUN:
DETACH 181The DETACH command releases the tape drive so another user can have it. Logging off will DETACH the tape drive automatically.
TAPE and MOVEFILE are CMS commands that can be used in full CMS or CMSBATCH to read and write tape files. Each of these is discussed below. Each of the two has advantages and disadvantages.
MOVEFILE stores data on tape in "card image" form -- i.e., the data is stored exactly as it would appear if printed or displayed on a terminal screen. This format is especially desirable if the data is to be read by a program or the tape will be taken to some other computer center. MOVEFILE does not automatically store the name of the file along with the data on the tape. (However, using tape labels can get around this problem.)
The TAPE command is very simple and convenient to use. It is intended for "backup" tapes -- i.e., storage to supplement disk storage, or for second copies of files. Tapes written using the TAPE command generally cannot be used at other computer centers. The TAPE command stores the file name along with the data, so that files can be retrieved from tape by name.
To use MOVE, the user must first issue FILEDEF commands to designate the device and other characteristics of the source file, and the device etc. of the destination. The FILEDEF command is described in detail in the CMS Reference manual and in online HELP on CMS.
The following is a simple example of copying a disk file named "MYFILE DATA A" to a tape. We will assume that the disk file is stored on disk with all lines or logical records the same length - 80 characters. For efficiency, the logical records will be grouped or blocked on the tape with 20 records per block.
FILEDEF INMOVE DISK MYFILE DATA A (RECFM F LRECL 80 BLOCK 80 FILEDEF OUTMOVE TAP1 (RECFM FB LRECL 80 BLOCK 1600 MOVE
Note that the source, the disk file, is marked "INMOVE" and the destination, the tape, is marked "OUTMOVE". The order of the two FILEDEF's is immaterial. INMOVE and OUTMOVE are special names for the MOVEFILE command. The RECFM, LRECL and BLOCK for the source (INMOVE) file must match the way the file is actually stored. To find out how a disk file is stored, use FILELIST or LISTFILE.
MOVE leaves the source file unchanged. The file is copied onto the tape starting at the spot on the tape which is currently under the tape drive's read/write head. If the tape contained any information already in that location, that information is lost. At the end of the copying, MOVE writes a "tapemark" (q.v.) indicating the end of the file. In order to write on the tape, the MOUNT command line must have specified RING IN.
To copy a file from tape to disk, use the same set of commands as above, only reverse the roles of "INMOVE" and "OUTMOVE" - i.e., use INMOVE for the tape, and OUTMOVE for the disk.
If a file (on either tape or disk) has a record format other than F or FB, use RECFM U for the two FILEDEF commands.
The following is a list of the command options relating to tape positioning:
TAPE FSF n (TAPx TAPE FSR n (TAPx TAPE BSF n (TAPx TAPE BSR n (TAPx TAPE REW (TAPx TAPE RUN (TAPx
where "n" is an integer, and TAPx designates which tape is to be moved. If the user has only one tape currently mounted on a drive, that tape is called TAP1. If the user has two tapes simultaneously mounted, they are TAP1 and TAP2 (on drives 181 and 182, respectively), etc. FSF and BSF stand for "forward space file" and "backward space file". FSF n moves the tape forward until n tapemarks have been sensed by the tape drive -- in other words, it skips forward over n files. BSF n does the same in the backwards direction, leaving the tape positioned immediately before the nth tapemark found. FSR and BSR behave the same as FSF and BSF, except the forward or backward spacing is by physical records or blocks, rather than files. REW rewinds the tape back to the beginning of the first file. RUN rewinds and unloads the tape, readying it for dismounting.
For example, suppose a user wishes to use MOVE to copy the third file on a tape onto disk for use by some program. The following CMS commands can be used:
MOUNT TAPE xxnnnn ON TAP1 RING OUT PASS password TAPE FSF 2 FILEDEF INMOVE TAP1 (RECFM FB LRECL 80 BLOCK 32000 FILEDEF OUTMOVE DISK MYDATA DATA A (RECFM F LRECL 80 BLOCK 80 MOVE
Please note that the RECFM, LRECL and BLOCK parameters on the FILEDEF's must reflect the reality of how the data is written on the tape.
The CMS user must remember to rewind and unload his/her tape and DETACH 181 after finishing with the tape.
The following TAPE options relate to storage and retrieval of disk files onto tape:
TAPE DUMP fn ft fm (TAPx TAPE LOAD fn ft fm (TAPx TAPE SCAN fn ft (TAPx TAPE SKIP fn ft (TAPxIn each case "TAPx" is as described above. "fn ft fm" is the three part identifier of a disk file. "fn ft" refers to the identifier of a disk file presently stored on the tape ("fm" has no meaning when the file is on tape).
TAPE DUMP fn ft fm copies the disk file designated by "fn ft fm" onto the tape starting at the current position of the tape drive read/write head. The tape must have been mounted RING IN. Any or all of the three parts of the file identifier can be replaced by * (thus, * * A, or MYDATA * B). In this case, all files satisfying the non-asterisk parts of the identifier will be copied to the tape. The asterisk acts as a "wildcard" character and allows multiple files to be specified on a single command.
TAPE DUMP copies all the files in a special backup format, and includes the filename and filetype of each file along with the actual contents of the file. Thus TAPE DUMP preserves a record of which disk files have been stored on the tape. All disk files placed on the tape by a single TAPE DUMP command go into one actual tape file. TAPE DUMP writes two tapemarks after the files it has copied onto the tape. The TAPE command then backspaces the tape and leaves it positioned just before those two tapemarks. This means that a second TAPE DUMP command will copy its disk files into the same physical file on the tape. Please remember the distinction here between the disk files that have been copied to the tape, and the single tape file, defined by a terminating tapemark, created by the TAPE DUMP command to hold those disk files. There may be many disk files stored in one tape file.
The reverse of TAPE DUMP is TAPE LOAD.
TAPE LOAD fn ft fmwill search the tape starting at the current position for a file called "fn ft". If it finds a file of that name, the file will be copied to disk under the name "fn ft fm". Note that "fm" applies to the resultant disk file. The search on the tape will normally continue until the first tapemark is sensed. However, the option
(TAPx EOTwhere "TAPx" is described above and "EOT" stands for "end-of-tape", will continue the search until two consecutive tapemarks are sensed. Two consecutive tapemarks are regarded as meaning that no more data is stored on the tape. TAPE LOAD can only work with tapes written using TAPE DUMP. TAPE LOAD will accept asterisks for either fn or ft or both, thus allowing multiple loads from one command.
TAPE SCAN fn ft (TAPxwill position the tape to the beginning of the file "fn ft" on the tape. The tape must have been written using TAPE DUMP. If desired, an EOT can be added just as for TAPE LOAD. TAPE SCAN will list the names of all the files it finds, either on the printer or at the user's terminal:
TAPE SCAN (TAPx EOT TERM
The above command will list all TAPE DUMP files found on the tape from the current position until two consecutive tapemarks are read. The list appears on the terminal display. The tape is left positioned following the second tapemark.
TAPE SKIP fn ft (TAPxwill search the tape for a file "fn ft". It differs from TAPE SCAN by leaving the tape positioned after the "fn ft" file.
For complete descriptions of the TAPE command with all its variations, please consult the CMS command reference manual or the online HELP facility.
If the program is a package, then the user must follow the rules of the package when using the tape. For example, a particular package may require that the input data file have a certain name. The user must use that name on a FILEDEF command before running the package. Consult the documentation for the program for details of this sort.
Whether the program is "home-grown" or a package, the commonest way of specifying input and output files is via the FILEDEF command. Normally, this command is issued immediately before the program is run. The user would enter the FILEDEF command before actually running the program.
The following examples show how this is done:
Ex. 1: A job using SAS. The raw data are on a tape. The user types in the MOUNT command and the FILEDEF command as follows:
MOUNT TAPE USXXXX ON TAP1 RING OUT PASS MYTAPE FILEDEF MYDATA TAP1 (RECFM FB LRECL 100 BLOCK 900Then runs the following SAS file:
DATA RAW;
INFILE MYDATA;
INPUT VAR1 VAR2 VAR3;
PROC SORT DATA=RAW;
.
.
(more SAS statements)
Ex. 2: A simple FORTRAN program that writes data to a tape: The user mounts the tape and types in the FILEDEF command:
MOUNT TAPE TOXXXX ON TAP1 RING IN PASS ZZZZZ FILEDEF 9 TAP1 (RECFM FB LRECL 60 BLOCK 600 PERMThen the user runs the following FORTRAN program (which he/she has previously compiled - see the next chapter for information on this process):
REAL*8 DSEED
DIMENSION X(6)
C GENERATE 6000 RANDOM NUMBERS AND WRITE THEM TO TAPE
C USE A RANDOM NUMBER SUBROUTINE GGUBS.
C
DO 1 I=1,1000
CALL GGUBS(DSEED,6,X)
1 WRITE(9,99) X
99 FORMAT(6F10.7)
END
|
|
|
|
|
| Topic Index | Frequently Asked Questions | Document List | Return to User Services Home |