IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Assembler: Set Program Mask for decimal overflow


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lloyd Christensen

New User


Joined: 26 Apr 2022
Posts: 9
Location: United States

PostPosted: Tue May 17, 2022 8:45 pm
Reply with quote

Hi,
After 30+ years as a MF Storage Admin, working for clients and vendors, I am trying to learn z/OS Assembler. I am in a program thru Marist College with IBM and I'm struggling with some basic stuff.

I have an assignment in which the instructor provided an example of a floating point overflow and we were to comment out a load for Register 5 and SPM statement, create the overflow, and branch on overflow. Then uncomment those two lines and run it again to see the abend.

The assignment was to then do the same to cause a decimal overflow using packed data. I've done that.

L R5,=X'0A000000' ENABLE ABEND...
SPM R5 ...ON DECIMAL OVERFLOW

However, it doesn't abend even when the overflow happens. In John Ehrman's book it says to test for an 'A' for decimal overflow. The fixed point overflow test used an '08'

Can anyone explain why this isn't resulting in an abend?

I did some searches and found an old APAR that was for COBOL calling an Assembler macro in which, in an LE environment, the abend wasn't taking place but I don't think that's related.


I have attached the program source and the output of a run.

Any/all help is appreciated.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Tue May 17, 2022 10:21 pm
Reply with quote

1. It is strongly recommended not to use attached files in your messages. Use the CODE fragments instead:
Code:
. . . . . .
 IEF236I ALLOC. FOR KC03I712 G STEP1
 IGD103I SMS ALLOCATED TO DDNAME PGM=*.DD
 IEF237I JES2 ALLOCATED TO FILEOUT1
 IEF237I JES2 ALLOCATED TO SYSUDUMP
 PROGRAMMER NOTE: ADDING TO PKFAIL
 PROGRAMMER NOTE: PACKED OVERFLOW DETECTED
 IEF142I KC03I712 G STEP1 - STEP WAS EXECUTED - COND CODE 0000
 . . . . . . .


2. You have two typos in your code:
Code:
000014 5850 C1C2            001C8    17          L     R5,=X'000A0000'   ENABLE ABEND...     

here your mask is placed into the wrong bits of register 5, which is different from your separate source code

and
Code:
0000CC 5C                            63 PKADDR   DC    PL1'15' 

here you get the constant +5 instead of +15


Anyway, the Decimal Overflow mask bit should be 0, and 999+5 must result in ABEND S0CA. So far it is not clear why this did not happen? Aren't there other mistyped errors in your code?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Tue May 17, 2022 11:11 pm
Reply with quote

The reason is: misunderstanding of the program mask bits value.

Quote:
When the mask bit is one, the exception results in an interruption (and highly likely, further ABEND).
When the mask bit is zero, no interruption occurs (and no ABEND can be expected).


So, in order to allow only Decimal Overflow ABEND, you need to set one single bit of the Program Mask; it is desirable not to touch any other bit, unless you need to modify them, too.
(The Decimal Overflow control bit is actually B'00000100', or X'04' of the hi-order byte of the register.)
Code:
         IPM   R5               get current settings for all Program Mask bits
         O     R5,=X'04000000'  set 1 to the Decimal Overflow control bit
         SPM   R5               replace the Program Mask with one changed bit


In this case all decimal overflows shall cause the ABEND S0CA, while other ABENDs will depend on other Program Mask bit settings.
Back to top
View user's profile Send private message
Lloyd Christensen

New User


Joined: 26 Apr 2022
Posts: 9
Location: United States

PostPosted: Wed May 18, 2022 12:03 am
Reply with quote

The first error, checking the wrong bit, I appreciate. I'd been trying all kinds of stuff including different bytes. Yes, it needed to be moved to the first bit.

The second, I did misunderstand. In Chapter V, Assembler Language Programming for IBM System z(TM) Servers, at the top of page 235 it has checking bit 36 for'08' (fixed-point overflow), bit 37 for '0A' (decimal overflow), bit 38 for '0D' for Hexadecimal floating-point underflow, and bit 39 for '0E' for Hex floating-point lost significance. Since the instructor's sample worked when checking for a '08' I assumed using '0A' would be correct.

Obviously I assumed poorly; however, changing to '0D' did result in the S0CA abend. Following your response, I tested with '04' and it did result in the SOCA abend.

Thank you.

I've got a bunch more to work through over the next couple of weeks I hope not to abuse your generosity.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed May 18, 2022 12:54 am
Reply with quote

Lloyd Christensen wrote:
The first error, checking the wrong bit, I appreciate. I'd been trying all kinds of stuff including different bytes. Yes, it needed to be moved to the first bit.

The second, I did misunderstand. In Chapter V, Assembler Language Programming for IBM System z(TM) Servers, at the top of page 235 it has checking bit 36 for'08' (fixed-point overflow), bit 37 for '0A' (decimal overflow), bit 38 for '0D' for Hexadecimal floating-point underflow, and bit 39 for '0E' for Hex floating-point lost significance. Since the instructor's sample worked when checking for a '08' I assumed using '0A' would be correct.

Obviously I assumed poorly; however, changing to '0D' did result in the S0CA abend. Following your response, I tested with '04' and it did result in the SOCA abend.

Thank you.

I've got a bunch more to work through over the next couple of weeks I hope not to abuse your generosity.


You have mixed two different entities: the bits of the Program Mask, and the Exception Codes after a program interruption occurs.

The Program Mask bits (in PSW, or in the hi-order byte of the register used in IPM/SPM) are as follows:
Code:
B'00110000' - two bits of the last Condition Code
B'00001000' - Fixed Point Overflow mask bit
B'00000100' - Decimal Overflow mask bit
B'00000010' - HFP Exponent Underflow mask bit
B'00000001' - HFP Significance mask bit
other bits are ignored by IPM/SPM instructions.

After the program exception occurs (when allowed by the corresponding Program Mask bit), then the Interruption (or Exception) Code is set as follows (for the Exception Handling Routine to be able to recognize the reason of the exception):
Code:
Operation exception                    X'01'
Privileged operation exception         X'02'
Execute exception                      X'03'
Protection exception                   X'04'
Segment translation exception (note 1) X'04'
Page translation exception (note 2)    X'04'
Addressing exception                   X'05'
Specification exception                X'06'
Data exception                         X'07'
Fixed-point overflow exception         X'08' - masked by B'00001000'
Fixed-point divide exception           X'09'
Decimal overflow exception             X'0A' - masked by B'00000100'
Decimal divide exception               X'0B'
Exponent overflow exception            X'0C'
Exponent underflow exception           X'0D' - masked by B'00000010'
Significance exception                 X'0E' - masked by B'00000001'
Floating-point divide exception        X'0F'

Please note, that only 4 of 15 possible exceptions may be either masked or allowed by setting the Program Mask bits.

When any Program Exception occurs, the control is passed either to the user-defined SPIE routine, or to the System Exception Handle routine; any of them can check the Interruption Code to find out what has caused this exception.

The System Exception Handler initiates the system ABEND with the ABEND code equal to 'S0Cx', where 'x' is the number of the Program Exception.
In case of Decimal Overflow the expected ABEND is S0CA
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top