My Favorite IBM Mainframe Conference

The time for my favorite IBM mainframe conference is fast approaching – June 11-13, 2023. It’s the Marist College ECC Conference in Poughkeepsie, NY. Treat yourself to some fun and learn a lot about IBM mainframes as you are doing it. There is even an opportunity to give a presentation. Best of all, it’s free!

Here is the link with all the details. I’m planning to attend. Hope to see you there.

2 Comments

Filed under IBM Mainframe Assembler

Marist ECC Conference

Follow the link below for the details of my favorite IBM mainframe conference. Great speakers, wonderful food, beautiful location in the Hudson Valley. Best of all – it’s free!

Marist ECC Conference

Leave a comment

Filed under IBM Mainframe Assembler

Instruction of the Moment: Load On Condition (LOC)

Learn or review instruction LOC today with some new notes that cover the basics, and a VisibleZ video that demonstrates the instruction in action. The notes include a list of suffixes that can be added to LOC to make coding the instruction easier. You can also find the new instructional materials on the IBM Mainframe Assembler tab.

Leave a comment

Filed under IBM Mainframe Assembler

Adding Binary Fields Without a Register

John Dravnieks kindly suggested adding ASI and AGSI to VisibleZ. David Staudacher suggested using LARL to load a base register in a few VisibleZ programs. Thanks to both of you for the great suggestions. You can watch ASI in action with LARL in the following video (and in the last table on the IBM Mainframe Assembler tab). The video illustrates adding a binary immediate constant to a binary fullword without using a register. AGSI, a sister instruction, works in a similar fashion on doubleword and can be viewed here and on the IBM Mainframe Assembler tab. I haven’t released the latest VisibleZ code which contains these instructions. I’m working on that.

Leave a comment

Filed under IBM Mainframe Assembler

Adding Away (AFI, AG, AGF)

I’m adding more short instruction videos that can be found on the IBM Mainframe Assembler tab (last table). Each video addresses a particular Add instruction using VisibleZ as a teaching tool. You don’t have to have VisibleZ installed to benefit from the videos. Today’s new videos are Add Fullword Immediate, Add Grande, and Add Grande Fullword. Review an instruction you already know, or learn a new one. Stay tuned, more videos are on the way!

2 Comments

Filed under IBM Mainframe Assembler

IBM Champion for Z

I was honored to be renewed in 2023 as an IBM Champion for Z. It is an honor I take seriously, and I hope to produce new posts, articles, and teaching videos all year long.

8 Comments

Filed under IBM Mainframe Assembler

Staudacher Comment Posted

David Staudacher added a great comment about the “standard” entry code I posted. His assembly listing was mangled by the WordPress comment handler. I’m including an image of what he had in mind here.
<

2 Comments

Filed under IBM Mainframe Assembler

Standard Entry and Exit Video

How do we get in and out of a program? I call it my standard entry and exit code, but in fact, there are multiple ways of getting the job done while following IBM’s linkage conventions. Here’s a video explanation of the way I do it, line-by-line, with visuals. It’s also #24 on the IBM Mainframe Assembler page.

6 Comments

Filed under IBM Mainframe Assembler

Available Now: The Big Blue Assembler Book

My new assembler book is available in paperback now on Amazon. A hardback version will appear shortly. This is an introductory text. After chapters covering the z Series architecture, the book is organized into topics that are covered in an order that I worked out over 40 years of teaching assembler to students and professional programmers.

Here are some of the chapter topics:

  • Character Data
  • Zoned Decimal and Packed Decimal
  • Binary Data
  • DSECTs
  • Locate and Move Mode I/O
  • Subprograms
  • Bit processing
  • Exotic Instructions

Book Features:

  • Each of the 12 Chapters begins with a newly written introduction to a topic followed by a list of the instructions that are required to master it. Each chapter ends with detailed discussions of each instruction and one or more programming assignments.
  • The book has 5 Appendices
  • I’ve added 18 programming assignments designed to turn you into an assembler programmer. Each programming assignment is limited in scope but targets the fundamental skills you need to become an accomplished assembler programmer.
  • The book has 393 Pages.

I’ve always given away my teaching materials on this site. I’ll continue to do that because it makes me happy to know that someone out there finds the information helpful. Much of the information in the book is available on the website, including the preliminary chapters of the book. What’s available in the book that you might not find on the site is an organization of topics that makes the material accessible, some newly written introductions to various topics, and a collection of programming assignments that lead to programming mastery. You will also have a book you can hold.

I love books. I still have a copy of Programming Assembler Language by Peter Abel – the book I sweated my way through (on my own) some 40 years ago when I was trying to learn assembly language. I hope you will buy this new book and enjoy using it.

11 Comments

Filed under IBM Mainframe Assembler

