I 31 6 OBJ1L
I 61 7 OBJ1T
Cᑍ
Cᑍ Prepare for divide-by-zero situation
Cᑍ
C Z-ADD1 FACT1 5
C Z-ADD FACT2 5
Cᑍ
Cᑍ and divide by
Cᑍ
C FACT1 DIV FACT2 RESULT 5
Cᑍ
Cᑍ should not get here due to divide-by- exception
Cᑍ
C MOVE '1' ᑍINLR
C RETRN
Cᑍ
Cᑍ Program exception subroutine:
Cᑍ
C ᑍPSSR BEGSR
Cᑍ
Cᑍ Make sure we are not catching an exception due to the ᑍPSSR
Cᑍ subroutine itself
Cᑍ
C SWITCH IFEQ ' '
C MOVE '1' SWITCH 1
Cᑍ
Cᑍ Set API error code to work in nonexception mode
Cᑍ
C Z-ADD16 QUSBNB
Cᑍ
Cᑍ Record the source listing line number that caused the failure
Cᑍ
Cᑍ First, extract the numeric portion of the PSDS line number
Cᑍ
C Z-ADD8 X 1
C Z-ADD8 Y 1
C Z-ADD LIN#C
C SRC,X DOWEQ' '
C SUB 1 X
C END
C X DOWGT
C MOVE SRC,X TGT,Y
C SUB 1 X
C SUB 1 Y
C END
Cᑍ
Cᑍ Then record it:
Cᑍ
C Z-ADDLIN#C FAILPT
Cᑍ
Cᑍ Record the status code for the failure
Cᑍ
C MOVELSTATUS DATA
Cᑍ
Cᑍ Record where to find the status data within DATA
Cᑍ
C Z-ADD DTAOFF
B-118 System API Programming V4R1