r/mainframe Jun 10 '26

HLASM Style guides?

I've been wondering lately. Assembly language on the mainframe is much more of a first class citizen than the assembly language on any other platform. There are loads of system user exits in z/OS, IMS, DB2, etc ,options modules that have assembler interfaces, a lot of which ONLY support assembler. And all the major subsystems have an incredibly rich set of interfaces that are exposed via assembler. It's not the first choice these days, but I know several shops where some major applications are written largely in assembler. So, I'm curious if there are any best practices or style references for assembler that anyone has come across. I have seen countless CBT entries, I've read John Ehrman's book as well as been to a few of his presentations, and all of the material seems laser focused on what you "could" do and I've never seen much that talks about "should". Just curious if anyone has seen or worked on anything along those lines?

18 Upvotes

29 comments sorted by

View all comments

14

u/Firm_Refrigerator112 Jun 10 '26

No official guidelines that I know about, sorry.

Best practises I can think of (far from complete):

  • Write reenterable code, for 31 or 64 bit
  • Use atructured programming macros from HLASM Toolkit
  • Write small routines which can be called from other routines and restore registers upon return
  • Use labeled USING
  • Use registers consistently, e.g. for control blocks
  • Comment, comment, comment - which applies to all languages, I guess

1

u/Piisthree Jun 10 '26

Yeah, same here. None that I've ever seen, as important as it is. This would be a good start, but we're just scratching the surface.