Coming Soon from PunctiliousProgrammer.com !

5 Comments

Filed under IBM Mainframe Assembler

What’s the Difference Between LCR and LNR?

My only assembler joke is this, 

Newbie:  What’s the difference between L and LA?

Old Hand:  About a week of debugging.

I earned the right to use that joke (over and over by the way) because it happened to me. Ever since then, I pay special attention whenever I code L or LA. The same might be said of Load Complement Register (LCR) and Load Negative Register (LNR).

If we code LCR, what are we expecting? In this context, “complement” really means “additive complement”. We say that X is the additive complement of Y if X + Y = 0. We also note that if X is the complement of Y, Y is also the complement of X. So, the complement of 7 is -7, the complement of -3 is 3, and the complement of 0 is 0.

There is one complicating factor concerning any two’s complement representation we choose: There is always one more negative integer than there are positive integers. For example, in 3-bit two’s complement, the range of numbers is -4, -3, -2, -1, 0, 1, 2, 3.  There are four negative integers but only three positive integers because zero has a positive sign. If we ask for the complement of -4, the answer is 4 which can’t be represented with three bits. An overflow will occur. There are two integers which remain the same when complemented:  the maximum negative integer and 0. If we complement the maximum negative integer, it remains unchanged and an overflow is signaled. In fact, this is the only way to get an overflow with LCR. 

Here are the condition codes you can get with LCR.

Code          Meaning

0 Result zero, no overflow

1 Result less than zero, no overflow

2 Result greater than zero, no overflow

3 Overflow

What about Load Negative Register (LNR) and for that matter, Load Positive Register (LPR)?  Perhaps the way to keep all three instructions straight is to remember that “You get what you ask for.” If you code LNR, the result will be negative.  If you code LPR, the result will be positive. If you code LCR, you will get the additive complement which can be positive or negative.

So, what does LNR do?  If the integer in operand 2 is negative, it is placed into operand 1 unchanged. If the integer in operand 2 is positive, it is complemented and placed in operand 1. We will always produce a negative result with LNR. Since all positive integers have complements, no overflow can occur. Here are the condition codes for LNR.

Code          Meaning

0 Result zero

1 Result less than zero

2 —

3 —

What does LPR do?  If the integer in operand 2 is positive, it is placed in operand 1.  If the integer in operand 2 is negative, it is complemented and placed in operand 1. We will always produce a positive result (except for the maximum negative integer). If you complement the maximum negative integer, an overflow occurs.  Here are the condition codes for LPR.

Code          Meaning

0 Result zero, no overflow

2 Result greater than zero, no overflow

3 Overflow

The moral to this tale is you get what you ask for. LPR produces positive results. LNR produces negative results. LCR produces complements which are sometimes positive and sometimes negative.

Now you can spend that week doing something really productive.

Leave a comment

Filed under IBM Mainframe Assembler

Two’s Complement for Programmers

Are you new to two’s complement data? Need to brush up your skills? I’ve posted a new article on the website that might help – Two’s Complement for Programmers. It’s not heavy on mathematics, but long on the basic skills you need as an assembler programmer.

It will become an appendix in my new book The Big Blue Assembler Book. I decided to change the title when the book grew longer – +300 pages. Then I realized that “Big Blue” is a nickname for IBM and the title was fixed!

I’ll be building a few more programming exercises and an index (any suggestions?). Then I’ll read the whole thing again looking for errors before publishing it on Amazon.

6 Comments

Filed under IBM Mainframe Assembler

VisibleZ Available for Download

The link for downloading VisibleZ is working again. You will get the VisibleZ jar file and a Codes directory that has hundreds of small programs that demostrate a variety of instructions.

Leave a comment

Filed under IBM Mainframe Assembler

Content Moved

I’ve moved 99% of the content that was on my university site to this one. Almost all the links should reference punctiliousprogrammer now. If you have trouble with any of the links, let me know and I’ll provide you the material individually. I am still working on providing a download of VisbleZ.

Leave a comment

Filed under IBM Mainframe Assembler

Chasing Bad Links

The university where I store about half of the material on this site has changed something. I’ll talk with them today to find out what has happened. In any case, I’ll get the bad links fixed somehow, but it may take a few days. Sorry for the inconvenience.

6 Comments

Filed under IBM Mainframe Assembler

IBM Z Day Tomorrow!

It’ free, it’s here, and well worth your time. Starts September 15 at 8 AM EST. Here’s a link to the agenda:

https://bemyapp.us2.list-manage.com/track/click?u=7605d9f2f2cc8f3d1a43d7f54&id=9b157edd59&e=e8863d2eb7

Leave a comment

Filed under IBM Mainframe Assembler

Order a Book, Support the Site

