Here’s the next video in the series. There’s never a doubt about what’s happened with an S0C7 – you’ve got bad data! Sit back and watch me demo the most common error my students make to cause this friendly abend.
Find all the other videos here.
Here’s the next video in the series. There’s never a doubt about what’s happened with an S0C7 – you’ve got bad data! Sit back and watch me demo the most common error my students make to cause this friendly abend.
Find all the other videos here.
Filed under IBM Mainframe Assembler
I Just finished turning in grades for the latest semester, and now I have a bit more time for adding to the blog. Want to know more about S0C4 abends? Then this video is for you. You can also find the code for the video along with lots of other videos here. More debugging videos are on the way, so check back soon.
Filed under IBM Mainframe Assembler
Stumped by a S0C1? S0C4? S0C7? Master dump reading with this series of videos that cover dump reading basics.
The series of debugging sessions will cover various abends. The first video starts with some helpful suggestions for debugging a S0C1. Along the way, you’ll also learn some debugging principles that apply to any kind of dump reading you need to do. Here is the video. Let’s get started!
Filed under IBM Mainframe Assembler
The IF macro can be paired with an ELSEIF companion macro to build a simple case statement. In the code below, DAY is a one-byte character field containing a single digit representing a day of the week (1 = Sunday, 2 = Monday, …). We use the DAY field to build DAYO, a character version of the day. We combine this logic with an OR in the final condition to catch Saturday and Sunday.
LOOP EQU *
IF (CLC,DAY,EQ,=C'2')
MVC DAYO,=CL9'MONDAY'
ELSEIF (CLC,DAY,EQ,=C'3')
MVC DAYO,=CL9'TUESDAY'
ELSEIF (CLC,DAY,EQ,=C'4')
MVC DAYO,=CL9'WEDNESDAY'
ELSEIF (CLC,DAY,EQ,=C'5')
MVC DAYO,=CL9'THURSDAY'
ELSEIF (CLC,DAY,EQ,=C'6')
MVC DAYO,=CL9'FRIDAY'
ELSEIF (CLC,DAY,EQ,=C'1'),OR,(CLC,DAY,EQ,=C'7')
MVC DAYO,=CL9'WEEKEND'
ENDIF
PUT FILEOUT1,RECOUT PRINT THE RECORD
GET FILEIN1,RECIN GET THE NEXT RECORD
B LOOP GO BACK AND PROCESS
Filed under IBM Mainframe Assembler
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
Filed under IBM Mainframe Assembler
Build a while loop using the structured assembler Do macro. Here is the relevant code:
DO WHILE=(CP,X,LT,=P'10')
AP X,=P'1'
MVC XOUT,EDWD
ED XOUT,X
PUT FILEOUT1,RECOUT
ENDDO
The test at the top of the loop compares X with a packed decimal 10 and enters the loop if X is less than 10. Sweet! Here’s the complete program that makes it work:
//CSUP004A JOB (ASSY),'WOOLBRIGHT',CLASS=A,MSGCLASS=A,
// NOTIFY=&SYSUID,MSGLEVEL=(1,1)
//ASM EXEC PROC=HLASMCLG
//C.SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR
// DD DSN=HLA.SASMMAC2,DISP=SHR
//SYSIN DD *
COPY ASMMSP
TITLE 'SKELETON ASSEMBLER PROGRAM'
PRINT ON,DATA,NOGEN
******************************************************************
* *
* PROGRAMMER: WOOLBRIGHT *
* COMMENTS : ASM SKELETON PROGRAM *
* *
******************************************************************
* *
* REGISTER EQUATES *
* *
******************************************************************
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
******************************************************************
* *
* SYMBOLIC EQUATES *
* *
******************************************************************
MACRO3 CSECT STANDARD ENTRY CODE
STM R14,R12,12(R13)
BASR R12,R0 ESTABLISH...
USING *,R12 ADDRESSABILITY
ST R13,SAVEAREA+4 BACKWARD CHAIN CALLER
LA R13,SAVEAREA ADDRESS OF MY SAVE AREA
******************************************************************
* BEGIN THE PROGRAM LOGIC. FIRST OPEN THE OUTPUT FILE
******************************************************************
OPEN (FILEOUT1,(OUTPUT))
ZAP X,=P'0'
LOOP EQU *
DO WHILE=(CP,X,LT,=P'10')
AP X,=P'1'
MVC XOUT,EDWD
ED XOUT,X
PUT FILEOUT1,RECOUT
ENDDO
EXIT EQU *
CLOSE (FILEOUT1)
L R13,SAVEAREA+4 POINT AT OLD SAVE AREA
LM R14,R12,12(R13) RESTORE THE REGISTERS
LA R15,0 RETURN CODE = 0
BR R14 RETURN TO OPERATING SYSTEM
******************************************************************
* *
* OUTPUT FILE - DATA CONTROL BLOCK *
* *
******************************************************************
DC X'FFFFFFFF'
FILEOUT1 DCB DSORG=PS, X
MACRF=(PM), X
DEVD=DA, X
DDNAME=FILEOUT1, X
RECFM=FB, X
LRECL=80
******************************************************************
*
* OUTPUT RECORD AREA
*
******************************************************************
RECOUT DS 0CL80 PRINT AREA
DC CL10' '
XOUT DS CL5
DC CL65' '
EDWD DC X'4020212060'
X DS PL2
******************************************************************
*
* REGISTER SAVE AREA
*
******************************************************************
SAVEAREA DS 18F
******************************************************************
*
* LITERAL POOL
*
******************************************************************
LTORG *
END MACRO3
/*
//G.SYSABOUT DD SYSOUT=*
//G.SYSUDUMP DD SYSOUT=*
//G.FILEOUT1 DD SYSOUT=*
//
Filed under IBM Mainframe Assembler
The structured programming macros in HLASM are just too sweet to ignore. Make your programming life easier by adopting them. The SELECT statement works like Java’s SWITCH except the default behavior is to exit each case automatically (no pesky BREAKs) – just as God intended. The code below examines a two-byte character field that contains a 01 for January, 02 for February, …, 12 for December. The code substitutes a character version of the month in the output. Notice how clean the code looks compared to what we would write in native assembler.
SELECT CLC,MONTHIN,EQ
WHEN =C'01'
MVC MNTHOUT,=CL9'JANUARY'
WHEN =C'02'
MVC MNTHOUT,=CL9'FEBRUARY'
WHEN =C'03'
MVC MNTHOUT,=CL9'MARCH'
WHEN =C'04'
MVC MNTHOUT,=CL9'APRIL'
WHEN =C'05'
MVC MNTHOUT,=CL9'MAY'
WHEN =C'06'
MVC MNTHOUT,=CL9'JUNE'
WHEN =C'07'
MVC MNTHOUT,=CL9'JULY'
WHEN =C'08'
MVC MNTHOUT,=CL9'AUGUST'
WHEN =C'09'
MVC MNTHOUT,=CL9'SEPTEMBER'
WHEN =C'10'
MVC MNTHOUT,=CL9'OCTOBER'
WHEN =C'11'
MVC MNTHOUT,=CL9'NOVEMBER'
WHEN =C'12'
MVC MNTHOUT,=CL9'DECEMBER'
OTHRWISE
MVC MNTHOUT,=CL9'UNKNOWN'
ENDSEL
Just so you can see the difference, here is part of the generated code, which would be similar to the code we would write without the macro:
SELECT CLC,MONTHIN,EQ
WHEN =C'01'
+ CLC MONTHIN,=C'01'
+ BC 7,#@LB2
MVC MNTHOUT,=CL9'JANUARY'
WHEN =C'02'
+ BC 15,#@LB1 SKIP TO END
+#@LB2 DC 0H
+ CLC MONTHIN,=C'02'
+ BC 7,#@LB4
MVC MNTHOUT,=CL9'FEBRUARY'
WHEN =C'03'
+ BC 15,#@LB1 SKIP TO END
+#@LB4 DC 0H
+ CLC MONTHIN,=C'03'
+ BC 7,#@LB6
MVC MNTHOUT,=CL9'MARCH'
WHEN =C'04'
+ BC 15,#@LB1 SKIP TO END
Which is easier to debug and understand?
Filed under IBM Mainframe Assembler