MVS TOOLS AND TRICKS OF THE TRADE April 1993 Sam Golob MVS Systems Programmer sbgolob@cbttape.org Sam Golob is a Senior Systems Programmer COPYING TAPES CORRECTLY. A WORD ON "BLINDNESS". There is one big goal in our side of the computer business, that is, not to "fly blind". Phrased more exactly, this means: "It is best not to perform an operation without being able to see exactly what you are doing." That's certainly true in medicine. But in systems programming, it's not always done. There are many operations that, unfortunately, we perform blind. A very typical example of this blindness is the case of checking a disk pack to see if IPLTEXT was loaded properly on it. If you loaded the IPLTEXT yourself, you usually trust the zero return code from the ICKDSF utility. If someone else loaded the IPLTEXT, and it was done some time ago, most of us don't make it a general practice to go to track zero of the pack and take a look ourselves. Most of us don't bother to dump track zero with AMASPZAP to see what's there. We just try to IPL the pack, and we scratch our heads only if it doesn't work. To me this is badness. It usually works out, but it has the shortcoming that you are leaving yourself open to possible error. Most people also don't bother to survey all of their packs to see what IPLTEXT, if any, is loaded on all of them. You might find that some of your packs might have standalone FDR or standalone DFDSS or standalone ICKDSF loaded on them, and you didn't know it. Maybe these standalone products are out of date, too. You'd never know that if you remained "blind" and didn't take a look. Today we're going to talk about techniques in copying and constructing tapes. Tapes are another area in which programmers are tempted to "fly blind". This doesn't have to be the case. To remedy that situation, I'll try to offer some suggestions on accomplishing tasks in the area of tape manipulation. Using the available tools we recommend, you'll soon be able to perform tape tasks with less effort and without "blindness". TAPE VIEWING, AND TAPE COPYING. We'll start our talk with some mention of bypassing label processing, otherwise known as "BLP privilege". If you are going to do what we would like to do, it sure helps to have BLP privilege! I'd bet that at least 97 percent of MVS systems programmers can get BLP privilege for themselves if they asked for it. After reading this article, if you're tactful, you'll probably be able to demonstrate that it's to the installation's advantage to grant BLP to you. I personally have had to ask for BLP privilege several times, and in each case, I've received it. If you can't get BLP privilege after having tried, I know of one set of tools you might be able to use. On File 171 of the CBT MVS Utilities Tape (distributed by NaSPA 414-423-2420 or by SPLA 305-284-6257) there is a TAPEMAP program and an MVS DITTO-type program that were contributed semi-anonymously. The person who contributed these programs does not have access to BLP privilege, and he got around that problem. You are free to look at his code and see what he did. Of course, you can certainly make direct use of those very good programs without knowing how he coded them. It's nice to know that even without BLP, a lot of tape investigation can be done. Back to the rest of us in BLP-land. We are going to talk about six relevant programs, all of which are on the above-mentioned CBT MVS Tape. They are: TAPESCAN (File 102), TAPECOPY (File 174), COPYFILE (File 316), TAPEMAP (versions on File 299 and File 181 for now), COPYMODS (File 229), and CT (File 316). Each of these programs serves a somewhat different purpose. It pays to know how to use all of them, and to understand their differences. I'll summarize their features. TAPESCAN dumps all tape labels in their entirety, and dumps in HEX, the first 100 bytes of the first nn blocks of each file. (nn defaults to 6 blocks.) TAPESCAN also can copy tapes, and it has parameters for skipping some leading tape marks or trailing tape marks. This makes TAPESCAN a good tool for copying DOS tapes or other tapes having a structure "unfriendly" to normal MVS tape handling. I used TAPESCAN as a debugging tool while I was making enhancements to TAPEMAP several years ago. TAPESCAN shows you the relevant "byte-content" of a tape at the beginning of each file. TAPECOPY from Aron Eisenpress of CUNY has more of an emphasis on copying tapes than on mapping them. TAPECOPY is similar to TAPESCAN in that it can skip tape marks. But TAPECOPY is programmed also, to know about various error conditions that might occur while reading an input tape. TAPECOPY has provisions to ignore or retry a number of different error conditions. TAPECOPY can do one additional thing which none of these other programs can do. It can create a standard labeled tape out of a non-labeled tape. TAPECOPY manufactures the tape labels from parameters which you supply in a parm field, and it sandwiches the output tape's data files in between these newly created labels. COPYFILE is designed to copy standard labeled (SL) tapes only. COPYFILE will copy (in one job step) selected files from an input tape, to successive files on an output tape. See Figure 1, which shows you some of the nice things that COPYFILE can do. I personally use COPYFILE often in my own work. Very recently, I enhanced the COPYFILE control cards to copy a range of successive files from the input tape, but not to the end of the tape. You can obtain that enhancement to COPYFILE if you get Version 339 of the CBT Tape or higher. TAPEMAP will not copy a tape, but will display its contents. TAPEMAP's displays are not on a byte level, as are TAPESCAN's displays. They are rather, detailed descriptions of the contents of all files. TAPEMAP has two reports. The first report is a summary of the block structure and size of each file on the tape, both from LABEL information and from SCAN information. The second report of TAPEMAP displays the detailed contents of each file, usually from a "member" point of view. TAPEMAP recognizes many common MVS tape formats. For example, if a tape file was created by IEBCOPY, TAPEMAP's second report will show all of the member names unloaded from the original pds. TAPEMAP will do similar revelations for IEBUPDTE format files, and will show PTF or APAR numbers for SMPPTFIN format files, such as PTF files on a PUT tape or CBPDO tape. TAPEMAP recognizes about ten file formats on a tape. TAPEMAP will display the detailed contents of nearly all of the compressed files on the CBT Tape itself. COPYMODS will copy an entire tape regardless of labels or not, from end to end, until the first double tapemark. In addition, COPYMODS has the ability to create up to ten exact output copies of one original input tape, if you have enough drives available. I use COPYMODS to duplicate all of my public domain tapes. COPYMODS is quick and automatic to use, and is almost foolproof, except for one situation (which COPYFILE can be used to remedy). That unlikely case occurs when an empty pds is backed up using IEBCOPY to a standard labeled (SL) tape. This creates a header label followed immediately by a trailer label, with no data file in-between. COPYMODS thinks that this is a double tape mark and erroneously stops at that point, even though there are more files on the input tape. Maybe one of you out there can fix COPYMODS to correctly handle this situation. Please send your fix back to the contribution address on the CBT Tape, so we can all benefit from your work. Finally, CT is a tape copying program that will recognize multi-volume input tapes or single volume input tapes. If the copying was done from a single volume to a single volume, CT has the additional option of verifying, byte for byte, if the copied tape was an accurate reproduction of the original. Thus, CT has some features that none of the other programs has. COPYING TAPES CORRECTLY. This collection of tools, as described above, gives you ample means of correctly copying one tape to another. Once you've done so, you can accurately check if the new tape contains exactly what you want it to have. You can do away with "flying blind" entirely. One major reason for my saying all of this, is my peeve with the common practice of using IEBGENER to copy tapes that have multiple files on them. IEBGENER copies only one file per job step. You might miss some, or all, of the later files on the input tape. If a tape has, say 50 files on it, using IEBGENER is extremely unwieldy. You would rather not code a 50-step job, when you can do it all in one step, using the tools mentioned above. If you want to closely monitor what's been happening, you can use the mapping properties of the programs mentioned above, especially TAPEMAP and TAPESCAN. Those programs take the guesswork completely out of discovering the contents of almost any tape. Especially using TAPESCAN, MVS DITTO, or the DITTO-like program from File 171 of the CBT Tape, you can "rescue" large parts of even badly damaged tapes, and can save the undamaged files from them. CONCLUSION. Tape work is a necessary part of our jobs. Tape work can be fun, and accurate, if you use the proper tools. Multi-file tapes and mildly damaged tapes do not have to be as much of a headache to copy as they formerly were. This collection of tools I've mentioned will go a long way, even in the most "impoverished" of MVS shops, toward improving the quality of your life as far as tape work is concerned. You will not "fly blind" any more. In any case, I wish you good luck in all aspects of maintaining your installations. See you next month. * * * * * * * * * * * * * * * * * * * * * * FIGURE 1. ILLUSTRATION OF THE COPYFILE PROGRAM. The COPYFILE program allows the copying of selected files from a standard labeled (SL) input tape to a standard labeled output tape. If some files already exist on the output tape, you can code control cards to preserve them, and you can write the new files immediately after the files you want to preserve. COPYFILE does an OPEN TYPE=J to both tapes, and will only listen to the instructions you tell it, not to expiration information from the tape itself, or from a tape management system. Therefore, COPYFILE is best used for your own personal tapes, or for special situations, not for normal production runs. Be aware that the ddname for the input file is called IN, but the ddname for the output file is called TAPELIN. Otherwise, the use of COPYFILE is very straightforward. COPYFILE Control Cards: 1. Copy files 3, 7, and 22 from the input tape to files 8, 9, and 10 of the output tape. 3/8 7 22 (copy 3 to 8, 7 to 9, 22 to 10.) 2. Copy files 3, 7, and 22 to 8, 9, and 10 as before, but copy files 23 and all the rest of the input files to the output tape. (23 to 11, 24 to 12, etc.) 3/8 7 22 ALL 3. Copy files 3, 7, and 22 to 8, 9, and 10 as before, and copy all the rest of the input files, but only through file 50. (This is a new feature. You need COPYFILE from CBT Tape Version 339 or later. In the older version, you had to code all the specific file numbers between 23 and 50. ) 3/8 7 22 -50 (new COPYFILE version ) or 3/8 7 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50