I just published my first novel, The Elvis Bird, on Amazon, and Barnes and Noble. It’s a mystery about an ornithologist tracking a presumed extinct bird, the Ivory-billed Woodpecker. If you like mysteries, southern lit, ornithology, or Elvis, you might enjoy it. I created an author site at http://dewoolbright.com. You can find links to the book (paper or Kindle), read a couple of chapters on Amazon, and learn a little bit about Ivory-billed woodpeckers as well. All profits from the sale of the book will be donated to charitable organizations that support birds.

One reason I published it was to learn how it’s done. The next book will be called The Little Blue Assembler Book. It requires a lot more formatting, but I’m working diligently to put it out. So, buy a book, support the site and make an old man happy.

Leave a comment

Filed under My Books

Date Correction

IBM zDay is September 15.

Leave a comment

Filed under IBM Mainframe Assembler

IBM zDay, September 15

IBM zDay is coming soon, September 15. It’s a chance to catch 150 IBM zSystems experts for free!

Register at >>> ibm.biz/ibmzday-2022

IBM zDay: Sept. 15th, 8:00 AM to 4:00 PM EST
For Students! Special IBM zDay 24-Hr Global Meetup: Starts Sept. 14th! Students and life-long learners from around the world will come together to advance their skills and participate in hands-on coding activities designed for all levels, including our all-new 2022 IBM zStudent Contest.

Free virtual conference designed for all levels – no experience required
Connect, learn, and be inspired by 80 sessions across 5 content-rich tracks:

IBM zSYSTEMS: Build a flexible, AI-infused, sustainable business with IBM zSystems. Accelerate and scale with infrastructure that is optimized at its core to secure your enterprise.
IBM LinuxONE: Build a sustainable infrastructure with IBM LinuxONE, an enterprise-grade Linux server designed to meet the needs of mission-critical workloads in the hybrid cloud.
MODERNIZATION: Build a connected business with IBM zSystems and Cloud. Leverage APIs to extend and access applications and data, and refactor or rewrite existing application code.
COMMUNITY: Learn how our global community is shaping the digital landscape, evolving the tech industry and making the world a better place.

2 Comments

Filed under IBM Mainframe Assembler

Testing, Testing, Testing

After a good bit of experimentation with QSM, a testing plugin for WordPress, I’m happy with the tests I can produce online. I’ve settled on 10 questions per test grouped around a single idea like “Binary Data”. I’ve built ten tests so far, and I’ll keep adding more tests each week until there is a sufficient number of tests to cover a first course.

To take a test, select TEST BANK on the home page and choose a test from a list. The results are displayed online, and you can have them emailed to yourself if you like. Let me know if you uncover an error. Tests, like programs, are difficult to construct, and “punctilious” is a goal for me, and not always reality.

Leave a comment

Filed under IBM Mainframe Assembler

Brush Up Your USING Skills

The point of a USING statement is to inform the assembler which register to choose and which displacement to create when generating object code addresses. The IBM System/360 started with a single USING statement. Today, we have access to several different formats for creating USING statements. Are you familiar with them? If not, start here with a discussion of Labeled (or Named) USING statements. This kind of USING has distinct advantages over simple USING statements, especially in situations where the same data structure occurs multiple times and needs to be referenced simultaneously (as in linked lists). Here is some code you can use to play with these ideas.

Leave a comment

Filed under IBM Mainframe Assembler

I’m taking a break

I’m dealing with chemo therapy treatments these days, and it’s knocked me for a bit of a loop. I’ll be back to fix a few things on the site when I’m feeling better. The testing feature isn’t working yet, and I want to add a lot more tests. Spoiler alert: I am going to put Visiblez on the web as an application you can run from a browser. Look for it soon!
– David

1 Comment

Filed under IBM Mainframe Assembler

Test Yourself Update

I decided to remove the need to register an email address in the testing system for the moment because I couldn’t convince myself it was working correctly. So, if you take the test, you should get the results immediately. Without the email address, I can’t send you a record of the test by email. I’m not sure if that’s critical or not. I’m working on a way to present multiple tests, and after I settle on that, I’ll start building the database of questions. If you have suggestions, send them by email (woolbright_david@columbusstate.edu) or comment in the blog.

Leave a comment

Filed under IBM Mainframe Assembler

Test Yourself – and help me out

I’ve added a plugin to the website that will allow me to create tests or quizzes, grade them, and send you the results. I’m in the early stages of implementing a database of assembler questions on a variety of topics. So far, I’ve created the first test that asks questions about character data and instructions. I could use your help trying out the test system to see how it works. There is a box at the bottom of the test where you can report any problems with the test. Will you give it a try and let me know what you think?

Go to the Test Yourself tab on the home page and select the Character Data #1 test. To get the results, you will have to provide an email address. I make no money from this site, so I will not use your email for commercial purposes.

