Shifty Shifts

Perhaps you’re like me, and as a fledgling assembler programmer, you learned the Shift and Round Decimal instruction (SRP) from a handful of choice examples.  Something like this one,


If you were lucky, maybe someone showed you the 64-N trick for computing a right shift by N digits like this one,




After trying this out and getting it to work in a few programs, I committed the ideas to memory and didn’t give it much thought for a few years. At some point though, I figured out that that second parameter in these instructions is a base/displacement address, and not just a decimal number that somehow gets converted to 2’s complement. Looking up the explicit format for the instruction I found this,

         SRP    D1(L1,B1),D2(B2),I3   

The second parameter is a base/displacement, so the 3, or 64-3, or 61 we coded above, is treated as a displacement by the assembler and the base register is assumed to be 0. So, what’s going on with that address? The Principles of Operation solved the mystery for me. The base/displacement address is converted to an effective address, the effective address is then truncated to the rightmost 6 bits, and the remaining value is treated as a 2’s complement binary integer. With that value, we can shift 32 digits to the right or 31 digits to the left.

Never one to miss a trick (albeit rather slowly), it finally dawned on me, that if operand 2 is a base/displacement address, we could put the shift factor in a register and make the displacement 0 like this,

       L      R6,=F’-3’        SHIFT FACTOR GOES IN R3


Not much of an improvement, if any, but it does open the possibility of changing the shift factor on the fly by manipulating the register dynamically instead of hard-coding it into the instruction at assembly time – a technique you might occasionally find useful.

The same technique (but with a different interpretation of those 6 bits) works on all shift operations. For example, SRA, SRDA, SLL, …  The 6-bit shift factor for these shifts is treated as a plain binary number (instead of 2’s complement) because the direction of the shift is baked into the instruction. In all cases, you can put the shift factor in the register, and use it to control the shift factor on the fly – very shifty!

You can watch that happen in this short Viziblez demo video here.


Filed under IBM Mainframe Assembler

Re-write/ update of Chapters 1-4 of “The Book”

I’m in full assembler mode these days, preparing to teach an assembler class for Marist College that starts on Monday. It’s playing havoc with my golf game, but the upside is I’m getting a lot done. I’ve recently updated chapters 1-4 of the assembler book. That includes a complete re-write of Chapter 4, trying to provide explanations of addressing on IBM mainframes. I’m also adding a problem set to the end of each chapter, trying to make the book function better as a textbook.

I will always provide access to the individual chapters online, but my plan is to self-publish an ebook and a printed version that can be ordered. More about that later.

I want to thank everyone who has pointed out errors or suggested improvements in the text. I am listening and making the changes you suggested.


Filed under Fans of IBM z, IBM Mainframe Assembler

Nominate an IBM Champion/ IBM Community Festival

It has been fun to be part of the IBM Champions program this year – an honor! The IBM Champions program is taking currently taking nominations through November 30. Is there someone who helps you or answers your questions? Say thank you by nominating them to be an #IBMChampion. Tell their story to help them earn their star. You can even nominate yourself.

The IBM Community Festival is back soon – well worth a look. And it’s free. 5 days. 3 different geographies. IBM Community Festival 2021. Where all the experts will be:

Leave a comment

Filed under Fans of IBM z, IBM Enterprise Cobol, IBM Mainframe Assembler

Rewrite of Chapter 10 – DSECTs and more

I have just finished an extensive rewrite of book chapter 10. I’ve added much more material on USING and DROP. Besides an introduction to DSECTs, You’ll find a discussion of ordinary, labeled, dependent, and labeled dependent USING statements. There is an explanation of what the assembler is doing in pass one, and how the USING table is processed in pass two as you issue USING and DROP directives. I’ll probably come back and add some programming exercises, but for the moment, I’m done.

Many thanks to Ajith Thankappan for his helpful suggestions. You can find that chapter here and on the website.

Leave a comment

Filed under IBM Mainframe Assembler


Just a reminder that today is IBM Z day. The conference is free and going on now. Check out what is available here.

Leave a comment

Filed under IBM Mainframe Assembler

Update to Chapter 4

Writing a book takes years – at least it does for me. Writing a book about a computer that is still evolving is difficult. The evolution of IBM System/z machines over the last twenty years is amazing. The things I wrote years ago are often dated now – mostly correct, but dated – newer instructions, newer techniques have come along. I’ll keep working at this – editing chapters and changing the content. Today I reposted Chapter 4. Kudos to Les Kelley for some good suggestions that got me thinking.


Filed under IBM Mainframe Assembler

A New Assembler Book: Mine

I’ve been working on a new assembler book for a while – writing new material and organizing the old material I’ve written into a coherent whole. I think there is a need for a book aimed at beginning assembler programmers, and this is my best attempt. I love John Erhman’s assembler text, Assembler Language Programming for IBM z System Servers –  Version 2.00. It’s hard to beat John’s book for the wealth of material it contains. But I would characterize that book as a reference book, rather than a textbook. What I’m aiming for is a text that an instructor could use for a class, or a book that an interested reader could use on their own to learn IBM assembly language. So the book introduces topics in an order I found helpful for teaching beginners. I hope that together these two books will help you master this language.

Here is where you come in: I could use your help. I’m publishing each of the completed chapters on the website for you to use. If you find errors or have suggestions for making it better, let me know. You see, I’m not punctilious. I try to be – it’s a goal – but I’m not, and I need your help finding errors. At some point, I’ll put all the chapters together into a physical book and make it available to you. In the meantime, help me make this better now.


Filed under IBM Mainframe Assembler

Study assembler with me in the fall

I’ll be teaching a beginning assembler class online again this fall through the Marist College IDCP as part of a two-course sequence. Together, we will write a series of assembler programs that lead to the mastery of skills needed to write assembler programs professionally. Each year, I add new materials and lectures to the course. Class sizes are manageably small, and I’ll communicate with you through on-line office hours and by email. Access to an IBM mainframe is provided as part of the course. Successful completion of these courses leads to IBM Digital certification. You can read more about the IDCP program here. Enrollment is going on now. Contact Roberta Diggins for more information (email: or phone: 845-575-3601).

The IDCP offers courses in four areas: 1) Z/OS Programming and Applications, 2) Data Center, 3) Cybersecurity, and 4) Emerging Technologies, including an Introduction to Quantum Computing Algorithms and Programming.

I hope to see you in the fall.

Leave a comment

Filed under IBM Mainframe Assembler

IBM Z Day – September 15, 2021

IBM Z Day 2021 is a free, 1-day virtual conference for students and professionals. I think you will find it well worth your time!

This year, IBM Z Day features 4 tracks concurrently on September 15th, and a 24-Hour Global Student Meetup starting September 14th, with 30 hours of live content.

Conference Tracks include,

  • IBM Z
  • App Modernization
  • Open Z
  • Voice of Z
  • Student Z

Register here:

Leave a comment

Filed under Fans of IBM z, IBM Mainframe Assembler

Print Your Own z15

Elizabeth Joseph, Camillo Sassano, and the IBM Industrial Design Program provided an STL file for the z15 you see above. My son, Bret, printed this one.

Check out Fans of IBM z and consider joining.

Leave a comment

Filed under Fans of IBM z, IBM Mainframe Assembler