MVS TOOLS AND TRICKS OF THE TRADE NOVEMBER 1999 Sam Golob MVS Systems Programmer P.O. Box 906 Tallman, New York 10982 Sam Golob is a Senior Systems Programmer. He also participates in library tours and book signings with his wife, author Courtney Taylor. Sam can be contacted at sbgolob@cbttape.org. Information about the CBT MVS Tapes can be found on the web, at http://www.cbttape.org. LEARNING OUR TRADE Mainframes aren't going away. In particular, MVS aka OS/390, IBM's largest operating system, is very much here to stay. A few years ago, during the "client-server craze", there were rampant rumors that MVS was "a dead dinosaur", and a new phrase got coined: "management by magazine". That was the result of very-high-level managers getting caught believing the falsehood, touted in magazine articles, that a large network of pc-based machines could "always" outperform a standard mainframe. The subsequent results have proven them wrong. IBM responded too. To keep MVS marketable in the current business setting, IBM added UNIX to MVS and added parallel processing for scalability. The result was a success for MVS. And so, MVS is here to stay. If that's the case, where are the MVS practitioners--the "MVS system doctors" coming from nowadays? The schools don't seem to be producing them (except for Northern Illinois University and very few others). The old-timers are still working, although some of them have retired. Of necessity, companies are promoting operators as they did before, and many of them have become very good systems programmers. But where is the "formal MVS education" coming from? To all appearances, it's coming from nowhere. I don't mean to refer to the "education vendors", who are doing a good job. I've taken a number of one-week courses myself, to my great benefit. Courses are very fine, but they're only a few days long, and they're usually only on one particular topic. Where is the apprenticeship under a master? Or short of that, where can a systems programmer build his or her skills on a regular basis, over an extended period of time? Of course there's "on the job training", which is our mainstay. But "OJT" is spotty, depending on what job the installation needs done at the moment. That's what you learn at OJT. Is there an organized course somewhere? One that lasts at least five or six months? There used to be. At one point in time, there was a thriving school for practicing systems programmers: the NYU Information Technology Institute. At this extension of New York University, some expert systems programmers taught many aspects of the trade. One of those highly regarded teachers is Carmine Cannatello, whose Advanced Assembly Language course eventually led to his writing a book. I have an opinion about this. I think Carmine's book, "Advanced Assembler Language and MVS Interfaces", now in its long-awaited Second Edition, is the most relevant single organized source of MVS-related assembler knowledge that's publicly accessible, in existence. Come and Learn Assembler. Let's start by mentioning the fact that even though one can be an MVS systems programmer without knowing much assembler, it's admittedly an enormous handicap. Almost all of the IBM system routines are written in assembler language. (I consider PL/S, PL/AS, or PL/X to actually be assembler language, from the MVS support point of view, because the result of a PL/* compile is really assembler code.) If you have to diagnose a problem in IBM code, you can't understand what's really going on, if you don't know the machine instructions. In addition, if you don't know assembler, the idea of coding your own system-level utility is almost an impossible dream. A knowledge of REXX helps, but it's no real substitute. If you're not (at least moderately) skilled in assembler language coding, it's time to get with it! I'd suggest, after having taken an introductory one-week assembler course or its equivalent, that everyone read and refer back to Carmine Cannatello's new book. The information found there, would take much longer to acquire if you had to go elsewhere. Carmine's book is extremely well organized, and it provides a world of deep information, presented simply. The book starts by taking pains to get you into good coding habits, and it then systematically takes you through a tour of just about all the elements which comprise system level assembler coding. I'd say that if a junior level systems programmer invests six months or so, going through Carmine's book thoroughly, he or she will no longer be at a junior level, in any sense of the word. Please refer to Figure 1, which lists a chapter outline of Carmine's "Advanced Assembler" book. From a glance, it'll be clear that the book covers a wealth of MVS system services, and how to use them in assembler programs. The great majority of seasoned systems programmers don't know ALL of these techniques, so the book provides good reference material, even for very advanced MVS practitioners. Before covering the contents of Carmine's book in more detail, I feel I also have to mention another enormous source of assembler knowledge, which will greatly strengthen what you learn from reading this book. That source is the CBT MVS Utilities Tape, and the CBT Overflow Tape, which are now online on the web. (Just go to www.naspa.net and click on "Online CBT Tape".) These tapes comprise an enormous free collection of MVS utilities, most of which come with source code that you can study. Most of the code on the CBT Tapes is working code (at least, it worked somewhere), and you can usually demonstrate the results, while you study the code which produces them. Dave Alcock, who contributes a very large file (File 311, over 50000 lines of code) to the CBT Tape, told me that he learned most of his assembler coding from looking at examples in the CBT Tape. That's quite an effective testimonial. The CBT Tapes, started in 1975 by Arnold Casinghino, and now up to Version 421, are updated continually, quite a few times a year. If you want to contribute to the CBT Tape collection, please contact me by email. Some Details from the Book. Please refer to Figure 1, which is a chapter summary of Carmine's book. From the first glance, you'll notice the enormous breadth of the topics covered. I can say from my own experience, that the techniques this book deals with, are extremely relevant to the understanding of the workings of MVS system routines and MVS system tools, both user- and vendor-developed. If you know these techniques, you're in a far better position to understand and maintain the MVS operating system. Chapter 1 contains eighteen rules for good assembler coding. In the old days--the 60s and early 70s, when a system programmer had to literally write extensions to the operating system, there was a lot of code written which violated these rules. Many systems have crashed, after someone else later would try to understand and modify such unclear code. Carmine starts you off by showing you never to write assembler code in unclear ways which are difficult to modify. Such ideas as branching to labels instead of to displacements, not altering instructions, writing meaningful DS statements, writing meaningful and descriptive comments, using simple instructions and easy-to-follow logic, and so forth, sound like "nice things to emphasize". But anyone familiar with very old code, can tell you the terrible things which can happen if these rules are not followed. Carmine is doing the world an enormous service with his first chapter. This material should be well absorbed, and not taken lightly. Chapter 2 talks about how to set up your programs, so they're easy to follow, modify, and debug. It pays to write your code in small segments, so that if something is wrong, you can more easily pinpoint which segment is causing the problem. A small straight piece of code is easier to fix than a big, spaghetti-like, tangled, branching piece of code that's many pages long. A description of some testing and diagnostic techniques finishes this chapter. Chapter 3 is about writing macros. As you know, macros are pseudo-instructions which expand into chunks of assembler code at assembly time. Not everybody writes their own macros, but it's essential that every decent assembler programmer know how a macro works. A necessary part of the workings of a macro, is the conditional assembler language, which will assemble some code, and skip assembling other code, depending on conditions at assembly time. Conditional assembly enormously increases the effectiveness of the general-purpose assembler macros that can be written. From Chapter 4 until the end of the book, Carmine systematically and clearly explains one advanced technique after another. In my experience, a lot of existing system code can be understood clearly, if you've covered all of these techniques. But there's one additional advantage--you'll learn to write the stuff yourself! I've constantly amazed myself, in my own career, by writing system code, and discovering that it actually worked! With the authoritative, clear and simple explanations which Carmine gives, you'll experience that same joy, and you'll feel that same "high", over and over again. Besides, you'll actually help your installation a lot by writing effective system tools and by fixing tough system problems. In the book's new Second Edition, a chapter on ESA coding has been added, and you can learn about basic AR-mode techniques. ESA and OS/390 systems have many components which use the extended addressing facilities. You need to know how these are coded, in order to solve system problems, as well as to understand how those components work. In summary, I'd say that it's impossible to be called a senior-level MVS systems programmer in any sense, without at least a moderate level of skill as an assembler language programmer. Just about every one of us sometimes has to write an exit, or fix an exit, or look at a system problem and figure out what instructions are causing it. Carmine Cannatello's marvelous book, "Advanced Assembler Language and MVS Interfaces", can take all of us to a far higher level of MVS system understanding, as well as to a high level in actual assembler coding skill. Good luck to all of you. I'm looking forward to seeing you again next month. * * * * * * * * * * * * * * * * * * * * * * * Figure 1. Chapter Summary of "Advanced Assembler Language and MVS Interfaces" (comments in parentheses are mine) Chapter 1: Assembler Language Programming Style and Content (i.e. developing "good programming habits" from the start) Chapter 2: Assembler Language Programming Development and Structure (easy to follow program control and commenting, plus much more basic technique) Chapter 3: The Macro Facility and Conditional Assembler Language (how to understand and write macros) Chapter 4: Supervisor Services and Macro Instructions (real goodies--EXTRACT, LOAD, LINK, XCTL, TIME, STIMER, GETMAIN-FREEMAIN etc etc.) Chapter 5: Advanced Assembler Language Techniques (essential things you gotta know, plus nice touches) Chapter 6: Programming ABEND recovery (SPIE, ESPIE, ESTAE, etc.) Chapter 7: Programming Dataset Allocation (RDJFCB and OPEN TYPE=J. SVC 99 programming.) Chapter 8: Processing a Partitioned Dataset (BPAM, QSAM, BSAM...) Chapter 9: Programming Paging Efficiency (rare knowledge) Chapter 10: Selected Advanced Supervisor Services Macros (APF authorization, MODESET, TESTAUTH, RESERVE, SETLOCK, SVCUPDTE, SYSEVENT, etc.) Chapter 11: Introduction to Channel Programming (EXCP--wow!) Chapter 12: Writing SVC Routines (and dynamically loading them) Chapter 13: Using the MVS Common Area (you gotta know about this) Chapter 14: Programming Using 31-bit Addressing Chapter 15: Inter-Address Space Communications (SRB, Cross Memory Services - the old ways) Chapter 16: Extended Addressability (the new ways... AR mode, Data Spaces, Hiperspaces, etc.) Appendix A: The Assembler Appendix B: The Linkage Editor * * * * * * * * * * * * * * * * * * * * * * * Figure 2. Where to Get This Book Title: Advanced Assembler Language and MVS Interfaces Second Edition Author: Carmine A. Cannatello Publisher: John Wiley & Sons Inc. Professional, Reference and Trade Group 650 Third Avenue New York, NY 10158-0012 (800) 225-5945 x2497 ISBN: 0-471-36176-3