My goal is to build a database to help you prepare for job interviews, or just to brush up on various aspects of this large language.

2 Comments

Filed under IBM Mainframe Assembler

Search String – SRST

Anubha Agarwal wrote and asked for a video covering Search String (SRST). I don’t have a video quite yet, but here are my notes on this instruction. It’s an interesting one that can be used to search for the first occurrence of a single character in a given area of storage. It was probably added to the instruction set to help compiler writers who needed to search for C strings which are terminated with X’00’.

The interesting feature of the instruction is that it can be interrupted by the CPU for efficiency reasons when searching large areas of storage. The programmer can then decide whether to continue searching or not.

I stumbled over the examples given in the Principles of Operation, until I realized the code is flawed. A BC 1,LOOP instruction should be BC 3,LOOP, so pay close attention to those two examples.

Now that I’ve written down my thoughts, I’ll put together a video soon and provide some program examples you can experiment with. This instruction is definitely worth a look.

4 Comments

Filed under Fans of IBM z, IBM Mainframe Assembler

14th Marist ECC Conference, June 12-14, 2022

Marist College

The Marist Enterprise Computing conference (ECC) confernce is one of the best IBM mainframe conferences going: Great speakers, food, location, and no conference fee. This year it’s meeting face-to-face again on the beautiful Marist College campus, Poughkeepsie, NY. There is even an opportunity to give a presention of your own.

Check out the conference website here:  https://ecc.marist.edu/web/conference2022

3 Comments

Filed under Fans of IBM z, IBM Mainframe Assembler

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,

         SRP    MYFIELD,3,0    SHIFT MYFIELD LEFT BY 3 DIGITS

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

         SRP    MYFIELD,64-3,5 SHIFT MYFIELD RIGHT BY 3 DIGITS

or    

         SRP    MYFIELD,61,5   SHIFT MYFIELD RIGHT BY 3 DIGITS

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

         SRP    MYFIELD,0(R6),5  SHIFT MYFIELD RIGHT BY 3 DIGITS

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.

2 Comments

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.

2 Comments

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. https://developer.ibm.com/champions/

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: https://community.ibm.com/community/user/events/virtual-community

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

IBM Z Day

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.

8 Comments

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.

17 Comments

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: roberta.diggins@marist.edu 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:  http://ibm.biz/zday2021

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

Introduction to VSAM for Assembler Programmers: Part 2

I’ve added a second video as part of the introduction to VSAM for Assembler Programmers. You can find the first and second videos, as well as the related Powerpoints in the Video Course . Many thanks to Melvyn Maltz for generously making suggestions and pointing out corrections. I’ll add Part 3 soon.

Leave a comment

Filed under IBM Mainframe Assembler, VSAM

How to Print a Register

A friend of mine, Melvyn Maltz, was amused by some code I wrote recently. The code simply printed out the contents of a register, and I took a quick and dirty approach:  Store the register in a buffer, use PUT to print the buffer, SET HEX ON.  It’s a technique I often use when debugging on a mainframe.  I should tell you that my friend is an expert in most things IBM – a master programmer. He’s also generous enough to read or watch some of the material on this site and offer suggestions. In any case, the code amused him, and he reminded me that it’s not that hard to print a register – and it’s instructive.  I realized I had never written about how to print a hexadecimal representation of a register (or small field) on this site, so I’ll do that now.  It involves TR and UNPK.

Let’s start with UNPK which treats each byte of the sending field (except the last) the same. UNPK separates the zone and numeric parts of each byte (dare I call them nibbles?) into two bytes after appending a hexadecimal F on the front of each nibble, like this:

   | B 3 |
     /  \
| F B| F 3 |

A moment’s thought here is instructive.  The 3 is converted to x’F3’, which is exactly what we need to print it in a character format.  The same would be true for all digits 0-9. The treatment given to B doesn’t work so well.  The same bad treatment would occur for digits A-F. So, bytes x’FA’, x’FB’, … x’FF’ would have to be repaired after applying UNPK.  Can we fix those?  Yes.  TR can do the trick.  

So, the basic idea is to use UNPK followed by TR.  What about that last byte that UNPK converts by simply flipping the nibbles?  We can avoid that problem by adding a byte (logically or physically) to the field we are unpacking. Problem solved.

What about the TR table?  What does that look like?  My friend might suggest this,

HEXTABLE    DC    C’0123456789ABCDEF’

