Download PDF Part I

Transcript
Condition-Handling Routines and Services
9.11 Displaying Messages
! Declare condition codes
EXTERNAL ONE_VALUE
INCLUDE ’($SSDEF)’
INDEX = LIB$MATCH_COND (SIGARGS(2),
2
SS$_INTDIV)
IF (INDEX .GT. 0) THEN
DO I=1,15
IF (I .LE. SIGARGS(1) - 2) THEN
NEWSIGARGS(I) = SIGARGS(I+1) ! Start with SIGARGS(2)
ELSE
NEWSIGARGS(I) = 0
! Pad with zeros
END IF
END DO
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
! Signal messages
CALL LIB$SIGNAL (%VAL(NEWSIGARGS(1)),
%VAL(NEWSIGARGS(2)),
%VAL(NEWSIGARGS(3)),
%VAL(NEWSIGARGS(4)),
%VAL(NEWSIGARGS(5)),
%VAL(NEWSIGARGS(6)),
%VAL(NEWSIGARGS(7)),
%VAL(NEWSIGARGS(8)),
%VAL(NEWSIGARGS(9)),
%VAL(NEWSIGARGS(10)),
%VAL(NEWSIGARGS(11)),
%VAL(NEWSIGARGS(12)),
%VAL(NEWSIGARGS(13)),
%VAL(NEWSIGARGS(14)),
%VAL(NEWSIGARGS(15)),
%VAL(%LOC(ONE_VALUE)),
%VAL(0))
HANDLER = SS$_CONTINUE
ELSE
HANDLER = SS$_RESIGNAL
END IF
END
A signal argument list may contain one or more condition values and FAO
arguments. Each condition value and its FAO arguments is ‘‘chained’’ to the next
condition value and its FAO arguments. You can use chained messages to provide
more specific information about the exception condition being signaled, along with
a general message.
The following message source file defines the exception condition
PROG_ _FAIGETMEM:
.FACILITY
PROG,1 /PREFIX=PROG__
.SEVERITY
FATAL
.BASE
100
FAIGETMEM
<failed to get !UL bytes of memory>/FAO_COUNT=1
.END
This source file sets up the exception message as follows:
•
The .FACILITY directive specifies the facility, PROG, and its number, 1. It
also adds the /PREFIX qualifier to determine the prefix to be used in the
message.
9–54 Condition-Handling Routines and Services