Skip to main content

ironwork_syntax/
messages.rs

1//! ironwork's message catalogue: each compile-time message's id, the severity it is given and its
2//! text, the parts a site fills in between braces. docs/messages.md is written from it. Once
3//! released, an id keeps its meaning and is never given to another message; its wording may change.
4
5use crate::{Error, Pos, Severity};
6
7/// Why something is refused before its place is known: the catalogue's message and its text.
8pub type Refused = (Message, String);
9
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub struct Message {
12    pub id: &'static str,
13    pub severity: Severity,
14    pub text: &'static str,
15}
16
17impl Message {
18    /// The message at `pos`, its text as the site words it.
19    pub fn at(&self, pos: Pos, text: impl Into<String>) -> Error {
20        Error { id: Some(self.id), ..Error::at(pos, text).graded(self.severity) }
21    }
22}
23
24/// The area an id's third letter names.
25pub const AREAS: &[(char, &str)] = &[
26    ('S', "Source form, lexing, COPY and REPLACE, and syntax"),
27    ('C', "Enterprise COBOL's compile rules"),
28    ('O', "CBL and PROCESS options, and compiler flags"),
29    ('P', "EXEC SQL, EXEC CICS, EXEC DLI, BMS and CSD"),
30    ('R', "An Enterprise COBOL construct ironwork does not run yet, refused by name"),
31    ('L', "ironwork's own limits"),
32    ('X', "An extension `--compliance extended` reads (docs/compliance.md)"),
33    ('J', "JCL a job run refuses"),
34];
35
36macro_rules! catalogue {
37    ($($id:ident $severity:ident $text:literal;)*) => {
38        $(pub const $id: Message = Message { id: stringify!($id), severity: Severity::$severity, text: $text };)*
39        /// Every message, in id order.
40        pub const CATALOGUE: &[Message] = &[$($id),*];
41    };
42}
43
44catalogue! {
45    IWC0001 Severe "{name} is not defined";
46    IWC0002 Severe "{name} is ambiguous; qualify it with OF or IN";
47    IWC0003 Severe "no paragraph or section named {name}";
48    IWC0004 Severe "{name} names more than one paragraph; qualify it with OF and its section";
49    IWC0005 Severe "CLASS {clause}: {message}";
50    IWC0006 Severe "{verb} CORRESPONDING {name}: {why}";
51    IWC0007 Severe "CORRESPONDING {group ref}: {name} in it cannot be named uniquely";
52    IWC0008 Severe "USE AFTER EXCEPTION/ERROR ON {name}: {why}";
53    IWC0009 Severe "USE AFTER EXCEPTION/ERROR ON {mode}: another procedure is for the same open mode";
54    IWC0010 Severe "USE FOR DEBUGGING is not allowed in a program compiled with THREAD";
55    IWC0011 Severe "USE FOR DEBUGGING ON ALL PROCEDURES: it may be written once, and no other USE FOR DEBUGGING may name a procedure";
56    IWC0012 Severe "USE FOR DEBUGGING ON {name}: {why}";
57    IWC0013 Severe "{name}: a debugging section may refer only to declarative procedures";
58    IWC0014 Severe "{name}: only a debugging section may refer to a procedure in a debugging section";
59    IWC0015 Severe "PERFORM ... THRU: a declarative procedure and the other end of the range must be in the same declarative section";
60    IWC0016 Severe "FUNCTION-ID {name}: {name} is not an 01 or 77 item of the LINKAGE SECTION";
61    IWC0017 Severe "FUNCTION-ID {name}: a user-defined function needs PROCEDURE DIVISION RETURNING";
62    IWC0018 Severe "EXEC {kind}: SQL and CICS cannot be used with user-defined functions, so neither in one nor in a program after one in its source (assumption C273)";
63    IWC0019 Severe "PROCEDURE DIVISION USING BY VALUE {file}: a function's BY VALUE parameter is binary, floating-point, a pointer, or one alphanumeric or national character";
64    IWC0020 Severe "FUNCTION-ID {id}: {why} from the prototype at line {line}";
65    IWC0021 Severe "FUNCTION {name} takes {params} arguments, not {args}";
66    IWC0022 Severe "FUNCTION {name}: a user-defined function's argument is an identifier, a literal or an arithmetic expression";
67    IWC0023 Severe "FUNCTION {name}: only an alphanumeric or national function's value can be reference-modified";
68    IWC0024 Severe "FUNCTION {name} argument {k}: a function's argument is not a figurative constant";
69    IWC0025 Severe "FUNCTION {name} argument {k}: {formal} is numeric, and takes an argument COMPUTE could send it (assumption C272)";
70    IWC0026 Severe "FUNCTION {name} argument {k} ({name}): {why}";
71    IWC0027 Severe "OCCURS at level {level}: Enterprise COBOL takes OCCURS only at levels 02 to 49";
72    IWC0028 Severe "a level-88 entry after a level-66 entry: a RENAMES item cannot be a conditional variable";
73    IWC0029 Severe "a level-88 entry with no item before it";
74    IWC0030 Severe "a level-88 entry needs a name";
75    IWC0031 Severe "RENAMES goes with level 66, and level 66 with RENAMES";
76    IWC0032 Severe "a level-66 entry must follow the entries of a level-01 record";
77    IWC0033 Severe "a level-66 entry has a name and a RENAMES clause, and nothing else";
78    IWC0034 Severe "level {level} is not a data level";
79    IWC0035 Severe "level {level} after a level-66 entry: a record's RENAMES entries follow its last entry";
80    IWC0036 Severe "level {level} with no group to belong to";
81    IWC0037 Severe "REDEFINES {target}: no earlier 01-level item of that name";
82    IWC0038 Severe "OCCURS 0 is not a table";
83    IWC0039 Severe "RENAMES {name}: {message}";
84    IWC0040 Severe "RENAMES {first}: a level-66 entry cannot rename a level-01 record";
85    IWC0041 Severe "RENAMES {first} THRU {last}: the last item cannot be within the first";
86    IWC0042 Severe "RENAMES {first} THRU {last}: the last item must start and end no earlier than the first";
87    IWC0043 Severe "RENAMES {first} THRU {last}: no OCCURS DEPENDING ON between them";
88    IWC0044 Severe "REDEFINES {target}: no earlier item of that name at this level";
89    IWC0045 Severe "a SYNCHRONIZED item at the start of a REDEFINES would need {slack} slack bytes: the redefined item must be on a {message}-byte boundary";
90    IWC0046 Severe "{clause} names {name}, which is not a file";
91    IWC0048 Severe "OCCURS DEPENDING ON {object}: the object cannot follow an OCCURS DEPENDING ON table in its record";
92    IWC0049 Severe "OCCURS DEPENDING ON {object}: not a numeric data item";
93    IWC0050 Severe "PROCEDURE DIVISION USING {param}: not an 01 or 77 item of the LINKAGE SECTION";
94    IWC0051 Severe "PROCEDURE DIVISION RETURNING {name}: not an 01 or 77 item of the LINKAGE SECTION";
95    IWC0052 Severe "ASSIGN USING or DYNAMIC {name}: a Micro Focus and GnuCOBOL form; --compliance extended reads it";
96    IWC0053 Severe "ASSIGN {name}: not a data item";
97    IWC0054 Severe "ASSIGN {name}: the item holding the file's name must be alphanumeric or a group";
98    IWC0055 Warning "no STOP RUN, GOBACK or EXIT PROGRAM in the program: check that it ends";
99    IWC0056 Warning "CALL 'CEECBLDY' under INTDATE(LILIAN): CEECBLDY gives an ANSI integer date, which nothing can use under LILIAN, so the CALL is to CEEDAYS";
100    IWC0057 Severe "ENTRY '{item}': a program with PROCEDURE DIVISION RETURNING cannot have ENTRY statements";
101    IWC0058 Severe "ENTRY '{item}': the name is already the program's or another ENTRY's";
102    IWC0059 Severe "ENTRY '{item}' USING {param}: not an 01 or 77 item of the LINKAGE SECTION";
103    IWC0060 Severe "ENTRY '{name}' must be a sentence of its own, not inside another statement";
104    IWC0061 Severe "a GO TO with no procedure-name cannot be used in {why}";
105    IWC0062 Severe "a GO TO with no procedure-name must be its paragraph's only sentence";
106    IWC0063 Severe "ALTER cannot be used in {why}";
107    IWC0064 Severe "ALTER {name}: a section, where ALTER names a paragraph";
108    IWC0065 Severe "ALTER {name}: the paragraph must hold one sentence, a GO TO without DEPENDING ON";
109    IWC0066 Severe "{name}: a DBCS item's VALUE is a DBCS literal of at most {size} characters, SPACE or ALL with a DBCS literal";
110    IWC0067 Severe "{name}: a DBCS literal can be the VALUE of a DBCS item only";
111    IWC0068 Severe "VALUE of {name}: {what}, where a numeric item's VALUE literal must be numeric";
112    IWC0069 Severe "PICTURE {name}: {positions} digit positions, more than the {max} {option} allows";
113    IWC0070 Severe "the literal {t} has more than the {max} digits {option} allows";
114    IWC0071 Severe "a condition as the WHEN object of a value subject";
115    IWC0072 Severe "a value as the WHEN object of a TRUE, FALSE or condition subject";
116    IWC0073 Severe "DISPLAY UPON {upon}: {why}";
117    IWC0074 Severe "CLOSE {name}: REEL, UNIT and NO REWIND are not valid for an indexed or relative file";
118    IWC0075 Severe "{verb} {record}: not a record of a file";
119    IWC0076 Severe "START KEY takes =, >, NOT < or >=";
120    IWC0077 Severe "INITIALIZE {name}: a level-66 RENAMES item cannot be initialized";
121    IWC0078 Severe "INITIALIZE {name}: a variably located item, or a group holding one, cannot be initialized (Language Reference p. 351)";
122    IWC0079 Severe "SET {name} TO FALSE: the condition-name has no WHEN SET TO FALSE value";
123    IWC0080 Severe "{exit} must be inside an inline PERFORM";
124    IWC0081 Severe "PERFORM VARYING {var}: not a numeric elementary item or an index-name";
125    IWC0082 Severe "PERFORM VARYING {var} {phrase}: an arithmetic expression, where {phrase} takes an identifier, index-name or literal";
126    IWC0083 Severe "no file named {name}";
127    IWC0084 Severe "{verb} {name}: not an indexed or relative file";
128    IWC0085 Severe "{verb} {name}: the file's ACCESS MODE is RANDOM";
129    IWC0086 Severe "class-name {name} tests a data item, not an expression";
130    IWC0087 Severe "class-name {name} tests a data item of USAGE DISPLAY, and {name} is not one";
131    IWC0088 Severe "{key}: not a key of {file}";
132    IWC0089 Severe "{file}: an indexed file needs a RECORD KEY";
133    IWC0090 Severe "{name}: a key of {file} must be in its records";
134    IWC0091 Severe "{name}: the RELATIVE KEY of {file} must not be in its records";
135    IWC0092 Severe "{file}: random or dynamic access needs a RELATIVE KEY";
136    IWC0093 Severe "{name}: the DEPENDING ON item of {file} must be an elementary unsigned integer";
137    IWC0094 Severe "{name}: the PASSWORD of {file} must be an alphabetic, alphanumeric or alphanumeric-edited item of WORKING-STORAGE";
138    IWC0095 Severe "{name} is a condition-name, not a data item";
139    IWC0096 Severe "{name}: only a debugging section may reference DEBUG-ITEM";
140    IWC0097 Severe "{name} takes {dims} subscripts, not {subscripts}";
141    IWC0098 Warning "INITIALIZE {name}: none of its items is of a category REPLACING names ({categories}), so it is not initialized";
142    IWC0099 Severe "INSPECT FUNCTION {name}: an integer or numeric function can be used only where an arithmetic expression can, not as the inspected item";
143    IWC0100 Severe "INSPECT FUNCTION {name} {phrase}: {phrase} stores into the inspected item, and a function-identifier cannot be a receiving operand";
144    IWC0101 Severe "DISPLAY FUNCTION {name}: an integer or numeric function can be used only where an arithmetic expression can, and DISPLAY takes none";
145    IWC0102 Severe "MOVE FUNCTION {name}: an integer or numeric function can be used only where an arithmetic expression can, not as a MOVE's sender";
146    IWC0103 Severe "INSPECT {name}: {operand} cannot be an operand here, since {why}";
147    IWC0104 Severe "SEARCH {table} VARYING {value}: not an index-name, an index data item or an elementary integer item";
148    IWC0105 Severe "the literal {t} has more than {min} digits";
149    IWC0106 Severe "FUNCTION {file}: neither an intrinsic function nor a user-defined function defined or prototyped before this program";
150    IWC0107 Severe "FUNCTION {file}: a user-defined function is not supported here yet";
151    IWC0108 Severe "WRITE ... END-OF-PAGE: the FD of {file} has no LINAGE clause";
152    IWC0109 Severe "LINAGE-COUNTER can be read, but no statement can change it";
153    IWC0110 Severe "NUMCHECK: {name} {why} wherever this statement reads it: its VALUE clauses give it X'{hex}' and no statement changes it, so the test is removed (see {NUMCHECK ALWAYS FAILS})";
154    IWC0111 Warning "NORENT conflicts with {and}, which IBM compiles only as RENT (see {OO OPTIONS REQUIRED})";
155    IWC0112 Warning "{who} uses object-oriented syntax, which IBM compiles only with THREAD, DLL, RENT and DBCS: {missing} missing from its CBL or PROCESS cards (see {OO OPTIONS REQUIRED} and {OO OPTIONS SEVERITY})";
156    IWC0113 Warning "INITIAL conflicts with THREAD, which IBM compiles only as NOINITIAL (see {INITIAL UNDER THREAD})";
157    IWC0114 Severe "{who} is compiled with THREAD, which requires RECURSIVE in its PROGRAM-ID paragraph";
158    IWC0115 Severe "{who} is INITIAL, which THREAD does not allow";
159    IWC0116 Severe "{who} contains program {inner}, and THREAD does not allow nested programs";
160    IWC0117 Severe "{verb} is not allowed in a program compiled with THREAD";
161    IWC0118 Severe "not a class definition";
162    IWC0119 Severe "{inherits}: the class a class INHERITS must be named in its REPOSITORY paragraph";
163    IWC0120 Severe "class {def} cannot inherit from itself";
164    IWC0121 Severe "{factory} method \"{message}\" has the same parameter types as {factory} method \"{twin}\"";
165    IWC0122 Severe "method \"{name}\" receives {param} BY REFERENCE: a method's parameters are BY VALUE";
166    IWC0123 Severe "method \"{name}\" parameter {param}: {message}";
167    IWC0124 Severe "method \"{name}\" parameter {param}: not a record of the method's own LINKAGE SECTION";
168    IWC0125 Severe "SET ADDRESS OF {name}: FACTORY and OBJECT data is WORKING-STORAGE, not LINKAGE";
169    IWC0126 Severe "method \"{name}\" RETURNING {name}: {message}";
170    IWC0127 Severe "method \"{name}\" RETURNING {name}: not a record of the method's own LINKAGE SECTION";
171    IWC0128 Severe "OBJECT REFERENCE {character}: the class must be named in the REPOSITORY paragraph";
172    IWC0129 Severe "a class definition cannot contain EXEC statements";
173    IWC0130 Severe "EXIT METHOD can be used only in a method";
174    IWC0131 Severe "EXIT PROGRAM cannot be used in a method: use EXIT METHOD or GOBACK";
175    IWC0132 Severe "SELF can be used only in a method";
176    IWC0133 Severe "{name} is {what}: it can be used only in SET, INVOKE, CALL and a relation condition";
177    IWC0134 Severe "JNIENVPTR cannot receive a value";
178    IWC0135 Severe "SELF cannot receive a value";
179    IWC0136 Severe "object references and function-pointers compare only as equal or not equal";
180    IWC0137 Severe "an object reference compares with another object reference, SELF or NULL; a function-pointer with another or NULL";
181    IWC0138 Severe "SET {name} TO ENTRY: the receiver must be a procedure-pointer or function-pointer";
182    IWC0139 Severe "SET {names} TO ENTRY: {fault}";
183    IWC0140 Severe "SET {name} TO: {message}";
184    IWC0141 Severe "FUNCTION {file}: a figurative constant is an argument only inside an arithmetic expression";
185    IWC0142 Severe "FUNCTION {file}: {name} is a pointer or object reference, where an argument is alphabetic, alphanumeric, national or numeric";
186    IWC0143 Severe "{first} compared with {second}: an arithmetic expression or a numeric function is compared only with a numeric operand";
187    IWC0144 Severe "WRITE ... ADVANCING: {file} is not a sequential file";
188    IWC0145 Severe "WRITE ... BEFORE ADVANCING, or ADVANCING a mnemonic-name, is not allowed for the line-sequential file {file}";
189    IWC0146 Severe "report {name} is named in no FD's REPORT clause";
190    IWC0147 Severe "report {ri}: a line reaches column {end}, beyond the {width} bytes of the report file's record";
191    IWC0148 Severe "report {ri}: a line reaches column {end}, beyond LINE LIMIT {limit}";
192    IWC0149 Severe "a group entry in a report group cannot have COLUMN, PICTURE, SOURCE, VALUE or SUM";
193    IWC0150 Severe "a SUM entry needs a PICTURE";
194    IWC0151 Severe "a VALUE entry with a figurative constant or ALL needs a PICTURE";
195    IWC0152 Severe "a printed SOURCE entry needs a PICTURE";
196    IWC0153 Severe "a report entry with no SOURCE, VALUE or SUM needs a data-name for the program to fill it";
197    IWC0154 Severe "BLANK WHEN ZERO needs a numeric PICTURE";
198    IWC0155 Severe "a SUM entry needs a numeric PICTURE";
199    IWC0156 Severe "a COLUMN with no LINE above it";
200    IWC0157 Severe "a report field that starts left of column 1";
201    IWC0158 Severe "USE BEFORE REPORTING {group}: the program has no REPORT SECTION";
202    IWC0159 Severe "USE BEFORE REPORTING {group}: no report group has that name";
203    IWC0160 Severe "USE BEFORE REPORTING {group}: more than one report group has that name; qualify it with IN";
204    IWC0161 Severe "an arithmetic SOURCE, or ROUNDED, needs a numeric PICTURE";
205    IWC0162 Severe "an absolute LINE needs a PAGE LIMIT";
206    IWC0163 Severe "a report group whose first LINE is relative must have only relative LINEs";
207    IWC0164 Severe "absolute LINE numbers in a report group must increase";
208    IWC0165 Severe "NEXT PAGE needs a PAGE LIMIT";
209    IWC0166 Severe "a PAGE HEADING or PAGE FOOTING cannot begin on the NEXT PAGE";
210    IWC0167 Severe "report {name}: its report control area could not be laid out";
211    IWC0168 Severe "a CONTROL HEADING or FOOTING must name its control when the report has several";
212    IWC0169 Severe "a CONTROL HEADING or FOOTING names a control that is not in the report's CONTROL clause";
213    IWC0170 Severe "report {name} has two {kind} groups for the same level";
214    IWC0171 Severe "a PAGE HEADING or PAGE FOOTING needs a PAGE LIMIT";
215    IWC0172 Severe "NEXT GROUP with a line or NEXT PAGE needs a PAGE LIMIT";
216    IWC0173 Severe "NEXT GROUP is not allowed in a PAGE HEADING or REPORT FOOTING";
217    IWC0174 Severe "report {name} has no CONTROL HEADING, DETAIL or CONTROL FOOTING group";
218    IWC0175 Severe "RESET ON names a control that is not in the report's CONTROL clause";
219    IWC0176 Severe "SUM ... UPON {name}: not a DETAIL group of report {name}";
220    IWC0177 Severe "SUM {operand}: the entry summed must be numeric";
221    IWC0178 Severe "SUM {operand}: an entry the program fills itself cannot be summed";
222    IWC0179 Severe "SUM {operand}: not a numeric data item";
223    IWC0180 Severe "SUM entries of a report group total each other in a circle";
224    IWC0181 Severe "HEADING, FIRST DETAIL, LAST DETAIL and FOOTING need a PAGE LIMIT";
225    IWC0182 Severe "report {name}: the page regions must run HEADING <= FIRST DETAIL <= LAST DETAIL <= FOOTING <= PAGE LIMIT";
226    IWC0183 Severe "{number} is not a report of this program";
227    IWC0184 Severe "GENERATE {name}: summary reporting needs a CONTROL HEADING or CONTROL FOOTING group";
228    IWC0185 Severe "GENERATE {name}: not a DETAIL group";
229    IWC0186 Severe "GENERATE {name}: no report or DETAIL group of that name";
230    IWC0187 Severe "GENERATE {name}: more than one report has a DETAIL group of that name; qualify it with IN";
231    IWC0188 Severe "{name} is a reserved word, so it cannot name {what}";
232    IWC0189 Severe "{name}: EXTERNAL is not allowed in the {section} SECTION";
233    IWC0190 Severe "{name}: EXTERNAL goes on a level-01 entry";
234    IWC0191 Severe "{name}: EXTERNAL and REDEFINES cannot be in the same entry";
235    IWC0192 Severe "an EXTERNAL record needs a data-name, not FILLER";
236    IWC0193 Severe "{name}: another EXTERNAL record of the program has the same name";
237    IWC0194 Severe "{name}: GLOBAL goes on a level-01 entry";
238    IWC0195 Severe "a GLOBAL record needs a data-name, not FILLER";
239    IWC0196 Severe "{name}: another GLOBAL record of the DATA DIVISION has the same name";
240    IWC0197 Severe "{name}: an item of EXTERNAL record {name} takes no VALUE clause";
241    IWC0198 Severe "FD {file}: a record of an EXTERNAL or GLOBAL file needs a data-name, not FILLER";
242    IWC0199 Severe "{item}: {size} bytes, larger than the EXTERNAL record {name} it redefines";
243    IWC0200 Severe "SET ADDRESS OF {name}: an EXTERNAL or GLOBAL record is not a LINKAGE record of the program";
244    IWC0201 Severe "RELEASE {record}: not a record of a sort file (SD)";
245    IWC0202 Severe "no file named {file}";
246    IWC0203 Severe "RETURN {file}: not a sort or merge file (SD)";
247    IWC0204 Severe "COLLATING SEQUENCE {alphabet}: not an alphabet-name of SPECIAL-NAMES";
248    IWC0205 Severe "SET {name} TO {OFF}: {name} is not the mnemonic-name of an UPSI switch";
249    IWC0206 Severe "{name} is the mnemonic-name of UPSI-{number}: only SET ... TO ON or OFF and a condition-name's qualifier can name it";
250    IWC0207 Severe "SET {name} TO TRUE: the UPSI switch's entry has no mnemonic-name, which would be its conditional variable";
251    IWC0208 Severe "{verb} {name}: not a sort or merge file (SD)";
252    IWC0209 Severe "{verb} {name}: no ASCENDING or DESCENDING KEY";
253    IWC0210 Severe "{verb} {name}: KEY needs a data name";
254    IWC0211 Severe "{key}: a key of {verb} {name} must be in its records";
255    IWC0212 Severe "{key}: a sort key cannot be in a table";
256    IWC0213 Severe "{key}: a sort key cannot follow an OCCURS DEPENDING ON table in its record";
257    IWC0214 Severe "{key}: a POINTER, INDEX, object reference or function-pointer item cannot be a sort key";
258    IWC0215 Severe "{verb} {name}: no {phrase} or {procedure}";
259    IWC0216 Severe "{phrase} {file}: a sort or merge file (SD) cannot be one";
260    IWC0217 Severe "{phrase} {file}: the file's ACCESS MODE is RANDOM";
261    IWC0218 Severe "MERGE {name}: USING names at least two files";
262    IWC0219 Severe "MERGE {name}: not a merge file (SD)";
263    IWC0220 Severe "SORT {name}: a table SORT takes no USING, GIVING or procedures";
264    IWC0221 Severe "SORT {name}: not a table";
265    IWC0222 Severe "no file or table named {name}";
266    IWC0223 Severe "SORT {name}: not a table (no OCCURS)";
267    IWC0224 Severe "SORT {name}: a subscript for each table that contains it, and none for itself";
268    IWC0225 Severe "SORT {name}: no KEY phrase, and its OCCURS has none";
269    IWC0226 Severe "{key}: a key of SORT {name} must be its element or an item within it";
270    IWC0227 Severe "{key}: a table SORT key cannot be in a table within the element";
271    IWC0228 Severe "{file}: LINAGE is for a sequential file, not a line-sequential one";
272    IWC0229 Severe "{file}: LINAGE is for a sequential file, not an indexed or relative one";
273    IWC0230 Severe "{file}: {phrase} {number} is more than the {MOST} lines LINAGE allows";
274    IWC0231 Severe "{file}: {phrase} {name} is not an unsigned integer data item";
275    IWC0232 Severe "{file}: LINAGE 0: the page body needs at least one line";
276    IWC0233 Severe "{file}: FOOTING 0: the footing starts at line 1 or later";
277    IWC0234 Severe "{file}: FOOTING {footing} is past the page body of {body} lines";
278    IWC0235 Severe "an elementary item needs a PICTURE";
279    IWC0236 Severe "a group item cannot have a PICTURE";
280    IWC0237 Severe "an object reference, function-pointer or procedure-pointer takes no PICTURE and only VALUE NULL";
281    IWC0238 Severe "POINTER and INDEX items take no PICTURE";
282    IWC0239 Severe "COMP-1 and COMP-2 items take no PICTURE";
283    IWC0240 Severe "BLANK WHEN ZERO needs a numeric or numeric-edited item of USAGE DISPLAY or NATIONAL";
284    IWC0241 Severe "a binary item holds at most 18 digits";
285    IWC0242 Severe "JUSTIFIED cannot be given for a DBCS item whose PICTURE has B";
286    IWC0243 Severe "a PICTURE with G needs USAGE DISPLAY-1 (Language Reference SC27-8713-03, p. 214)";
287    IWC0244 Severe "a SIGN clause needs an S in the PICTURE";
288    IWC0245 Severe "INVOKE {target}: SELF and SUPER can be used only in a method";
289    IWC0246 Severe "INVOKE {target}: not an object reference or a class named in the REPOSITORY paragraph";
290    IWC0247 Severe "INVOKE {target} NEW: NEW takes a class-name from the REPOSITORY paragraph";
291    IWC0248 Severe "INVOKE ... NEW needs RETURNING an object reference";
292    IWC0249 Severe "INVOKE ... NEW RETURNING {name}: not an object reference";
293    IWC0250 Severe "INVOKE with an empty method name";
294    IWC0251 Severe "INVOKE ... {name}: a method name is held in an alphanumeric or national item";
295    IWC0252 Severe "INVOKE {target} {name}: a method named by a data item is invoked on a universal object reference";
296    IWC0253 Severe "INVOKE argument: {message}";
297    IWC0254 Severe "INVOKE ... RETURNING {name}: not reference-modified";
298    IWC0255 Severe "INVOKE ... RETURNING {name}: {message}";
299    IWC0256 Severe "ACCEPT ... ON EXCEPTION: of the ACCEPT statements, only ACCEPT ... FROM ARGUMENT-VALUE under --compliance extended has an exception";
300    IWC0257 Severe "ACCEPT ... FROM {name}: Micro Focus's and GnuCOBOL's, not Enterprise COBOL's; --compliance extended reads it from the job step's PARM";
301    IWC0258 Severe "DISPLAY UPON ARGUMENT-NUMBER: Micro Focus's and GnuCOBOL's, not Enterprise COBOL's; --compliance extended reads it";
302    IWC0259 Severe "DISPLAY UPON ARGUMENT-NUMBER: it shows one numeric item or literal, the number of the argument the next ACCEPT ... FROM ARGUMENT-VALUE takes";
303    IWC0260 Severe "PICTURE {picture}: P must be one string of scaling positions at the left or right end of the digits";
304    IWC0261 Severe "PICTURE {picture}: {character} is not a PICTURE symbol";
305    IWC0262 Severe "PICTURE {picture}: more than 134217727 character positions";
306    IWC0263 Severe "PICTURE {picture}: more than 31 digits";
307    IWC0264 Severe "PICTURE {picture}: mixes symbols of different categories";
308    IWC0265 Severe "PICTURE {picture}: {character} cannot be in a PICTURE of {symbol}, which takes {symbol} and B only";
309    IWC0266 Severe "PICTURE {picture}: more character positions than a DBCS item holds";
310    IWC0267 Severe "BLANK WHEN ZERO cannot be given for a PICTURE with S";
311    IWC0268 Severe "PICTURE {picture}: an edited PICTURE longer than 4096 positions";
312    IWC0269 Severe "PICTURE {picture}: S and N are not allowed in an edited PICTURE";
313    IWC0270 Severe "PICTURE {picture}: an alphanumeric-edited PICTURE takes only X, A, 9, B, 0 and /";
314    IWC0271 Severe "PICTURE {picture}: two floating insertion strings";
315    IWC0272 Severe "PICTURE {picture}: {character} is not a numeric-edited symbol";
316    IWC0273 Severe "PICTURE {picture}: more than one decimal point";
317    IWC0274 Severe "PICTURE {picture}: a numeric-edited PICTURE needs 1 to 31 digit positions";
318    IWC0275 Severe "PICTURE {picture}: bad repetition ({count})";
319    IWC0276 Severe "PICTURE {picture}: a repetition with nothing to repeat";
320    IWC0277 Severe "PICTURE {picture}: two different currency symbols";
321    IWC0278 Severe "PICTURE {picture}: '$' is not a currency symbol of this program, whose CURRENCY SIGN clauses or CURRENCY option name others";
322    IWC0279 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: not an alphabet-name of SPECIAL-NAMES";
323    IWC0280 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: the character X'{hex}' is given more than one position";
324    IWC0281 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: {number} is not an ordinal position from 1 to 256";
325    IWC0282 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: NULL cannot be in an ALPHABET clause";
326    IWC0283 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: a national literal cannot be in an ALPHABET clause";
327    IWC0284 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: a DBCS literal cannot be in an ALPHABET clause";
328    IWC0285 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: ALL cannot be in an ALPHABET clause";
329    IWC0286 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: a literal of THROUGH or ALSO must be one character";
330    IWC0287 Severe "FUNCTION {name}: an ALL subscript stands for a varying number of arguments, and {name} takes {count}";
331    IWC0288 Severe "FUNCTION {name}: {class} and {class} arguments, where all must be of the same class";
332    IWC0289 Warning "INITCHECK(STRICT): {item} may be used uninitialized: a path to this statement does not set {it} (see {analysis})";
333    IWC0290 Warning "INITCHECK: {item} may be used uninitialized: no path to this statement sets {it} (see {analysis})";
334    IWC0291 Severe "{ALPHABET or PROGRAM COLLATING SEQUENCE and its name}: {a character the program's code page does not hold}";
335    IWL0001 Severe "lowering: {table} exceeds the LIR's limit";
336    IWL0002 Severe "lowering: the lowered program is invalid: {why}";
337    IWL0003 Severe "LOCAL-STORAGE exceeds the interpreter's {MAX STORAGE} bytes";
338    IWL0004 Severe "storage exceeds the interpreter's {MAX STORAGE} bytes";
339    IWL0005 Severe "WORKING-STORAGE exceeds the interpreter's {MAX STORAGE} bytes";
340    IWL0006 Severe "an item larger than the interpreter's {MAX STORAGE} bytes";
341    IWO0001 Severe "CBL {option}: {why}";
342    IWO0002 Error "CBL CURRENCY: code page {codepage} reads its byte as {character}, which cannot be a currency symbol";
343    IWO0003 Warning "CBL NODBCS: NSYMBOL(NATIONAL) requires DBCS, which is in effect";
344    IWO0004 Severe "SOURCE_DATE_EPOCH={value}: not a whole number of seconds from 0 to 253402300799";
345    IWO0005 Severe "{a flag this compiler does not take}";
346    IWP0001 Severe "no mapset {to ascii uppercase} among the {sets} in the file";
347    IWP0002 Informational "IGYPS2091-W not given: the program ends with EXEC CICS {command}, which the CICS translator turns into a CALL; --cics-return-warning=always gives the warning, =never drops this note";
348    IWP0003 Severe "EXEC SQL {command}: {why}";
349    IWP0004 Severe "EXEC DLI {command} is not an EXEC DLI command";
350    IWP0005 Severe "EXEC DLI {command}: {name} is not one of its options";
351    IWP0006 Severe "EXEC DLI {command} WHERE({t}): {why}";
352    IWP0007 Severe "EXEC CICS {command} {option}({label}): {message}";
353    IWP0008 Severe "a program that uses object-oriented syntax cannot contain EXEC CICS";
354    IWP0009 Severe "a continuation line is missing";
355    IWP0010 Severe "a label with no macro";
356    IWP0011 Severe "a quoted string is not closed";
357    IWP0012 Severe "a parenthesised list is not closed";
358    IWP0013 Severe "{key} takes one value";
359    IWP0014 Severe "{key} takes a quoted string";
360    IWP0015 Severe "{key}={word} is not a number from {low} to {high}";
361    IWP0016 Severe "{key}={word}: YES or NO";
362    IWP0017 Severe "DSATTS={a} is not an extended attribute";
363    IWP0018 Severe "EXTATT={word}: NO, MAPONLY or YES";
364    IWP0019 Severe "DFHMSD TYPE=FINAL with no mapset open";
365    IWP0020 Severe "DFHMDI outside a DFHMSD";
366    IWP0021 Severe "DFHMDF outside a DFHMDI map";
367    IWP0022 Severe "unknown macro {word}";
368    IWP0023 Severe "{what} needs a name";
369    IWP0024 Severe "{what} name {name} is longer than {max} characters";
370    IWP0025 Severe "TYPE={t}: DSECT, MAP, FINAL or &SYSPARM";
371    IWP0026 Severe "MODE={word}: IN, OUT or INOUT";
372    IWP0027 Severe "SIZE=(lines,columns), each 1 to 240";
373    IWP0028 Severe "{key}={word} is not a number from 1 to 240";
374    IWP0029 Severe "ATTRB={word} is not an attribute";
375    IWP0030 Severe "XINIT takes an even number of hexadecimal digits";
376    IWP0031 Severe "XINIT takes hexadecimal digits";
377    IWP0032 Severe "GRPNAME needs a labelled field and does not go with OCCURS";
378    IWP0033 Severe "GRPNAME is longer than 30 characters";
379    IWP0034 Severe "LENGTH=0 is allowed only on an unlabelled field, where it delimits an input field";
380    IWP0035 Severe "LENGTH is missing, or is not from 1 to 256";
381    IWP0036 Severe "JUSTIFY={word}: LEFT or RIGHT, BLANK or ZERO";
382    IWP0037 Severe "COLOR={character} is not a colour";
383    IWP0038 Severe "HILIGHT={h} is not a highlight";
384    IWP0039 Severe "POS is an offset within the map, or (line,column) inside it";
385    IWP0040 Severe "unbalanced '(' in DEFINE";
386    IWP0041 Severe "DEFINE names no KIND(NAME)";
387    IWP0042 Severe "{kind}({name}): a {kind} name is at most {limit} characters";
388    IWP0043 Severe "attribute value for '{key}' exceeds 256 characters";
389    IWP0044 Severe "unbalanced '(' in attribute value";
390    IWP0045 Severe "{why the BMS source cannot be read}";
391    IWP0046 Severe "EXEC SQL {command}: {name} in the INTO list has no colon, which Db2 requires before every host variable";
392    IWR0001 Severe "XML PARSE VALIDATING WITH {schema}: the schema is in IBM's Optimized Schema Representation (OSR), which ironwork does not read";
393    IWR0002 Severe "{verb} is not a statement ironwork for COBOL supports yet";
394    IWR0003 Severe "{clause} is not a data description clause ironwork for COBOL supports yet";
395    IWR0004 Severe "USAGE {usage} is not supported yet";
396    IWR0005 Severe "VALUE {literal}: a floating-point VALUE of more than 31 digits in fixed point is not supported yet";
397    IWR0006 Severe "the {section} SECTION is not supported yet";
398    IWR0007 Severe "ORGANIZATION {organization} is not supported yet";
399    IWR0008 Severe "{clause} is not a SELECT clause ironwork for COBOL supports yet";
400    IWR0009 Severe "INDEXED BY in FACTORY or OBJECT data is not supported yet";
401    IWR0010 Severe "{item}: EXTERNAL in FACTORY or OBJECT WORKING-STORAGE is not supported yet";
402    IWR0011 Severe "a method's FILE SECTION can define only EXTERNAL files, which ironwork for COBOL does not support yet";
403    IWR0012 Severe "items after an OCCURS DEPENDING ON table in the same record are not supported yet";
404    IWR0013 Severe "ADVANCING {mnemonic}: stacker selection ({environment}) on a card punch is not supported yet";
405    IWR0014 Severe "WRITE ... ADVANCING {mnemonic} on {file}, whose FD has LINAGE, is not supported yet";
406    IWR0015 Severe "{item}: INDEXED BY in a GLOBAL record, in a program that contains others, is not supported yet";
407    IWR0016 Severe "FD {file}: LINAGE on an EXTERNAL file is not supported yet";
408    IWR0017 Severe "FD {file}: REPORT on an EXTERNAL file is not supported yet";
409    IWR0018 Severe "FD {file}: LINAGE or REPORT on a GLOBAL file, in a program that contains others, is not supported yet";
410    IWR0019 Severe "{item}: a GLOBAL record of FD {file}, which is not GLOBAL, in a program that contains others, is not supported yet";
411    IWR0020 Severe "{file}, a GLOBAL file of {declarer}: its {clause} {item} is not a GLOBAL name of {declarer}, which is not supported yet";
412    IWR0021 Severe "SET ADDRESS OF {record}, a GLOBAL LINKAGE record of {program}, in a program it contains is not supported yet";
413    IWR0022 Severe "ASSIGN {item}: a file SORT or MERGE reads, writes or describes taking its name from a data item is not supported yet";
414    IWR0023 Severe "USE GLOBAL BEFORE REPORTING {group} for a report group of a contained program is not supported yet";
415    IWR0024 Severe "report {report} in more than one FD (INITIATE ... UPON) is not supported yet";
416    IWR0025 Severe "NEXT PAGE on a LINE other than a group's first (MULTIPLE PAGE) is not supported yet";
417    IWR0026 Severe "CONTROL {control}: a subscripted or reference-modified control is not supported yet";
418    IWR0027 Severe "GROUP INDICATE outside a DETAIL group is not supported yet";
419    IWR0028 Severe "a SUM of an entry in another report is not supported yet";
420    IWR0029 Severe "REPORTS ARE ALL is not supported yet";
421    IWR0030 Severe "INITIATE ... UPON is not supported yet";
422    IWR0031 Severe "a GLOBAL report is not supported yet";
423    IWR0032 Severe "CODE with a mnemonic-name or an identifier is not supported yet";
424    IWR0033 Severe "LAST DETAIL with an identifier is not supported yet";
425    IWR0034 Severe "LINE LIMIT with an identifier is not supported yet";
426    IWR0035 Severe "the {clause} clause of an RD is not supported yet";
427    IWR0036 Severe "{clause} is not an RD clause ironwork for COBOL supports yet";
428    IWR0037 Severe "a level-{level} entry in the REPORT SECTION is not supported yet";
429    IWR0038 Severe "multiple SOURCES is not supported yet";
430    IWR0039 Severe "multiple VALUES is not supported yet";
431    IWR0040 Severe "GROUP LIMIT is not supported yet";
432    IWR0041 Severe "USAGE {usage} in a report group is not supported yet";
433    IWR0042 Severe "{a report group clause ironwork does not run} is not supported yet";
434    IWR0043 Severe "{clause} is not a report group clause ironwork for COBOL supports yet";
435    IWR0044 Severe "an entry with more than one SOURCE, VALUE or SUM (a multiple-choice entry) is not supported yet";
436    IWR0045 Severe "a SUM or COUNT term in a SOURCE expression is not supported yet";
437    IWR0046 Severe "CONTROL FOOTING FOR ALL is not supported yet";
438    IWR0047 Severe "CONTROL HEADING ... OR PAGE is not supported yet";
439    IWR0048 Severe "a CONTROL FOOTING for more than one control is not supported yet";
440    IWR0049 Severe "multiple LINES is not supported yet";
441    IWR0050 Severe "multiple COLUMNS is not supported yet";
442    IWR0051 Severe "SUM of an arithmetic expression is not supported yet";
443    IWR0052 Severe "lowering: {construct} is not lowered yet";
444    IWR0053 Severe "{file}: LINAGE on a report file is not supported yet";
445    IWR0054 Severe "BLANK WHEN ZERO on a USAGE NATIONAL item is not supported yet";
446    IWR0055 Severe "a national-edited PICTURE is not supported yet";
447    IWR0056 Severe "a {category} PICTURE with USAGE {usage} is not supported yet";
448    IWS0001 Severe "{what the syntax takes there}, found {the word or token there}";
449    IWS0002 Severe "{COPY or a translator's INCLUDE} {name}: no such member in the copy libraries";
450    IWS0003 Severe "COPY: {message}";
451    IWS0004 Severe "COPY {text}: the name ends in a period; the period that ends a COPY statement is the one followed by a space";
452    IWS0005 Severe "{verb}: {message}";
453    IWS0006 Severe "{verb} {name}: {display}";
454    IWS0007 Severe "more than 65535 copy members";
455    IWS0008 Severe "{verb} {name}: copies itself, or nests deeper than {MAX DEPTH}";
456    IWS0009 Severe "REPLACE OFF: a period to end the statement";
457    IWS0010 Severe "REPLACE ALSO and REPLACE LAST OFF are the 2014 COBOL standard's; Enterprise COBOL has REPLACE pseudo-text BY pseudo-text and REPLACE OFF";
458    IWS0011 Severe "REPLACE: a period to end the statement";
459    IWS0012 Severe "COPY {display}: {item}";
460    IWS0013 Severe "& with no literal after it";
461    IWS0014 Severe "constant {name}: {why}";
462    IWS0015 Severe "BINARY-CHAR is a one-byte binary item, and ironwork's binary items are two, four or eight bytes, as Enterprise COBOL's are";
463    IWS0016 Severe "& joins two alphanumeric or hexadecimal literals, or two national literals, either of which may be a level-78 constant standing for one";
464    IWS0017 Severe "X'{text}' is not an even number of hex digits";
465    IWS0018 Severe "NX'{text}': a national hexadecimal literal is 4 to 320 hex digits, four to each UTF-16 code unit";
466    IWS0019 Severe "a sign must be followed by a number";
467    IWS0020 Severe "literal concatenation with & is not Enterprise COBOL's";
468    IWS0021 Severe "unexpected character {character}";
469    IWS0022 Severe "EXEC with no END-EXEC";
470    IWS0023 Severe "a DBCS literal holds 1 to {DBCS LITERAL MAX} characters, not {count}";
471    IWS0024 Severe "an unterminated literal";
472    IWS0025 Error "non-COBOL character {character}: the character was accepted";
473    IWS0026 Severe "unexpected '.'";
474    IWS0027 Severe "PICTURE with no character-string";
475    IWS0028 Severe "{file} has no SELECT ... ASSIGN";
476    IWS0029 Severe "a user-defined function or prototype cannot be nested within a program, function, method or class";
477    IWS0030 Severe "ENTRY cannot be used in a nested program";
478    IWS0031 Severe "FUNCTION-ID {name}: {why}";
479    IWS0032 Severe "FUNCTION-ID {name}: {name} is an intrinsic function's name (assumption C271)";
480    IWS0033 Severe "a second definition of user-defined function {name}";
481    IWS0034 Severe "FUNCTION-ID {name}: a user-defined function contains no programs, but {inner} is inside it";
482    IWS0035 Severe "END FUNCTION {end} ends function {name}";
483    IWS0036 Severe "a second CURRENCY SIGN clause for the currency symbol {symbol}";
484    IWS0037 Severe "UPSI-{number}: a second {which} STATUS phrase";
485    IWS0038 Severe "UPSI-{number}: a mnemonic-name or an ON or OFF STATUS phrase must follow it";
486    IWS0039 Severe "CURRENCY SIGN needs a nonempty alphanumeric literal";
487    IWS0040 Severe "CURRENCY SIGN {bytes} is not one character that can be a PICTURE currency symbol";
488    IWS0041 Severe "CURRENCY SIGN {value} is not one character that can be a PICTURE currency symbol";
489    IWS0042 Severe "CURRENCY SIGN {value} contains a digit, +, -, . or ,";
490    IWS0043 Severe "PICTURE SYMBOL {symbol} is not one character that can be a PICTURE currency symbol";
491    IWS0044 Severe "RECORD DELIMITER on {file}: the clause is for a file of ORGANIZATION SEQUENTIAL";
492    IWS0045 Severe "{indicator} {name} has no SELECT";
493    IWS0046 Severe "SD {name}: a sort or merge file takes no REPORT clause";
494    IWS0047 Severe "SD {name}: a sort or merge file takes no EXTERNAL or GLOBAL clause";
495    IWS0048 Severe "{indicator} {name}: LINAGE is given twice";
496    IWS0049 Severe "{indicator} {name}: EXTERNAL goes on the FD, not on a record of the FILE SECTION";
497    IWS0050 Severe "LINAGE: {phrase} {name} takes no subscript or reference modification";
498    IWS0051 Severe "a floating-point VALUE literal is for a COMP-1 or COMP-2 item, not a fixed-point one";
499    IWS0052 Severe "{written}: a floating-point literal's mantissa has at most 16 digits";
500    IWS0053 Severe "{written}: not an exponent";
501    IWS0054 Severe "{written}: the literal after ALL is alphanumeric, national or a figurative constant other than ALL";
502    IWS0055 Severe "ACCEPT ... FROM ENVIRONMENT is GnuCOBOL's, not Enterprise COBOL's";
503    IWS0056 Severe "EXIT FUNCTION: Enterprise COBOL does not yet support the format 4 EXIT statement; GOBACK ends a user-defined function";
504    IWS0057 Severe "CORRESPONDING takes one receiving group";
505    IWS0058 Severe "an inline PERFORM cannot have AFTER phrases: Enterprise COBOL takes them only when PERFORM names a procedure";
506    IWS0059 Severe "INITIALIZE: {word} is named twice in the {phrase} phrase";
507    IWS0060 Severe "ACCEPT ... FROM {name}: {why}";
508    IWS0061 Severe "SET ENVIRONMENT is GnuCOBOL's, not Enterprise COBOL's";
509    IWS0062 Severe "DFHRESP({condition}): not a CICS condition ironwork for COBOL knows";
510    IWS0063 Severe "DFHVALUE({name}): not a CVDA ironwork for COBOL knows";
511    IWS0064 Severe "NOT cannot follow the left parenthesis that distributes a relational operator";
512    IWS0065 Severe "<> is not an Enterprise COBOL relational operator: it writes NOT =";
513    IWS0066 Informational "{section} SECTION: no paragraph-name after its USE statement";
514    IWS0067 Severe "USE FOR DEBUGGING ON ALL: Enterprise COBOL debugs procedures, by name or as ALL PROCEDURES, and no other items";
515    IWS0068 Severe "USE FOR DEBUGGING is not allowed in a method";
516    IWS0069 Severe "USE FOR DEBUGGING is not allowed in a RECURSIVE program";
517    IWS0070 Severe "USE FOR DEBUGGING in a contained program: debugging sections are allowed only in the outermost program";
518    IWS0071 Severe "a REPOSITORY paragraph belongs to the outermost program only";
519    IWS0072 Severe "a class definition must be alone in its source file";
520    IWS0073 Severe "END CLASS {end} ends class {name}";
521    IWS0074 Severe "CLASS {name} IS \"{text}\": not a Java class name";
522    IWS0075 Severe "class {name} is named twice in the REPOSITORY paragraph";
523    IWS0076 Severe "WHEN-COMPILED is a special register too, so the REPOSITORY paragraph cannot name it";
524    IWS0077 Severe "FUNCTION {name} INTRINSIC: {name} is not an intrinsic function ironwork for COBOL knows";
525    IWS0078 Severe "FUNCTION {name}: a user-defined function in the REPOSITORY paragraph cannot be named {name}";
526    IWS0079 Severe "FUNCTION ALL: INTRINSIC follows ALL, which names every intrinsic function";
527    IWS0080 Severe "FUNCTION {name}: an intrinsic function is listed with INTRINSIC, and no user-defined function takes its name (assumption C271)";
528    IWS0081 Severe "{section}: the DATA DIVISION of a {kind} paragraph has only a WORKING-STORAGE SECTION";
529    IWS0082 Severe "a class definition cannot contain EXEC statements";
530    IWS0083 Severe "method \"{name}\" contains a program: a method cannot contain nested programs";
531    IWS0084 Severe "method \"{name}\" has a REPOSITORY paragraph: the class's applies to its methods";
532    IWS0085 Severe "INVOKE passes its arguments BY VALUE, not BY {word}";
533    IWS0086 Severe "INVOKE passes its arguments BY VALUE: write USING BY VALUE";
534    IWS0087 Severe "level {level} is not a data level";
535    IWS0088 Severe "TYPE and NEXT GROUP belong on a report group's 01-level entry";
536    IWS0089 Severe "a report group entry needs an 01-level entry before it";
537    IWS0090 Severe "SUM with SOURCE or VALUE in one entry";
538    IWS0091 Severe "COLUMN RIGHT and CENTER take an absolute column";
539    IWS0092 Severe "a literal runs to the end of the line with no continuation";
540    IWS0093 Severe "a continued literal must resume with its quote";
541    IWS0094 Severe "{shown}: the source-format directives >>SOURCE and $SET SOURCEFORMAT, giving FREE or FIXED, are the only compiler directives ironwork reads";
542    IWS0095 Severe "CURRENCY SIGN {literal} is {character} in the program's code page, which cannot be a PICTURE currency symbol";
543    IWS0096 Severe "CURRENCY SIGN {literal} is {value} in the program's code page, which contains a digit, +, -, . or ,";
544    IWX0001 Warning "free-form source (Micro Focus and GnuCOBOL; Enterprise COBOL reads fixed form alone): {why the file is read in free form}";
545    IWX0002 Warning "constant entry (Micro Focus and GnuCOBOL; Enterprise COBOL has no level 78 and no CONSTANT clause): {name} stands for its value wherever it is used after this entry";
546    IWX0003 Warning "<> (Micro Focus and GnuCOBOL; Enterprise COBOL writes NOT =) is read as NOT =";
547    IWX0004 Warning "literal concatenation with & (Micro Focus and GnuCOBOL; Enterprise COBOL has none): the literals on either side are one literal";
548    IWX0005 Warning "the COBOL 2002 binary usage (Micro Focus and GnuCOBOL; not Enterprise COBOL's): {usage} is read as PIC {picture} COMP-5";
549    IWX0006 Warning "PROGRAM-ID with no IDENTIFICATION DIVISION header before it (COBOL 2002, Micro Focus and GnuCOBOL; Enterprise COBOL requires the header): the program reads as though IDENTIFICATION DIVISION. came before it";
550    IWX0007 Warning "ASSIGN to a data item (Micro Focus and GnuCOBOL; Enterprise COBOL's assignment-name is never a data item): each OPEN of {file} takes its DD name from {item}";
551    IWX0008 Warning "an integer or numeric function as a MOVE's sender (GnuCOBOL; Enterprise COBOL takes one only where an arithmetic expression can be): FUNCTION {name} is moved as its value";
552    IWX0009 Warning "PROCEDURE DIVISION RETURNING OMITTED (GnuCOBOL; Enterprise COBOL's RETURNING names an 01 or 77 item of the LINKAGE SECTION): the program is read with no RETURNING phrase, and returns its RETURN-CODE to its caller as any program does";
553    IWX0010 Warning "{ACCEPT ... FROM COMMAND-LINE, ARGUMENT-NUMBER or ARGUMENT-VALUE, or DISPLAY ... UPON ARGUMENT-NUMBER} (Micro Focus and GnuCOBOL; Enterprise COBOL reads no command line): {what the job step's PARM program arguments give}";
554    IWX0011 Warning "an INTO name written without its colon (Db2 13 for z/OS requires the colon before every host variable): {name} is read as a host variable";
555}
556
557/// docs/messages.md: the areas and every message, with the severity it is given.
558pub fn document() -> String {
559    let mut out = String::from(
560        "# ironwork's compiler messages\n\n<!-- Generated from crates/syntax/src/messages.rs by its tests; do not edit. -->\n\n\
561         Each message a compile gives carries an id: `IW`, an area's letter and four digits, then the\n\
562         severity it was given, as in `IWR0001-S`. A site fills in the parts between braces. Once\n\
563         released, an id keeps its meaning and is never given to another message; its wording may change.\n\n\
564         ## Areas\n\n| Letter | Area |\n|---|---|\n",
565    );
566    for (letter, area) in AREAS {
567        out.push_str(&format!("| {letter} | {area} |\n"));
568    }
569    out.push_str("\n## Messages\n\n| Id | Severity | Text |\n|---|---|---|\n");
570    for m in CATALOGUE {
571        out.push_str(&format!("| {} | {} | `{}` |\n", m.id, m.severity.letter(), m.text.replace('|', "\\|")));
572    }
573    out
574}
575
576#[cfg(test)]
577mod tests {
578    use super::*;
579
580    fn sources(dir: &std::path::Path, out: &mut Vec<(std::path::PathBuf, String)>) {
581        for entry in std::fs::read_dir(dir).unwrap() {
582            let path = entry.unwrap().path();
583            if path.is_dir() {
584                if path.file_name().is_some_and(|n| n != "tests") {
585                    sources(&path, out);
586                }
587            } else if path.extension().is_some_and(|e| e == "rs") && path.file_name().is_some_and(|n| n != "tests.rs" && n != "messages.rs") {
588                let text = std::fs::read_to_string(&path).unwrap();
589                let code = text.find("#[cfg(test)]\nmod tests {").map_or(text.as_str(), |at| &text[..at]).to_owned();
590                out.push((path, code));
591            }
592        }
593    }
594
595    #[test]
596    fn syntax_compile_and_code_generation_build_every_message_from_the_catalogue() {
597        let crates = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("..");
598        let mut files = Vec::new();
599        for krate in ["syntax", "compile", "exec"] {
600            sources(&crates.join(krate).join("src"), &mut files);
601        }
602        let uncatalogued: Vec<String> = files
603            .iter()
604            .flat_map(|(path, code)| code.lines().enumerate().filter(|(_, l)| l.contains("Error::at(") || l.contains("Error::warning(")).map(move |(n, l)| format!("{}:{}: {}", path.display(), n + 1, l.trim())))
605            .collect();
606        assert!(uncatalogued.is_empty(), "give these an entry in syntax::messages and build them with it:\n{}", uncatalogued.join("\n"));
607    }
608
609    #[test]
610    fn docs_messages_is_the_catalogue() {
611        let committed = include_str!("../../../docs/messages.md").replace('\r', "");
612        let written = document();
613        assert!(committed == written, "docs/messages.md is not the catalogue; write it as:\n{written}");
614    }
615
616    #[test]
617    fn ids_are_unique_in_order_and_name_an_area() {
618        let ids: Vec<&str> = CATALOGUE.iter().map(|m| m.id).collect();
619        assert!(ids.windows(2).all(|w| w[0] < w[1]), "{ids:?}");
620        for id in ids {
621            assert!(id.len() == 7 && id.starts_with("IW") && id[3..].bytes().all(|b| b.is_ascii_digit()), "{id}");
622            assert!(AREAS.iter().any(|(letter, _)| id.as_bytes()[2] == *letter as u8), "{id}");
623        }
624    }
625
626    #[test]
627    fn a_catalogued_message_carries_its_id_and_severity() {
628        let pos = Pos { file: 0, line: 3, col: 8 };
629        let warned = IWX0003.at(pos, IWX0003.text);
630        assert_eq!((warned.id, warned.severity), (Some("IWX0003"), Severity::Warning));
631        assert_eq!(warned.place("p.cbl"), "p.cbl:3:8: warning: IWX0003-W <> (Micro Focus and GnuCOBOL; Enterprise COBOL writes NOT =) is read as NOT =");
632        let refused = IWR0001.at(pos, "XML PARSE VALIDATING WITH X: why");
633        assert_eq!(refused.place("p.cbl"), "p.cbl:3:8: IWR0001-S XML PARSE VALIDATING WITH X: why");
634        assert_eq!(refused.graded(Severity::Error).labelled(), "IWR0001-E XML PARSE VALIDATING WITH X: why");
635    }
636}