How do we get away without defining a 256-byte table? The solution leverages the fact that we are only translating a narrow range of sequential values:  x’F0’ – x’FF’  – every byte we need to translate begins with x’F’.  We can pretend to have created a 256-byte table by coding TR this way (assuming the register we want to print is R5):

            ST   R5,FWRD
            UNPK HEXAREAX,FWRDX
            TR   HEXAREA,HEXTABLE-240
            …
            DS  0F           ALIGNMENT
  FWRDX     DS  0CL5
  FWRD      DS   F
            DC   X'00'       AN EXTRA BYTE FOR UNPK
  HEXAREAX  DS  0CL9         8 HEX DIGITS+1 IN CHARACTER
  HEXAREA   DS   CL8         8 HEX DIGITS IN CHARACTER 
            DC   X'00'       AN EXTRA BYTE FOR UNPK

We can do this, confident that the first 240 bytes of our fictitious table will never be referenced by TR. (240 is the offset to a character 0). After translation, HEXAREA contains the result. Variations of this technique use explicit lengths and leaving off an extra byte. The only drawback to the technique is that the relative address HEXTABLE-240 may generate an addressability error if it references an address that is smaller than the base register address. This rarely happens.

My friend may get another chuckle out of this, but I’m going to suggest a second solution that uses a 256-byte table:

HEXTABLE  DC   256AL1(*-HEXTABLE)   NEUTRAL TABLE          
          ORG  HEXTABLE+X'FA'       FIX X'FA' THROUGH X'FF'
          DC   C'ABCDEF'                                   
          ORG  ,      

The rest of the solution is similar and looks like this:       

          ST    R5,FWRD
          UNPK  HEXAREAX,FWRDX   UNPK SLIGHTLY LARGER FIELDS
          TR    HEXAREA,HEXTABLE TRANSLATE THE SMALLER FIELD
          …
          DS  0F           ALIGNMENT
FWRDX     DS  0CL5
FWRD      DS   F
          DC   X'00'       AN EXTRA BYTE FOR UNPK
HEXAREAX  DS  0CL9         8 HEX DIGITS+1 IN CHARACTER FORMAT
HEXAREA   DS   CL8         8 HEX DIGITS IN CHARACTER FORMAT
          DC   X'00'       AN EXTRA BYTE FOR UNPK

After executing the first three lines above, HEXAREA will contain a printable version of register 5.

This leads into how we can print larger areas of memory in a hexadecimal format. There’s always the old standby:  SNAP.  Melvyn sent a nice example of TROT, but I’ll save that gem for another post.

Leave a comment

Filed under IBM Mainframe Assembler

New Video: Introduction to VSAM for Assembler Programmers

Here is a shoutout to Ravi Cheepa for suggesting I needed to add some VSAM material to the site. I’ll start with this video that contains some basic information about VSAM and its macros: ACB, RPL, EXLST, PUT, GET, MODCB, …

I’ve always thought that looking at code is the best way for programmers to learn, so I’ll follow this up with a series of demo programs that do something interesting and efficiently. I’ll also add some video to explain the programs and why the techniques they use are efficient. More soon …

5 Comments

Filed under IBM Mainframe Assembler

New Video: External DSECTS – Q-cons, CXDs, and DXDs

Q-cons, CXDs, and DXDs enlist the help of the Binder to make it easy for you to allocate storage dynamically for all your CSECTS. They also widen the possibilities for how you can design multi-CSECT programs. Some companies use these ideas to promote the separation of storage and code. In any case, this is an interesting HLASM path to explore.

I’ve created a video to explain these ideas and a sample program listed below that you can use as skeleton code for further exploration.

        PRINT  ON,NODATA,NOGEN
**********************************************************************
**********************  STORAGE FOR ASECT ****************************
**********************************************************************
ASTOR    DSECT
A1       DS    CL80       SOME VARIABLES FOR ASECT
A2       DS    CL30
A3       DS    CL5
A4       DS    PL10
A5       DS    200CL5
SAVEA    DS    18F        AREA FOR MY CALLEE TO SAVE & RESTORE MY REGS
**********************************************************************
**********************  STORAGE FOR PARMS ****************************
**********************************************************************
PARMSECT DSECT
X        DS    CL80
Y        DS    CL80
Z        DS    CL80
**********************************************************************
**********************  ASECT CONTROL SECTION ***********************
**********************************************************************
ASECT   CSECT
ASECT   AMODE  31
ASECT   RMODE  24
**********************  ENTRY LOGIC  *********************************
         STM   14,12,12(R13)          SAVE CALLER'S REGS
         BASR  R12,0                  ESTABLISH
         USING *,R12                  ADDRESSABILITY
         L     R8,EDSLEN              GRAB LENGTH OF STORAGE NEEDED
         STORAGE OBTAIN,LENGTH=(R8),ADDR=(R11)
         LR    R10,R11                GRAB ADDRESS FOR ALL STORAGE
         A     R10,ASECTO             ADD OFFSET FOR MY DSECT
         USING ASTOR,R10              I HAVE ADDRESSABILITY
         ST    R13,SAVEA+4            BACK-CHAIN CALLER'S FROM MINE
         LA    R13,SAVEA              POINT TO MY LOWER-LEVEL SA
