Dᑍ Include API structures and constants
Dᑍ
D/COPY QSYSINC/QRPGLESRC,QPDSRVPG
Dᑍ
Dᑍ Array of problem record description pointers and index to array
Dᑍ
Dpdr S ᑍ dim(2)
Dx S 5B INZ(1)
Dᑍ
Dᑍ Misc. data elements
Dᑍ
Dfactor1 S 5B INZ(1)
Dfactor2 S 5B INZ()
Dresult S 5B
Drc S 2 INZ('RC')
Dᑍ
Dᑍ Program status data structure
Dᑍ
DPSDS SDS
D pgm_name 1 1
D status 11 15
D src_line 21 28
D exception 4 46
D lib_name 81 9
Cᑍ
Cᑍ Attempt to divide by
Cᑍ
C factor1 div factor2 result
Cᑍ
Cᑍ Should not get here due to divide-by- exception
Cᑍ
C move '1' ᑍINLR
C return
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 eval qusbprv = %size(qusec)
Cᑍ
Cᑍ Record the suspected program and library name
Cᑍ
C eval qpdk1 = 11
C eval qpdpgmnl = %SIZE(pgm_name)
C eval qpdlibnl = %SIZE(lib_name)
C eval qpdpgmn = %ADDR(pgm_name) 2
C eval qpdlibn = %ADDR(lib_name)
Cᑍ
Cᑍ and record the key:
Cᑍ
Appendix B. Original Examples in Additional Languages B-127