1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 salv_err_msg: proc (a_severity);
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 dcl a_severity fixed bin;
47 dcl a_path char (*);
48 dcl arg_msg_ptr ptr unal;
49
50
51
52 dcl severity fixed bin;
53 dcl syserr_severity fixed bin;
54 dcl code fixed bin (35);
55 dcl have_code bit (1) aligned;
56 dcl path char (170);
57 dcl line_len fixed bin;
58 dcl line char (303);
59 dcl start fixed bin;
60 dcl msg_ptr ptr unal;
61 dcl msg_len fixed bin;
62
63 dcl (addr, length, substr, rtrim, min, ptr, rel, unspec) builtin;
64
65 dcl 1 et aligned based (msg_ptr),
66 2 len fixed bin (8) unal,
67 2 msg char (et.len) unal;
68
69
70
71 dcl error_table_$ fixed bin ext;
72 dcl syserr entry options (variable);
73 dcl formline_ entry (fixed bin, fixed bin, ptr, fixed bin, fixed bin);
74 dcl utility_print entry (fixed bin, char (*));
75
76
77
78 dcl COLON_NEW_LINE char (2) int static options (constant) init (":
79 ");
80 dcl NEW_LINE int static options (constant) char (1) init ("
81 ");
82
83
84
85 dcl sys_last_path char (170) int static init ("");
86
87
88 start = 2;
89 path = "";
90 have_code = "0"b;
91 goto START;
92
93
94 path: entry (a_severity, a_path);
95
96 start = 3;
97 path = a_path;
98 have_code = "0"b;
99 goto START;
100
101
102 code: entry (a_severity, a_path, arg_msg_ptr);
103
104 start = 4;
105 path = a_path;
106 have_code = (unspec (arg_msg_ptr) ^= "0"b);
107 goto START;
108
109 START:
110
111
112
113 severity = a_severity;
114 line_len = length (line);
115 call formline_ (start, start + 1, addr (line), line_len, (0));
116
117
118
119 if have_code then do;
120 msg_ptr = arg_msg_ptr;
121 if baseno (msg_ptr) = "007777"b3 then msg_ptr = ptr (addr (error_table_$), rel (msg_ptr));
122 msg_len = length (line) - line_len;
123 if msg_len > 0 then do;
124 substr (line, line_len + 1, msg_len) = et.msg;
125 line_len = line_len + et.len;
126 end;
127 end;
128 line_len = min (line_len + 1, length (line));
129 substr (line, line_len, 1) = NEW_LINE;
130
131 if path ^= "" then path = rtrim (path) || COLON_NEW_LINE;
132
133
134
135 if severity < 0 then severity = 0;
136 if severity > 6 then severity = 6;
137 if salv_data$rpv then if severity < 4 then severity = 2;
138
139 go to SALV_SEVERITY (severity);
140
141 SALV_SEVERITY (1):
142 syserr_severity = CRASH;
143 go to SYSERR;
144 SALV_SEVERITY (3):
145 SALV_SEVERITY (0):
146 SALV_SEVERITY (2):
147 syserr_severity = ANNOUNCE;
148 go to SYSERR;
149 SALV_SEVERITY (4):
150 SALV_SEVERITY (5):
151 syserr_severity = LOG;
152 go to SYSERR;
153 SALV_SEVERITY (6):
154 syserr_severity = JUST_LOG;
155
156 SYSERR:
157 if path ^= "" & path ^= sys_last_path then do;
158 call syserr (syserr_severity, "^a^a", path, substr (line, 1, line_len - 1));
159 sys_last_path = path;
160 end;
161 else call syserr (syserr_severity, substr (line, 1, line_len - 1));
162
163 return;
164
165 %page; %include salv_data;
166 %page; %include syserr_constants;
167
168 end salv_err_msg;