**********************  BEGIN LOGIC  *********************************
         OPEN  (FILEOUT,(OUTPUT))
         PUT   FILEOUT,=CL80'ENTERING PROGASECT'
         LR    R9,R11                  POINT AT DYNAMIC STORAGE
         A     R9,PARMO                ADD THE OFFSET FOR PARMS
         USING PARMSECT,R9             I HAVE ADDRESSABILITY
         MVC   X,=CL80'THIS IS PARM X' INITIALIZE ...
         MVC   Y,=CL80'THIS IS PARM Y' ... PARMS
         MVC   Z,=CL80'THIS IS PARM Z'
         LA    R1,=A(FILEOUT,PARMO)   PASS THE DCB AND PARMO
         L     R15,=A(BSECT)          CALLING BSECT
         BASR  R14,R15                BRANCH THERE
         PUT   FILEOUT,=CL80'RETURNED TO PROGA1'
         LR    R9,R11                 POINT AT ALLOCATED STORAGE
         A     R9,XXXAO               ADD THE OFFSET TO XXX
         PUT   FILEOUT,0(R9)          R9 POINTS AT XXX
         CLOSE FILEOUT
         STORAGE RELEASE,LENGTH=(R8),ADDR=(R11)
*********************** STARDARD EXIT ********************************
RETURN   EQU   *                      BRANCH TO HERE FOR NORMAL RETURN
         L     R13,SAVEA+4            POINT TO CALLER'S SAVE AREA
         LM    R14,R12,12(R13)        RESTORE CALLER'S REGS
         LA    R15,0                  SET RETURN CODE REG 15 = 0
         BR    R14
****************** LOCAL DATA AREAS   ********************************
FILEOUT  DCB   DSORG=PS,                                               X
               MACRF=(PM),                                             X
               DEVD=DA,                                                X
               DDNAME=FILEOUT,                                         X
               RECFM=FB,                                               X
               LRECL=80
ASECTO   DC    Q(ASTOR)               OFFSET TO ASTOR
PARMO    DC    Q(PARMSECT)            OFFSET TO PARMSECT
XXX      DXD   CL80                   DECLARATION OF XXX IN EDS
XXXAO    DC    Q(XXX)                 OFFSET TO XXX
EDSLEN   CXD                          FULLWORD TOTAL SPACE NEEDED
         LTORG
         YREGS

**********************************************************************
**********************  STORAGE FOR BSECT ****************************
**********************************************************************
BSTOR    DSECT
B1       DS     F           THE STORAGE AREAS NEEDED IN BSECT
B2       DS     CL20
B3       DS     PL5
B4       DS     CL100
B5       DS     CL5
SAVEB    DS   18F                     BSECT SAVE AREA
**********************************************************************
**********************  BSECT CONTROL SECTION ***********************
**********************************************************************
BSECT    CSECT
         STM   14,12,12(R13)          SAVE CALLER'S REGS
         BASR  R12,0                  ESTABLISH
         USING *,R12                  ADDRESSABILITY
         LR     R10,R11               SET UP...
         A      R10,BSECTO            ... ADDRESSABILITY FOR BSECT
         USING  BSTOR,R10             I HAVE STORAGE ADDRESSABILITY
         LR     R9,R11                POINT AT ALLOCATED MEMORY
         L      R6,4(R0,R1)           R6 POINTS AT PARMO
         A      R9,0(R0,R6)           ADD THE OFFSET FOR PARMS
         USING  PARMSECT,R9           I HAVE PARM ADDRESSABILITY
         ST     R13,SAVEB+4
         LA     R13,SAVEB
**********************  BEGIN LOGIC  *********************************
         L      R5,0(R0,R1)           R5 POINTS AT MY RECOUT DCB
         PUT    (R5),=CL80'ENTERED BSECT'
         PUT    (R5),X                PRINT THE PARMS
         PUT    (R5),Y
         PUT    (R5),Z
*
*        USE BSTOR FIELDS CAN BE USED HERE
*
         MVC    B4,=CL80'THIS IS B4 DATA'
         PUT    (R5),B4
*
*        PREPARE TO USE XXX
*
         LR     R9,R11                POINT AT XDS WITH R9
         A      R9,XXXBO              ADD THE OFFSET TO XXX
         MVC    0(80,R9),=CL80'XXX IN ASECT WAS CHANGED IN BSECT'
*
         PUT    (R5),=CL80'ABOUT TO LEAVE BSECT'
*********************** STARDARD EXIT ********************************
         L      R13,SAVEB+4           STANDARD EXIT CODE
         LM     R14,R12,12(R13)
         BR     R14
