/* === TapeCopy 2.3 === Lars Appel, Aug 1996; Keven Miller 1998 TapeCOPY is a utility for copying certain types of tape or DDS media to disc archive files and vice versa. Direct tape-to-tape copying is also possible. TapeCOPY is similar to the well-known TELESUP Utility called STORCOPY but is freely distributable including source code. This file contains source code and documentation of TapeCOPY. 1. Introduction 2. User Guide 3. Tech Notes 4. Source Code 5. Change Log 6. ToDo Items This file was in fact a Pascal source file with all documentation put into comments, so you should be able to simply compile it on your HP 3000 to get the executable program file, assuming you have a Pascal compiler and do not yet have the TapeCOPY program file at hand. (It is now a C source file -- Keven Miller) Please note that this is NOT a supported HP product. You can freely distribute and copy it (it must be given away together with this file and free of charge) but you USE IT AT YOUR OWN RISK. You may send me eMail messages (or fax or snail mail or postcards or cakes or cookies) with feedback or questions but I cannot promise to be able to reply in a timely manner. Lars Appel, HP Germany, lappel@grc.hp.com (or lars_appel@hp.com) Keven Miller, eXegeSys, Inc., kevenm@exegesys.com, kpmiller@softhome.net ===== 1. Introduction ================================================ As stated above, TapeCOPY is a utility for copying tape or DDS media similar to the good old STORCOPY. I wrote it because I encountered problems while trying to use STORCOPY to package the NMSTORE tape of my HP 3000 Web Starter Kit (pardon the plug) into a disc file to be able to freely distribute it over the World Wide Web or FTP servers (instead of sending lots of DDS copies around the world). TapeCOPY does "raw" copies! It does not know about the structure of the tape or DDS media it processes. The only assumptions it makes are: - The TAPE or DDS contains a sequence of blocks and tape marks. - Blocks can vary in size between 0 and 16K bytes (16384 bytes). ( now 32760 bytes; version 2.0 ) - The tape contents are terminated by 3 successive tape marks. The above conditions seem to be met by media created by SYSDUMP, CM STORE, NM STORE (with or without software compression) and SYSGEN (SLT as well as SLT-plus-STORE). I have not yet tried media created on hardware compression drives but I suspect they will NOT work on a non-DC-capable drive. Media created with TurboSTORE;MAXTAPEBUF will NOT work because they usually are created with a larger block size than 16KB if the drive is capable of handling them. (It may work version 2.0 -- so long as all records are 32760 bytes or less -- NMSTORE directory records are 32768 bytes in length; Mpe/iX 5.0 ) Some typical examples for using TapeCOPY: - You can copy tape or DDS media directly (on a reel by reel basis, as TapeCOPY does not know about structure and continuation reels). - Copying reel tape to DDS might "under-utilize" the DDS capacity. Copying DDS to reel tape might fail due to smaller tape capacity. - You can copy a tape or DDS to a disk file and then create multiple duplicates on tape or DDS from the disk based "master". - You can copy multiple small tape or DDS media to a group of disk files and store those disk files to a larger DDS for archiving. - You can copy a tape or DDS to a disk file, transfer it to another system via FTP or DSCOPY (or World Wide Web) and re-create a copy of the tape or DDS on that remote system. Whatever you do with TapeCOPY, please keep in mind that it does NOT know about your tape or DDS media's structure and thus cannot check if the copy is okay. You should verify the copy with an appropriate tool (like VALIDATE or VSTORE or CHECKSLT) to be on the safe side! ===== 2. User Guide ================================================== To use TapeCOPY you setup two file equations and then run the program with the desired operation passed in the INFO string. You might also set a non-zero PARM value to control the detail of output messages. With version 2.1, you can now specify the filename after the operation bypassing the need for file equations. Default tape is IN;DEV=TAPE;rec=-32760 or OUT;DEV=TAPE;rec=-32760 Default file is IN or OUT;rec=128 Copying from tape to disk: :FILE IN;DEV=mytape :FILE OUT=myfile :TAPECOPY TAPE2DISK [,parm] TAPECOPY TD [,parm] TAPECOPY "TD filename [fcode]" [,parm] Copying from disk to tape: :FILE IN=myfile :FILE OUT;DEV=mytape :TAPECOPY DISK2TAPE [,parm] TAPECOPY DT [,parm] TAPECOPY "DT filename" [,parm] Copying from tape to tape: :FILE IN;DEV=mytape1 :FILE OUT;DEV=mytape2 :TAPECOPY TAPE2TAPE [,parm] TAPECOPY TT [,parm] or with a dsline :DSLINE MYDS= :REMOTE HELLO :FILE IN;DEV=MYDS#mytape1 :FILE OUT;DEV=mytape2 :TAPECOPY TAPE2TAPE [,parm] The optional PARM value controls the amount of messages displayed: parm = 0 results in a summary message (the default) parm = 1 results in progress messages at every tape mark parm = 2 results in progress messages at every block The optional FCODE value in TAPE2DISK allows the user to assign a filecode to the disk file. The user may also SETVAR TAPECOPYFCODE to the desired integer value. TAPECOPY HELP gives a short summary of the available options. ===== 3. Tech Notes ================================================== The disk archive file used is a plain fixed-binary file by default. It does not rely on user labels or special file code, so it might even be changed to bytestream via file equation or shell "tobyte" command. ( Version 2.3 The disk file is created with FCODE 5201 unless it is an NMSTORE tape, then it uses 2501 "STORE". The user may override this by using a file equation for OUT, setting var TAPECOPYFCODE to the desired integer, or providing the integer on the command line. Filecode is used for user quick recognition of files. TapeCopy does not rely on filecodes except for identifying, creating, and reading NM STORE tapes and files (code=2501 "STORE"). ) The simple binary file should be suitable for transfer via DSCOPY or FTP or Terminal Emulators or HTTP Web Servers. It also should survive compression and decompression. (Watch out for tape media created with TurboSTORE software compression... the resulting disk file might give better compression rates if the STORE media is uncompressed). The logical disk archive structure is a sequence of "units" (let me avoid the term "record" here as it might be confused with MPE File System records), each representing a tape block or tape mark. A "unit" contains a 4-byte length info followed by the respective number of data bytes plus padding bytes to reach a "unit" size which is a multiple of 4 bytes. (The "length" field only counts the data bytes, not the padding). Tape marks are encoded with "units" consisting of a -1 in the "length" field, followed by no data and no padding (already a 4-byte multiple). Three successive "tape mark units" define the end of the archive. At the beginning of the archive file there is a special "header unit" just before the tape data begins. This "header unit" has the usual "length field" followed by an identification string and padding bytes as neccessary. The first 16 characters of the identification string represent the archive file structure which is currently "A.01.00 TAPECOPY" and the remainder of the string is comment only. The TAPECOPY program uses this header as a very very basic consistency check. Future versions of TapeCOPY might use an enhanced archive file format and include some kind of consistency check information like checksums or running sequences numbers for "units" or "tape mark units". This will result in a new identification string, of course. The disk file is opened as (long) mapped file as I hope that this makes the program quite simple (and possibly also fast) as there is not need to re-block the tape data to "128W FB" records or have the file-system's bytestream emulation worry about such things. A final note on the source code below: This program is not intended as an "example of good programming style" or whatsoever. You might pick a few nice ideas from it but you might also encounter a few "quick & dirty" tricks... You might even get a kind of impression that I haven't found the time for programming for quite a while now... ;-) Cheers, Lars/iX ===== 4. Change Log ================================================== 12 Jun 1998 Keven Miller kevenm@exegesys.com Salt Lake City, Utah, US changed version in banner to X.01.02 (from X.01.01 ?) completed tape2tape option. added dsline example in user guide. 31 Oct 1998 Keven Miller Version 2.0 rewrite in C CCOPTS "-Aa -C +e -D_MPEXL_SOURCE" added MPE/iX 5.5 STORE format support; both create and read if TAPE is STORE/iX format, then STORE disk file created. only RESTORE on MPE/iX 5.5 and up will read disk files added Control-Y for quick exit Version 2.1 added filename parameter Version 2.3 added SLT recognition use FCODE=5201 if not a NMSTORE tape, else use 2501 "STORE" added FCODE override features: by file equate, command line, or var TAPECOPYFCODE ===== 5. ToDo Items ================================================== - help still has to be reworked (ongoing) (Lars Appel) */