The Punctilious Programmer IBM Mainframe Assembler Structured Assembler Macros: The Case Statement

Structured Assembler Macros: The Case Statement

Here’s a simple case statement using the HLASM structured CASE macro. Register 4 is selected (your choice not = 0) and l0 is loaded into R4. The contents of the register are used to select the correct case. In this case, “Fall” is MVC-ed to the SEASON field. More complex CASE examples will be the subject of future posts.


LA R4,10
CASENTRY R4
CASE 12,1,2
MVC SEASON,=CL6’WINTER’
CASE 3,4,5
MVC SEASON,=CL6’SPRING’
CASE 6,7,8
MVC SEASON,=CL6’SUMMER’
CASE 9,10,11
MVC SEASON,=CL6’FALL’
ENDCASE
PUT FILEOUT,RECOUT

Leave a Reply