************* INITIALIZED DATA AREAS AND PARMS ***********************
BSECTO   DS     Q(BSTOR)      OFFSET FOR BSECT STORAGE
XXXBO    DC     Q(XXX)        OFFSET TO XXX
         LTORG
         END   ASECT

Leave a comment

Filed under IBM Mainframe Assembler

New Video: Using COM Control Sections

I’ve recently added a video that covers COM control sections – an old idea that’s interesting to try. If your program consists of multiple CSECTs, you can create a COM section – an uninitialized storage area that becomes part of the object module – and which can be shared selectively among the CSECTs that comprise the program. You can find the video here and some sample code to play with here. There’s also links to these items in the Video Course.

3 Comments

Filed under IBM Mainframe Assembler

Links Updated

I’ve updated the links to a few html pages that used Flash to reference mp4 files. If you have any trouble playing video from my site, send me the link and I’ll repair it.

1 Comment

Filed under IBM Mainframe Assembler

Updating the Site

Evidently, I have a number of pages on the site that invoke a Flash player that is no longer supported in most browsers. I am working to repair this problem as quickly as possible. I apologize for the inconvenience.

Leave a comment

Filed under IBM Mainframe Assembler

Last COBOL Fridays Webcast: tune in

It was fun and and flattering to be a part of the IBM-sponsored COBOL Fridays Webcast twice over the past year. If you missed them, you can still catch the webcasts here:

https://developer.ibm.com/languages/cobol/series/cobol-fridays-webinar-videos/

IBM and the Open Mainframe Project offers software, a COBOL course, and mainframe access to programmers wanting to learn COBOL. You can still be part of the fun for free – quite an opportunity.

I’m looking forward to being on the last webcast this Friday as part of a panel discussion that wraps up the series. Hope you can tune in. The Webcast starts at 10:30 EST here. Or you can catch the replay later at your leisure.

2 Comments

Filed under IBM Enterprise Cobol

Don’t Have Mainframe Access? Try This

If you want to learn IBM mainframe assembly language but don’t have access to an IBM System/z machine, there is an excellent alternative:  Z390 Portable Mainframe Assembler and Emulator. (Even if you do have access, you can find it helpful.) This product has a long, successful history, is freely distributed, and runs on Windows, Linux, and Mac PC’s. It also supports all the instructions described in the Principles of Operation manual of October, 2019 – very impressive!

I asked Don Higgins, the creator, to write a short article about his product. Here it is.

Z390 Portable Mainframe Assembler and Emulator Overview

Don Higgins

November 20, 2020

Z390 is an open-source, Java-based mainframe assembler and emulator designed to run on Windows, Linux, and Mac PC’s.  The predecessor to z390 was the PC/370 shareware mainframe assembler and emulator for MS-DOS PC’s.  PC/370 was used by thousands of students at universities in the 1980s.  In 1993 I sold PC/370 to Micro Focus, and in 1995 I went to work for Micro Focus developing the assembler component of the Micro Focus Mainframe Express product for Windows PCs.  In 2004 I left Micro Focus and started the z390 open source project. 

The original goal of z390 was to assemble, link, and execute problem state application programs on any platform that supports Java runtime.  Over the years, the following major features have been added to z390:

  1. Macro process and assembler compatible with HLASM
  2. Linker to create executable modules 
  3. Emulator with the following support:
    1. Problem state instruction execution
    1. Trace and dump options
    1. Floating-point, including HFP, BFP, and DFP.
    1. Storage management including GETMAIN and FREEMAIN
    1. QSAM, BDAM, and VSAM file management
    1. Sort merge utility
  4. zCOBOL compiler which generates z390 assembler
  5. zCICS transaction support developed by Melvyn Maltz
  6. Graphical User Interface

In 2012, I retired from z390 development for a while.  Abe Kornelis and Melvyn Maltz continued to develop z390.  In 2020 I returned and have spent most of 2020 upgrading the z390 assembler to correctly assemble all the IBM mainframe instructions in the Principles of Operation manual published in Oct. 2019.  A test program named ZOPCHECK was developed to verify all 2357 opcode, mnemonic, and operand combinations.

 References:

  1. Z390 Mainframe Assembler and Emulator Downloads
  2. Z390 Portable Mainframe Assembler and zCOBOL and zCICS
  3. Z390 Sort Utility
  4. ZOPCHECK Opcode Verification Program
  5. PC370 Assembler and Emulator History

2 Comments

Filed under IBM Mainframe Assembler

z/OS Training at Marist College Enrolling Now

Marist College through the Institute of Data Center Professionals (IDCP) offers a variety of mainframe-based courses and professional z/OS certificates all online. Working jointly with IBM, these worldwide programs were designed to educate personnel who are entering the field as well as those with experience in z/OS and a variety of application programming tracks including COBOL, DB2 and Assembler language.

