MVS TOOLS AND TRICKS OF THE TRADE August 1992 Sam Golob MVS Systems Programmer sbgolob@cbttape.org SOME ASSEMBLER THOUGHTS - THE NEW HIGH LEVEL ASSEMBLER - PART II. This month, I'd like to continue talking about IBM's new "High Level Assembler", product number 5696-234. This new assembler, which is designed to replace Assembler H Version 2 and the DOS/VSE Assembler, has largely arisen from user protests and prodding of IBM, mainly through SHARE and the other IBM user groups. Most of that fuss was raised because of the existence of the magnificent "SLAC modifications" to Assembler H, a package of about 50 enhancements written by Gregory J. Mushial. These mods made the reading of assembly listings and the debugging of assembler code far easier. People wanted to know why IBM wouldn't incorporate the SLAC mods into their own product and bring their benefits to everybody. Well now they have. In this month's column, I'd like to summarize more of the new assembler's features, so you can see the clear advantages to all assembler programmers now available in this new assembler product. As an aside, I must also state unequivocally that IBM's "OCO" policy would have made the development of the SLAC mods impossible, had it been in effect ten years earlier. Greg Mushial could only have written the SLAC mods from the source code to Assembler H. It is probable that IBM would still be sleeping on the issue of Assembler enhancements, had source code not been available for skilled users like Greg Mushial to "play with". It is unfortunate that the new High Level Assembler, or HLASM for short, is distributed as "Object Code Only". This stifles further change. You users out there.... Keep protesting to IBM to lessen its OCO policy! HLASM EXTENSIONS. LET'S START. There's too much that's new in HLASM to mention in this small space. We'll try to list the various kinds of extension to the assembler's features. We systems programmers will find that coding and fixing code is going to be a lot more exciting soon. HLASM will give us lots more help than we've been used to getting. John Ehrman, in IBM's HLASM Presentation Guide for speakers, mentions the following nine categories of assembler improvement in HLASM. These are: development support functions, tool and environment support, new and extended language, new system variable symbols, usability-accuracy-readability, documentation enhancements, interfaces to languages and systems, new and extended options, other enhancements. We'll try to briefly summarize what's involved in some of these areas, as the space permits. Development support functions are many. The idea is to show the programmer more ways of seeing if the program is correct. Internally, the assembler "knows" about these facts. Previously, it just didn't tell us. Now, we can make the assembler talk. Most of the features in this category came from the SLAC mods. That just goes to indicate how good the SLAC mods are (and why we pressured IBM so much). In this category: There is the Macro and Copy Code Source Catalog, which tells you the dataset and volume that every macro and copy member came from. Previously, there was no simple way to know which macros were called during an assembly. Now we know what their names are, and which libraries they came from. There's a DSECT cross reference showing every DSECT definition, its relocation id and its total length. The DSECT cross reference helps us track the intermix of CSECT code and DSECT code in an assembly listing. Another feature is a modification to the symbol cross reference. The symbol cross reference now flags which line numbers are branch targets, and which labels have been directly modified by the code. We can thus follow the program flow better. For better tracking of addressability, there is a complete USING Map, which gives the history, length, and placement of all USING and DROP statements. We'll talk more about addressability help later. The RSECT statement, to control re-entrancy checking on a CSECT by CSECT basis, has been documented and cleaned up. With the new PCONTROL option, you can now override PRINT NOGEN and other print suppression code statements without changing the source code. Now, you'll be able to see all the macro expansions with a minimum of effort if you want them. End-of-assembly summary has been enhanced to show you a lot of information about performance and the system on which the assembly ran. Finally, the old LIBMAC option has been reinstated. LIBMAC prints the actual macro source code at the first point of each macro's expansion in the listing. Sometimes in debugging, you'd like to have that information handy. The idea behind "tool and environment support" is be to able to interface the assembler with other tools. With HLASM, there are lots of new ways for other programs to get to the assembler's data. HLASM's principal interface tool is the optional SYSADATA data file. This file contains many types of records concerning the assembly. We mentioned their particulars last month. The idea of SYSADATA is similar to SMF. The SMF dataset contains various types of records, which are raw data pertaining to many aspects of operating system and program execution. Similarly, the SYSADATA file retains many types of raw data from an assembly run, in the form of records of different types. These records may be input to post-processing programs of the user's design, just like SMF records are. With the SYSADATA file as the assembler's "official" external interface, assembly listing "scanner programs" shouldn't be needed anymore. Other new interface tools are the exit points. Each ddname connected with an assembly can now be controlled by a user exit. IBM has provided a new EXITCTL assembler option to be a central control point for user exits to ddnames. You can optionally regulate all I/O flow to and from the assembler. Thus, you can now control the assembler in ways that were impossible before. The assembler, instead of doing only what "it wants", can now do much more of what "you want". Last but not least in the "tools interface" category is the new ASA option. The ASA option causes the assembler to print its listings using ASA print control characters instead of "machine" print control characters. For example, such control would be useful for integrating assembler listings with report distribution packages that expect ASA print control. EXTENDED LANGUAGE AND NEW SYSTEM VARIABLE SYMBOLS. In this category, I'm leaving the best for last. But we'll also get a lot of help from what's first. HLASM supports some nice cosmetic changes to the assembler that should have happened years ago. You can now put blank lines into assembly source, and they get treated as "SPACE 1" the way they should be. Lower and mixed case input is now possible under option control. There seems to be more to this than meets the eye. When you get a working copy of HLASM for yourself, look into the issue of mixed case assembler input in more detail. We'll mention some more "little things". There are lots of extensions to the use of literals now. Literals can now be used as relocatable terms in expressions. There is a lot of relaxation in SETA, SETB, and SETC. SETA, SETB, and SETC will now take previously EQUated values as operands, and there's much more extension in that area. A general tendency in HLASM (taken from the SLAC mods) is that a lot of things which had only been permissible in macro coding, can now also be done in open code. References to T', L', S', and I' are allowed in ordinary symbols, SETC symbols, and literals. All may appear in conditional assembly statements, both in macros and in open code. Another improvement is that the SYSPARM operand can now be 255 characters in length instead of being limited to eight characters. There are lots more of these "little language extensions", and they can all help us in some way. There are many new system variable symbols to help the programmer control what can be placed in the object code of a program. In order to fit this discussion into its allotted space, I've listed many of those in Figure 1, and we won't mention them here. "USING" EXTENSIONS AND HELP WITH ADDRESSABILITY CONCERNS. In the category of assembly language extensions, I've left the "biggie" for last. The enhanced control to USING and DROP that was featured in the SLAC mods, was the highest priority assembler requirement presented to IBM by the SHARE Assembler committee. Any experienced assembler programmer knows the frustration inherent in "addressability problems". The help offered in that area by the SLAC mods, and now by HLASM, is legendary. Let's mention two new addressability diagnostic tools that are now provided. First, there is a global "USING Map" that can be produced in an assembly listing. This USING Map details all the USING, DROP, "PUSH USING" and "POP USING" statements in the whole program. The USING Map is produced under control of the "USING" assembler options. Second: on each page of the program listing, all current active USINGs are printed below the page header. You don't have to search for active USINGs any more. They're at the top of every page. This feature is under control of the PRINT(UHEAD) assembler option. In addition to these two listing tools, new error messages have been introduced to flag programmer errors having to do with USING statements. You now have a far better chance of catching obscure program bugs having to do with the active addressing registers. All those new tools help us with addressability diagnosis, but they are not language extensions. The constructs of "Labeled USINGs" and "Dependent USINGs" provide new assembler language relief for problems of addressability. Labeled USINGs and Dependent USINGs can also help greatly to reduce the number of registers being tied up for addressing purposes. What are Labeled USINGs? Superficially, these are USING instructions that have an expression in the name field, but otherwise they look like ordinary USINGs. See Figure 2 for a quick look at the new USING types. Labeled USINGs are independent of ordinary USINGs and can coexist with them, even though they both employ the same base register(s). When an ordinary USING is DROPped, a coexisting Labeled USING remains in force. One idea behind Labeled USINGs is that the same data area can be addressed by different registers at the same time. A reference to a symbol in the USING range is then "qualified" to associate the symbol with the appropriate label. See Figure 2 for an example of this new stuff. Dependent USINGs allow the second operand of a USING statement to be a relocatable expression instead of a register. As long as the expression is resolved by a prior ordinary USING, the dependent USING is resolved too. Dependent USINGs help you very much when you have a long string of different data areas that are all within one base USING range. You don't have to tie up any additional registers to map all the areas. These two constructs can be used together, and you can have Labeled Dependent USINGs. The DROP instruction has been enhanced correspondingly, to undo all of the addressing relationships created by the new USING structures. When you get your copy of HLASM, you'll see that this is neat stuff, and it will greatly assist in your programming efforts. CONCLUSION. IBM sometimes will actually act when prodded enough. HLASM is a good product. You should go out and get it, or at least know about its existence. I believe HLASM is only an upgrade charge from Assembler H Version 2, even though it has a new product number. Good luck in all your work. See you next month. * * * * * * * * * * * * * * * * * * * * * * * Figure 1. NEW SYSTEM VARIABLE SYMBOLS IN HLASM. The High Level Assembler has been enhanced to include many more system variable symbols. Some of these are listed below. &SYSASM - The name of the assembler &SYSDATC - Current date with century included &SYSIN_DSN - Input dataset name &SYSIN_MEMBER - Input member name &SYSIN_VOLUME - Input volume serial &SYSJOB - Assembly job name &SYSSTEP - Assembly job step name &SYSLIB_DSN - Name of library dsn for this macro or copy member &SYSLIB_MEMBER - Member name for this macro or copy member &SYSLIB_VOLUME - Volume serial for this macro or copy member &SYSNEST - Nesting level of invocation for current macro &SYSOPT_DBCS - Setting of the DBCS option &SYSOPT_OPTABLE - Name of current opcode table used for this run &SYSOPT_RENT - Setting of the RENT option &SYSSEQF - Contents of the sequence field in this statement &SYSSTMT - The number of the next statement to be processed &SYSSTYP - Type of the current control section &SYSTEM_ID - Identification of the operating system &SYSVER - Assembler's release, version and mod level * * * * * * * * * * * * * * * * * * * * * * * Figure 2. CODING EXAMPLES USING LABELED AND DEPENDENT USINGS. Example of Labeled USINGs. PRIOR USING IHADCB,R10 First DCB NEXT USING IHADCB,R2 Second DCB MVC PRIOR.DCBLRECL,NEXT.DCBLRECL Move LRECL over DROP PRIOR DROP NEXT Example of Dependent USING (unlabeled). EXAMPLE CSECT USING EXAMPLE,R10,R11 Ordinary USING . . USING IHADCB,DCBUT2 Unlabeled Dependent USING LH R2,DCBBLKSI Uses R10 or R11 for base . . DCBUT2 DCB DDNAME=SYSUT2,... Example of two Labeled Dependent USINGs. EXAMPLE CSECT USING EXAMPLE,R10,R11 Ordinary USING . . DCB1 USING IHADCB,DCBUT1 Labeled Dependent USING DCB2 USING IHADCB,DCBUT2 Labeled Dependent USING MVC DCB2.DCBBLKSI,DCB1.DCBBLKSI Uses R10 or R11 for base . . DCBUT1 DCB DDNAME=SYSUT1,... DCBUT2 DCB DDNAME=SYSUT2,...