If you are looking for specialized mainframe training online, look no further.  Fall classes start August 31, 2020.  Here is the best link for the program:  https://conta.cc/30UErq3e

For a number of years I’ve taught the two-course assembler sequence for Marist to people located around the globe. The course evolves each year and I take pride in adding new topics and videos each time I teach it. I’d love to work with you individually to master IBM Assembly language in a small-group asynchronous online setting. Together, we will work through a sequence of on-target programming assignments. At the end, you’ll have the necessary skills to begin working as an assembler programmer.  But don’t wait, classes are starting soon.

 

Leave a comment

Filed under IBM DB2, IBM Enterprise Cobol, IBM Mainframe Assembler

Writing Reentrant Assembler Code

Some programs run so often we take special efforts to make sure that only one copy of the program needs to be loaded into memory, no matter how many users are running it concurrently. That’s what reentrant programming is all about. We can do this by dynamically allocating storage for all the parts of our program that might change. Each user gets their own copy of dynamic storage.

Want to get your assembler program to run in the Language Environment?  It needs to be reentrant.  Future posts will cover COBOL calling Assembler and Assembler calling COBOL in the Language Environment, but to follow along, you first have to learn how to  write assembler reentrantly.

Some programmers write all their programs in a reentrant style. There’s not a lot of extra overhead. Want to give it a try?  I’ve posted a video about how it works here and in the assembler video course. There’s also a sample reentrant program you can start with here.  The video explains in detail how the program works.

 

 

13 Comments

Filed under IBM Mainframe Assembler

Marist ECC Conference – Free Online June 7-9

Marist College sponsors one of my favorite mainframe conferences each year called the Enterprise Computing Conference. This year it is scheduled for June 7-9, and it is online and free. The conference always features some interesting general talks by leading IBM and industry experts, as well as a number of smaller talks on mainframe related topics. Here is your chance to attend for free. Check out the conference schedule here: https://ecc.marist.edu/web/conference2020/welcome

Be sure to register early so you won’t miss anything. I’m sorry I won’t get a chance to visit the lovely Marist campus on the Hudson river this year, but I’m looking forward to enjoying the conference virtually. See you there.

Leave a comment

Filed under IBM Mainframe Assembler

Datasets for the COBOL Course

I have added a tab (Course Datasets) at the top of the blog to help provide input data for the programs referenced in the COBOL course.

In the case of input files that contain packed data, I am including a COBOL program that will produce the input file when you run it. Each COBOL program takes its own data from an in-stream dataset. I’m including the COBOL code and the JCL surrounding it to make things easier. You will have to adjust the file names.

In the case textual data files, I’m including a copy of the input data which you can paste into a member in a PDS to create the input file.

Let me know if I can help.

1 Comment

Filed under IBM Mainframe Assembler

IBM’s COBOL FRIDAY WEBCAST

I had lots of fun this morning on IBM’s COBOL FRIDAY with Sudharsana Srinivasan and Paul Newton. I talked mostly about COBOL intrinsic functions, but we also considered what to do if you wanted to write something that sort of works like a user-defined function. Enterprise COBOL doesn’t support user-defined functions just yet, but it’s in the works. My work-around involves writing nested programs. You can watch the webcast here if you are interested. I also posted some sample code at the Enterprise COBOL tab that goes along with the talk. The STACKY program does dynamic allocation and creates a stack for storing pointers to records. It uses a nested programming style to create the data structure.

Leave a comment

Filed under IBM Mainframe Assembler

Learn You a COBOL for Great Good

The title is a reference to one of my favorite programming language instruction texts: Learn You a Haskell for Great Good. Funny, well-written and instructive. If you want to learn a functional language, Haskell is a fine choice. I still like writing in Scheme – another functional language that’s almost as old as Cobol.

But today’s topic is Cobol, which has been in the news lately, and which has a few programmers dusting off their old textbooks and manuals.  If you want to learn Cobol or brush up on your old Cobol skills, I might be able to help. I developed an online class a few years ago to use for corporate training. Now I’ve decided to publish it for general use.

You can find it here: IBM Enterprise Cobol and as a link at the top of the home page. It was built with the idea of taking a beginner and turning them into a corporate programmer. If you have some mainframe skills already, you can skip some of the beginning lessons.

The course is divided into 5 units, and if you push hard, it’s possible to get through a unit each day – a week of corporate training.  The course comes with an extensive collection of slides – 299 in all.  There are 15 programming problems that you will need to tackle and complete if you are really wanting to learn something.

You can help me by reporting any problems you have with the site or with the material.

So, … I hope this will help you learn a Cobol for great good!

8 Comments

Filed under IBM Enterprise Cobol, IBM Mainframe Assembler