GnuCOBOL  2.0
A free COBOL compiler
reserved.c
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001-2012, 2014-2015 Free Software Foundation, Inc.
3  Written by Keisuke Nishida, Roger While, Simon Sobisch
4 
5  This file is part of GnuCOBOL.
6 
7  The GnuCOBOL compiler is free software: you can redistribute it
8  and/or modify it under the terms of the GNU General Public License
9  as published by the Free Software Foundation, either version 3 of the
10  License, or (at your option) any later version.
11 
12  GnuCOBOL is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with GnuCOBOL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #include "config.h"
23 
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <stddef.h>
27 #include <string.h>
28 #include <ctype.h>
29 
30 #include "cobc.h"
31 #include "tree.h"
32 #include "parser.h"
33 
34 /* Global variables */
35 
37 
38 /* Local variables */
39 
40 struct system_struct {
41  const char *name;
43  const int token;
44 };
45 
46 static const struct system_struct system_table[] = {
47  {"SYSIN", CB_DEVICE_NAME, CB_DEVICE_SYSIN},
48  {"SYSIPT", CB_DEVICE_NAME, CB_DEVICE_SYSIN},
49  {"STDIN", CB_DEVICE_NAME, CB_DEVICE_SYSIN},
50  {"SYSOUT", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
51  {"SYSLIST", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
52  {"SYSLST", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
53  {"STDOUT", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
54  {"PRINT", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
55  {"PRINTER", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
56  {"PRINTER-1", CB_DEVICE_NAME, CB_DEVICE_SYSOUT},
57  {"SYSERR", CB_DEVICE_NAME, CB_DEVICE_SYSERR},
58  {"STDERR", CB_DEVICE_NAME, CB_DEVICE_SYSERR},
59  {"CONSOLE", CB_DEVICE_NAME, CB_DEVICE_CONSOLE},
73  {"FORMFEED", CB_FEATURE_NAME, CB_FEATURE_FORMFEED},
74  {"CALL-CONVENTION", CB_FEATURE_NAME, CB_FEATURE_CONVENTION},
75  {"SWITCH-0", CB_SWITCH_NAME, CB_SWITCH_0},
76  {"SWITCH-1", CB_SWITCH_NAME, CB_SWITCH_1},
77  {"SWITCH-2", CB_SWITCH_NAME, CB_SWITCH_2},
78  {"SWITCH-3", CB_SWITCH_NAME, CB_SWITCH_3},
79  {"SWITCH-4", CB_SWITCH_NAME, CB_SWITCH_4},
80  {"SWITCH-5", CB_SWITCH_NAME, CB_SWITCH_5},
81  {"SWITCH-6", CB_SWITCH_NAME, CB_SWITCH_6},
82  {"SWITCH-7", CB_SWITCH_NAME, CB_SWITCH_7},
83  {"SWITCH-8", CB_SWITCH_NAME, CB_SWITCH_8},
84  {"SWITCH-9", CB_SWITCH_NAME, CB_SWITCH_9},
85  {"SWITCH-10", CB_SWITCH_NAME, CB_SWITCH_10},
86  {"SWITCH-11", CB_SWITCH_NAME, CB_SWITCH_11},
87  {"SWITCH-12", CB_SWITCH_NAME, CB_SWITCH_12},
88  {"SWITCH-13", CB_SWITCH_NAME, CB_SWITCH_13},
89  {"SWITCH-14", CB_SWITCH_NAME, CB_SWITCH_14},
90  {"SWITCH-15", CB_SWITCH_NAME, CB_SWITCH_15},
91  {"SWITCH-16", CB_SWITCH_NAME, CB_SWITCH_16},
92  {"SWITCH-17", CB_SWITCH_NAME, CB_SWITCH_17},
93  {"SWITCH-18", CB_SWITCH_NAME, CB_SWITCH_18},
94  {"SWITCH-19", CB_SWITCH_NAME, CB_SWITCH_19},
95  {"SWITCH-20", CB_SWITCH_NAME, CB_SWITCH_20},
96  {"SWITCH-21", CB_SWITCH_NAME, CB_SWITCH_21},
97  {"SWITCH-22", CB_SWITCH_NAME, CB_SWITCH_22},
98  {"SWITCH-23", CB_SWITCH_NAME, CB_SWITCH_23},
99  {"SWITCH-24", CB_SWITCH_NAME, CB_SWITCH_24},
100  {"SWITCH-25", CB_SWITCH_NAME, CB_SWITCH_25},
101  {"SWITCH-26", CB_SWITCH_NAME, CB_SWITCH_26},
102  {"SWITCH-27", CB_SWITCH_NAME, CB_SWITCH_27},
103  {"SWITCH-28", CB_SWITCH_NAME, CB_SWITCH_28},
104  {"SWITCH-29", CB_SWITCH_NAME, CB_SWITCH_29},
105  {"SWITCH-30", CB_SWITCH_NAME, CB_SWITCH_30},
106  {"SWITCH-31", CB_SWITCH_NAME, CB_SWITCH_31},
107  {"SWITCH-32", CB_SWITCH_NAME, CB_SWITCH_32},
108  {"SWITCH-33", CB_SWITCH_NAME, CB_SWITCH_33},
109  {"SWITCH-34", CB_SWITCH_NAME, CB_SWITCH_34},
110  {"SWITCH-35", CB_SWITCH_NAME, CB_SWITCH_35},
111  {"SWITCH-36", CB_SWITCH_NAME, CB_SWITCH_36}
112 };
113 
114 #define SYSTEM_TAB_SIZE sizeof(system_table) / sizeof(struct system_struct)
115 
116 static const struct system_struct ext_system_table[] = {
117  {"SW0", CB_SWITCH_NAME, CB_SWITCH_0},
118  {"SW1", CB_SWITCH_NAME, CB_SWITCH_1},
119  {"SW2", CB_SWITCH_NAME, CB_SWITCH_2},
120  {"SW3", CB_SWITCH_NAME, CB_SWITCH_3},
121  {"SW4", CB_SWITCH_NAME, CB_SWITCH_4},
122  {"SW5", CB_SWITCH_NAME, CB_SWITCH_5},
123  {"SW6", CB_SWITCH_NAME, CB_SWITCH_6},
124  {"SW7", CB_SWITCH_NAME, CB_SWITCH_7},
125  {"SW8", CB_SWITCH_NAME, CB_SWITCH_8},
126  {"SW9", CB_SWITCH_NAME, CB_SWITCH_9},
127  {"SW10", CB_SWITCH_NAME, CB_SWITCH_10},
128  {"SW11", CB_SWITCH_NAME, CB_SWITCH_11},
129  {"SW12", CB_SWITCH_NAME, CB_SWITCH_12},
130  {"SW13", CB_SWITCH_NAME, CB_SWITCH_13},
131  {"SW14", CB_SWITCH_NAME, CB_SWITCH_14},
132  {"SW15", CB_SWITCH_NAME, CB_SWITCH_15},
133  {"SWITCH 0", CB_SWITCH_NAME, CB_SWITCH_0},
134  {"SWITCH 1", CB_SWITCH_NAME, CB_SWITCH_1},
135  {"SWITCH 2", CB_SWITCH_NAME, CB_SWITCH_2},
136  {"SWITCH 3", CB_SWITCH_NAME, CB_SWITCH_3},
137  {"SWITCH 4", CB_SWITCH_NAME, CB_SWITCH_4},
138  {"SWITCH 5", CB_SWITCH_NAME, CB_SWITCH_5},
139  {"SWITCH 6", CB_SWITCH_NAME, CB_SWITCH_6},
140  {"SWITCH 7", CB_SWITCH_NAME, CB_SWITCH_7},
141  {"SWITCH 8", CB_SWITCH_NAME, CB_SWITCH_8},
142  {"SWITCH 9", CB_SWITCH_NAME, CB_SWITCH_9},
143  {"SWITCH 10", CB_SWITCH_NAME, CB_SWITCH_10},
144  {"SWITCH 11", CB_SWITCH_NAME, CB_SWITCH_11},
145  {"SWITCH 12", CB_SWITCH_NAME, CB_SWITCH_12},
146  {"SWITCH 13", CB_SWITCH_NAME, CB_SWITCH_13},
147  {"SWITCH 14", CB_SWITCH_NAME, CB_SWITCH_14},
148  {"SWITCH 15", CB_SWITCH_NAME, CB_SWITCH_15},
149  {"SWITCH 16", CB_SWITCH_NAME, CB_SWITCH_16},
150  {"SWITCH 17", CB_SWITCH_NAME, CB_SWITCH_17},
151  {"SWITCH 18", CB_SWITCH_NAME, CB_SWITCH_18},
152  {"SWITCH 19", CB_SWITCH_NAME, CB_SWITCH_19},
153  {"SWITCH 20", CB_SWITCH_NAME, CB_SWITCH_20},
154  {"SWITCH 21", CB_SWITCH_NAME, CB_SWITCH_21},
155  {"SWITCH 22", CB_SWITCH_NAME, CB_SWITCH_22},
156  {"SWITCH 23", CB_SWITCH_NAME, CB_SWITCH_23},
157  {"SWITCH 24", CB_SWITCH_NAME, CB_SWITCH_24},
158  {"SWITCH 25", CB_SWITCH_NAME, CB_SWITCH_25},
159  {"SWITCH 26", CB_SWITCH_NAME, CB_SWITCH_26},
160  {"SWITCH A", CB_SWITCH_NAME, CB_SWITCH_1},
161  {"SWITCH B", CB_SWITCH_NAME, CB_SWITCH_2},
162  {"SWITCH C", CB_SWITCH_NAME, CB_SWITCH_3},
163  {"SWITCH D", CB_SWITCH_NAME, CB_SWITCH_4},
164  {"SWITCH E", CB_SWITCH_NAME, CB_SWITCH_5},
165  {"SWITCH F", CB_SWITCH_NAME, CB_SWITCH_6},
166  {"SWITCH G", CB_SWITCH_NAME, CB_SWITCH_7},
167  {"SWITCH H", CB_SWITCH_NAME, CB_SWITCH_8},
168  {"SWITCH I", CB_SWITCH_NAME, CB_SWITCH_9},
169  {"SWITCH J", CB_SWITCH_NAME, CB_SWITCH_10},
170  {"SWITCH K", CB_SWITCH_NAME, CB_SWITCH_11},
171  {"SWITCH L", CB_SWITCH_NAME, CB_SWITCH_12},
172  {"SWITCH M", CB_SWITCH_NAME, CB_SWITCH_13},
173  {"SWITCH N", CB_SWITCH_NAME, CB_SWITCH_14},
174  {"SWITCH O", CB_SWITCH_NAME, CB_SWITCH_15},
175  {"SWITCH P", CB_SWITCH_NAME, CB_SWITCH_16},
176  {"SWITCH Q", CB_SWITCH_NAME, CB_SWITCH_17},
177  {"SWITCH R", CB_SWITCH_NAME, CB_SWITCH_18},
178  {"SWITCH S", CB_SWITCH_NAME, CB_SWITCH_19},
179  {"SWITCH T", CB_SWITCH_NAME, CB_SWITCH_20},
180  {"SWITCH U", CB_SWITCH_NAME, CB_SWITCH_21},
181  {"SWITCH V", CB_SWITCH_NAME, CB_SWITCH_22},
182  {"SWITCH W", CB_SWITCH_NAME, CB_SWITCH_23},
183  {"SWITCH X", CB_SWITCH_NAME, CB_SWITCH_24},
184  {"SWITCH Y", CB_SWITCH_NAME, CB_SWITCH_25},
185  {"SWITCH Z", CB_SWITCH_NAME, CB_SWITCH_26}
186 };
187 
188 #define EXT_SYSTEM_TAB_SIZE \
189  sizeof(ext_system_table) / sizeof(struct system_struct)
190 
191 /* Reserved word table */
192 /* Must be ordered on word for binary search */
193 /* Description */
194 
195 /* Word # Statement has terminator # Is context sensitive # Token */
196 /* Special context set # Special context test */
197 
199 
201  { "ACCEPT", 1, 0, ACCEPT, /* 2002 */
202  CB_CS_ACCEPT, 0
203  },
204  { "ACCESS", 0, 0, ACCESS, /* 2002 */
205  0, 0
206  },
207  { "ACTIVE-CLASS", 0, 0, -1, /* 2002 */
208  0, 0
209  },
210  { "ADD", 1, 0, ADD, /* 2002 */
211  0, 0
212  },
213  { "ADDRESS", 0, 0, ADDRESS, /* 2002 */
214  0, 0
215  },
216  { "ADVANCING", 0, 0, ADVANCING, /* 2002 */
217  0, 0
218  },
219  { "AFTER", 0, 0, AFTER, /* 2002 */
220  0, 0
221  },
222  { "ALIGNED", 0, 0, -1, /* 2002 */
223  0, 0
224  },
225  { "ALL", 0, 0, ALL, /* 2002 */
226  0, 0
227  },
228  { "ALLOCATE", 0, 0, ALLOCATE, /* 2002 */
229  0, 0
230  },
231  { "ALPHABET", 0, 0, ALPHABET, /* 2002 */
232  CB_CS_ALPHABET, 0
233  },
234  { "ALPHABETIC", 0, 0, ALPHABETIC, /* 2002 */
235  0, 0
236  },
237  { "ALPHABETIC-LOWER", 0, 0, ALPHABETIC_LOWER, /* 2002 */
238  0, 0
239  },
240  { "ALPHABETIC-UPPER", 0, 0, ALPHABETIC_UPPER, /* 2002 */
241  0, 0
242  },
243  { "ALPHANUMERIC", 0, 0, ALPHANUMERIC, /* 2002 */
244  0, 0
245  },
246  { "ALPHANUMERIC-EDITED", 0, 0, ALPHANUMERIC_EDITED, /* 2002 */
247  0, 0
248  },
249  { "ALSO", 0, 0, ALSO, /* 2002 */
250  0, 0
251  },
252  { "ALTER", 0, 0, ALTER, /* 85 */
253  0, 0
254  },
255  { "ALTERNATE", 0, 0, ALTERNATE, /* 2002 */
256  0, 0
257  },
258  { "AND", 0, 0, AND, /* 2002 */
259  0, 0
260  },
261  { "ANY", 0, 0, ANY, /* 2002 */
262  0, 0
263  },
264  { "ANYCASE", 0, 0, -1, /* 2002 */
265  0, 0
266  },
267  { "ARE", 0, 0, ARE, /* 2002 */
268  0, 0
269  },
270  { "AREA", 0, 0, AREA, /* 2002 */
271  0, 0
272  },
273  { "AREAS", 0, 0, AREA, /* 2002 */
274  0, 0
275  },
276  { "ARGUMENT-NUMBER", 0, 0, ARGUMENT_NUMBER, /* Extension */
277  0, 0
278  },
279  { "ARGUMENT-VALUE", 0, 0, ARGUMENT_VALUE, /* Extension */
280  0, 0
281  },
282  { "ARITHMETIC", 0, 1, -1, /* 2002 (C/S) */
283  0, 0
284  },
285  { "AS", 0, 0, AS, /* 2002 */
286  0, 0
287  },
288  { "ASCENDING", 0, 0, ASCENDING, /* 2002 */
289  0, 0
290  },
291  { "ASCII", 0, 1, ASCII, /* Extension */
292  0, CB_CS_ALPHABET
293  },
294  { "ASSIGN", 0, 0, ASSIGN, /* 2002 */
295  CB_CS_ASSIGN, 0
296  },
297  { "AT", 0, 0, AT, /* 2002 */
298  0, 0
299  },
300  { "ATTRIBUTE", 0, 1, ATTRIBUTE, /* 2002 (C/S) */
301  0, CB_CS_SET
302  },
303  { "AUTO", 0, 0, AUTO, /* 2002 (C/S) */
304  0, 0
305  },
306  { "AUTO-SKIP", 0, 0, AUTO, /* Extension */
307  0, 0
308  },
309  { "AUTOMATIC", 0, 0, AUTOMATIC, /* 2002 (C/S) */
310  0, 0
311  },
312  { "AUTOTERMINATE", 0, 0, AUTO, /* Extension */
313  0, 0
314  },
315  { "AWAY-FROM-ZERO", 0, 1, AWAY_FROM_ZERO, /* 2014 (C/S) */
316  0, CB_CS_ROUNDED
317  },
318  { "B-AND", 0, 0, -1, /* 2002 */
319  0, 0
320  },
321  { "B-NOT", 0, 0, -1, /* 2002 */
322  0, 0
323  },
324  { "B-OR", 0, 0, -1, /* 2002 */
325  0, 0
326  },
327  { "B-XOR", 0, 0, -1, /* 2002 */
328  0, 0
329  },
330  { "BACKGROUND-COLOR", 0, 0, BACKGROUND_COLOR, /* 2002 (C/S) */
331  0, 0
332  },
333  { "BACKGROUND-COLOUR", 0, 0, BACKGROUND_COLOR, /* Extension */
334  0, 0
335  },
336  { "BASED", 0, 0, BASED, /* 2002 */
337  0, 0
338  },
339  { "BEEP", 0, 0, BELL, /* Extension */
340  0, 0
341  },
342  { "BEFORE", 0, 0, BEFORE, /* 2002 */
343  0, 0
344  },
345  { "BELL", 0, 0, BELL, /* 2002 (C/S) */
346  0, 0
347  },
348  { "BINARY", 0, 0, BINARY, /* 2002 */
349  0, 0
350  },
351  { "BINARY-C-LONG", 0, 0, BINARY_C_LONG, /* Extension */
352  0, 0
353  },
354  { "BINARY-CHAR", 0, 0, BINARY_CHAR, /* 2002 */
355  0, 0
356  },
357  { "BINARY-DOUBLE", 0, 0, BINARY_DOUBLE, /* 2002 */
358  0, 0
359  },
360  { "BINARY-INT", 0, 0, BINARY_LONG, /* Extension */
361  0, 0
362  },
363  { "BINARY-LONG", 0, 0, BINARY_LONG, /* 2002 */
364  0, 0
365  },
366  { "BINARY-LONG-LONG", 0, 0, BINARY_DOUBLE, /* Extension */
367  0, 0
368  },
369  { "BINARY-SHORT", 0, 0, BINARY_SHORT, /* 2002 */
370  0, 0
371  },
372  { "BIT", 0, 0, -1, /* 2002 */
373  0, 0
374  },
375  { "BLANK", 0, 0, BLANK, /* 2002 */
376  0, 0
377  },
378  { "BLINK", 0, 0, BLINK, /* 2002 (C/S) */
379  0, 0
380  },
381  { "BLOCK", 0, 0, BLOCK, /* 2002 */
382  0, 0
383  },
384  { "BOOLEAN", 0, 0, -1, /* 2002 */
385  0, 0
386  },
387  { "BOTTOM", 0, 0, BOTTOM, /* 2002 */
388  0, 0
389  },
390  { "BY", 0, 0, BY, /* 2002 */
391  0, 0
392  },
393  { "BYTE-LENGTH", 0, 1, BYTE_LENGTH, /* 2002 (C/S) */
394  0, CB_CS_CONSTANT
395  },
396  { "CALL", 1, 0, CALL, /* 2002 */
397  CB_CS_CALL, 0
398  },
399  { "CANCEL", 0, 0, CANCEL, /* 2002 */
400  0, 0
401  },
402  { "CAPACITY", 0, 1, CAPACITY, /* 2014 (C/S) */
403  0, 0
404  /* FIXME: 2014 Context-sensitive to OCCURS clause */
405  },
406  { "CENTER", 0, 1, -1, /* 2002 (C/S) */
407  0, 0
408  /* FIXME + Check: 2014 Context-sensitive to COLUMN clause */
409  },
410  { "CF", 0, 0, CF, /* 2002 */
411  0, 0
412  },
413  { "CH", 0, 0, CH, /* 2002 */
414  0, 0
415  },
416  { "CHAIN", 0, 0, -1, /* Extension */
417  0, 0
418  },
419  { "CHAINING", 0, 0, CHAINING, /* Extension */
420  0, 0
421  },
422  { "CHARACTER", 0, 0, CHARACTER, /* 2002 */
423  0, 0
424  },
425  { "CHARACTERS", 0, 0, CHARACTERS, /* 2002 */
426  0, 0
427  },
428  { "CLASS", 0, 0, CLASS, /* 2002 */
429  0, 0
430  },
431  { "CLASS-ID", 0, 0, -1, /* 2002 */
432  0, 0
433  },
434  { "CLASSIFICATION", 0, 1, CLASSIFICATION, /* 2002 (C/S) */
435  0, 0
436  },
437  { "CLOSE", 0, 0, CLOSE, /* 2002 */
438  0, 0
439  },
440  { "CODE", 0, 0, CODE, /* 2002 */
441  0, 0
442  },
443  { "CODE-SET", 0, 0, CODE_SET, /* 2002 */
444  0, 0
445  },
446  { "COL", 0, 0, COL, /* 2002 */
447  0, 0
448  },
449  { "COLLATING", 0, 0, COLLATING, /* 2002 */
450  0, 0
451  },
452  { "COLS", 0, 0, COLS, /* 2002 */
453  0, 0
454  },
455  { "COLUMN", 0, 0, COLUMN, /* 2002 */
456  0, 0
457  },
458  { "COLUMNS", 0, 0, COLUMNS, /* 2002 */
459  0, 0
460  },
461  { "COMMA", 0, 0, COMMA, /* 2002 */
462  0, 0
463  },
464  { "COMMAND-LINE", 0, 0, COMMAND_LINE, /* Extension */
465  0, 0
466  },
467  { "COMMIT", 0, 0, COMMIT, /* Extension */
468  0, 0
469  },
470  { "COMMON", 0, 0, COMMON, /* 2002 */
471  0, 0
472  },
473  { "COMP", 0, 0, COMP, /* 2002 */
474  0, 0
475  },
476  /* Note EBCDIC! */
477 #ifdef COB_EBCDIC_MACHINE
478  { "COMP-X", 0, 0, COMP_X, /* Extension */
479  0, 0
480  },
481 #endif
482  { "COMP-1", 0, 0, COMP_1, /* Extension */
483  0, 0
484  },
485  { "COMP-2", 0, 0, COMP_2, /* Extension */
486  0, 0
487  },
488  { "COMP-3", 0, 0, COMP_3, /* Extension */
489  0, 0
490  },
491  { "COMP-4", 0, 0, COMP_4, /* Extension */
492  0, 0
493  },
494  { "COMP-5", 0, 0, COMP_5, /* Extension */
495  0, 0
496  },
497  { "COMP-6", 0, 0, COMP_6, /* Extension */
498  0, 0
499  },
500  /* Note EBCDIC! */
501 #ifndef COB_EBCDIC_MACHINE
502  { "COMP-X", 0, 0, COMP_X, /* Extension */
503  0, 0
504  },
505 #endif
506  { "COMPUTATIONAL", 0, 0, COMP, /* 2002 */
507  0, 0
508  },
509  /* Note EBCDIC! */
510 #ifdef COB_EBCDIC_MACHINE
511  { "COMPUTATIONAL-X", 0, 0, COMP_X, /* Extension */
512  0, 0
513  },
514 #endif
515  { "COMPUTATIONAL-1", 0, 0, COMP_1, /* Extension */
516  0, 0
517  },
518  { "COMPUTATIONAL-2", 0, 0, COMP_2, /* Extension */
519  0, 0
520  },
521  { "COMPUTATIONAL-3", 0, 0, COMP_3, /* Extension */
522  0, 0
523  },
524  { "COMPUTATIONAL-4", 0, 0, COMP_4, /* Extension */
525  0, 0
526  },
527  { "COMPUTATIONAL-5", 0, 0, COMP_5, /* Extension */
528  0, 0
529  },
530  /* Note EBCDIC! */
531 #ifndef COB_EBCDIC_MACHINE
532  { "COMPUTATIONAL-X", 0, 0, COMP_X, /* Extension */
533  0, 0
534  },
535 #endif
536  { "COMPUTE", 1, 0, COMPUTE, /* 2002 */
537  0, 0
538  },
539  { "CONDITION", 0, 0, CONDITION, /* 2002 */
540  0, 0
541  },
542  { "CONFIGURATION", 0, 0, CONFIGURATION, /* 2002 */
543  0, 0
544  },
545  { "CONSTANT", 0, 0, CONSTANT, /* 2002 */
546  CB_CS_CONSTANT, 0
547  },
548  { "CONTAINS", 0, 0, CONTAINS, /* 2002 */
549  0, 0
550  },
551  { "CONTENT", 0, 0, CONTENT, /* 2002 */
552  0, 0
553  },
554  { "CONTINUE", 0, 0, CONTINUE, /* 2002 */
555  0, 0
556  },
557  { "CONTROL", 0, 0, CONTROL, /* 2002 */
558  0, 0
559  },
560  { "CONTROLS", 0, 0, CONTROLS, /* 2002 */
561  0, 0
562  },
563  { "CONVERSION", 0, 1, CONVERSION, /* Extension */
564  0, CB_CS_WITH
565  },
566  { "CONVERTING", 0, 0, CONVERTING, /* 2002 */
567  0, 0
568  },
569  { "COPY", 0, 0, COPY, /* 2002 */
570  0, 0
571  },
572  { "CORR", 0, 0, CORRESPONDING, /* 2002 */
573  0, 0
574  },
575  { "CORRESPONDING", 0, 0, CORRESPONDING, /* 2002 */
576  0, 0
577  },
578  { "COUNT", 0, 0, COUNT, /* 2002 */
579  0, 0
580  },
581  { "CRT", 0, 0, CRT, /* 2002 */
582  0, 0
583  },
584  { "CRT-UNDER", 0, 0, CRT_UNDER, /* Extension */
585  0, 0
586  },
587  { "CURRENCY", 0, 0, CURRENCY, /* 2002 */
588  0, 0
589  },
590  { "CURSOR", 0, 0, CURSOR, /* 2002 */
591  0, 0
592  },
593  { "CYCLE", 0, 1, CYCLE, /* 2002 (C/S) */
594  0, CB_CS_EXIT
595  },
596  { "DATA", 0, 0, DATA, /* 2002 */
597  0, 0
598  },
599  { "DATA-POINTER", 0, 0, -1, /* 2002 */
600  0, 0
601  },
602  { "DATE", 0, 0, DATE, /* 2002 */
603  CB_CS_DATE, 0
604  },
605  { "DAY", 0, 0, DAY, /* 2002 */
606  CB_CS_DAY, 0
607  },
608  { "DAY-OF-WEEK", 0, 0, DAY_OF_WEEK, /* 2002 */
609  0, 0
610  },
611  { "DE", 0, 0, DE, /* 2002 */
612  0, 0
613  },
614  { "DEBUGGING", 0, 0, DEBUGGING, /* 2002 */
615  0, 0
616  },
617  { "DECIMAL-POINT", 0, 0, DECIMAL_POINT, /* 2002 */
618  0, 0
619  },
620  { "DECLARATIVES", 0, 0, DECLARATIVES, /* 2002 */
621  0, 0
622  },
623  { "DEFAULT", 0, 0, DEFAULT, /* 2002 */
624  0, 0
625  },
626  { "DELETE", 1, 0, DELETE, /* 2002 */
627  0, 0
628  },
629  { "DELIMITED", 0, 0, DELIMITED, /* 2002 */
630  0, 0
631  },
632  { "DELIMITER", 0, 0, DELIMITER, /* 2002 */
633  0, 0
634  },
635  { "DEPENDING", 0, 0, DEPENDING, /* 2002 */
636  0, 0
637  },
638  { "DESCENDING", 0, 0, DESCENDING, /* 2002 */
639  0, 0
640  },
641  { "DESTINATION", 0, 0, -1, /* 2002 */
642  0, 0
643  },
644  { "DETAIL", 0, 0, DETAIL, /* 2002 */
645  0, 0
646  },
647  { "DISABLE", 0, 0, -1, /* 2002 */
648  0, 0
649  },
650  { "DISC", 0, 1, DISC, /* Extension */
651  0, CB_CS_ASSIGN
652  },
653  { "DISK", 0, 1, DISK, /* Extension */
654  0, CB_CS_ASSIGN
655  },
656  { "DISPLAY", 1, 0, DISPLAY, /* 2002 */
657  0, 0
658  },
659  { "DIVIDE", 1, 0, DIVIDE, /* 2002 */
660  0, 0
661  },
662  { "DIVISION", 0, 0, DIVISION, /* 2002 */
663  0, 0
664  },
665  { "DOWN", 0, 0, DOWN, /* 2002 */
666  0, 0
667  },
668  { "DUPLICATES", 0, 0, DUPLICATES, /* 2002 */
669  0, 0
670  },
671  { "DYNAMIC", 0, 0, DYNAMIC, /* 2002 */
672  0, 0
673  },
674  { "EBCDIC", 0, 1, EBCDIC, /* Extension */
675  0, CB_CS_ALPHABET
676  },
677  { "EC", 0, 0, EC, /* 2002 */
678  0, 0
679  },
680  { "ELSE", 0, 0, ELSE, /* 2002 */
681  0, 0
682  },
683  { "EMPTY-CHECK", 0, 0, REQUIRED, /* Extension */
684  0, 0
685  },
686  { "END", 0, 0, END, /* 2002 */
687  0, 0
688  },
689  { "END-ACCEPT", 0, 0, END_ACCEPT, /* 2002 */
690  0, 0
691  },
692  { "END-ADD", 0, 0, END_ADD, /* 2002 */
693  0, 0
694  },
695  { "END-CALL", 0, 0, END_CALL, /* 2002 */
696  0, 0
697  },
698  { "END-CHAIN", 0, 0, -1, /* Extension */
699  0, 0
700  },
701  { "END-COMPUTE", 0, 0, END_COMPUTE, /* 2002 */
702  0, 0
703  },
704  { "END-DELETE", 0, 0, END_DELETE, /* 2002 */
705  0, 0
706  },
707  { "END-DISPLAY", 0, 0, END_DISPLAY, /* 2002 */
708  0, 0
709  },
710  { "END-DIVIDE", 0, 0, END_DIVIDE, /* 2002 */
711  0, 0
712  },
713  { "END-EVALUATE", 0, 0, END_EVALUATE, /* 2002 */
714  0, 0
715  },
716  { "END-IF", 0, 0, END_IF, /* 2002 */
717  0, 0
718  },
719  { "END-MULTIPLY", 0, 0, END_MULTIPLY, /* 2002 */
720  0, 0
721  },
722  { "END-OF-PAGE", 0, 0, EOP, /* 2002 */
723  0, 0
724  },
725  { "END-PERFORM", 0, 0, END_PERFORM, /* 2002 */
726  0, 0
727  },
728  { "END-READ", 0, 0, END_READ, /* 2002 */
729  0, 0
730  },
731  { "END-RETURN", 0, 0, END_RETURN, /* 2002 */
732  0, 0
733  },
734  { "END-REWRITE", 0, 0, END_REWRITE, /* 2002 */
735  0, 0
736  },
737  { "END-SEARCH", 0, 0, END_SEARCH, /* 2002 */
738  0, 0
739  },
740  { "END-START", 0, 0, END_START, /* 2002 */
741  0, 0
742  },
743  { "END-STRING", 0, 0, END_STRING, /* 2002 */
744  0, 0
745  },
746  { "END-SUBTRACT", 0, 0, END_SUBTRACT, /* 2002 */
747  0, 0
748  },
749  { "END-UNSTRING", 0, 0, END_UNSTRING, /* 2002 */
750  0, 0
751  },
752  { "END-WRITE", 0, 0, END_WRITE, /* 2002 */
753  0, 0
754  },
755  { "ENTRY", 0, 0, ENTRY, /* Extension */
756  0, 0
757  },
758  { "ENTRY-CONVENTION", 0, 1, -1, /* 2002 (C/S) */
759  0, 0
760  },
761  { "ENVIRONMENT", 0, 0, ENVIRONMENT, /* 2002 */
762  0, 0
763  },
764  { "ENVIRONMENT-NAME", 0, 0, ENVIRONMENT_NAME, /* Extension */
765  0, 0
766  },
767  { "ENVIRONMENT-VALUE", 0, 0, ENVIRONMENT_VALUE, /* Extension */
768  0, 0
769  },
770  { "EO", 0, 0, -1, /* 2002 */
771  0, 0
772  },
773  { "EOL", 0, 1, EOL, /* 2002 (C/S) */
774  0, CB_CS_ERASE
775  },
776  { "EOP", 0, 0, EOP, /* 2002 */
777  0, 0
778  },
779  { "EOS", 0, 1, EOS, /* 2002 (C/S) */
780  0, CB_CS_ERASE
781  },
782  { "EQUAL", 0, 0, EQUAL, /* 2002 */
783  0, 0
784  },
785  { "EQUALS", 0, 0, EQUAL, /* Extension */
786  0, 0
787  },
788  { "ERASE", 0, 0, ERASE, /* 2002 (C/S) */
789  CB_CS_ERASE, 0
790  },
791  { "ERROR", 0, 0, ERROR, /* 2002 */
792  0, 0
793  },
794  { "ESCAPE", 0, 0, ESCAPE, /* Extension */
795  0, 0
796  },
797  { "EVALUATE", 1, 0, EVALUATE, /* 2002 */
798  0, 0
799  },
800  { "EXCEPTION", 0, 0, EXCEPTION, /* 2002 */
801  0, 0
802  },
803  { "EXCEPTION-OBJECT", 0, 0, -1, /* 2002 */
804  0, 0
805  },
806  { "EXCLUSIVE", 0, 0, EXCLUSIVE, /* Extension */
807  0, 0
808  },
809  { "EXIT", 0, 0, EXIT, /* 2002 */
810  CB_CS_EXIT, 0
811  },
812  { "EXPANDS", 0, 1, -1, /* 2002 (C/S) */
813  0, 0
814  },
815  { "EXTEND", 0, 0, EXTEND, /* 2002 */
816  0, 0
817  },
818  { "EXTERNAL", 0, 0, EXTERNAL, /* 2002 */
819  0, 0
820  },
821  { "FACTORY", 0, 0, -1, /* 2002 */
822  0, 0
823  },
824  { "FALSE", 0, 0, TOK_FALSE, /* 2002 */
825  0, 0
826  },
827  { "FD", 0, 0, FD, /* 2002 */
828  0, 0
829  },
830  { "FILE", 0, 0, TOK_FILE, /* 2002 */
831  0, 0
832  },
833  { "FILE-CONTROL", 0, 0, FILE_CONTROL, /* 2002 */
834  0, 0
835  },
836  { "FILE-ID", 0, 0, FILE_ID, /* Extension */
837  0, 0
838  },
839  { "FILLER", 0, 0, FILLER, /* 2002 */
840  0, 0
841  },
842  { "FINAL", 0, 0, FINAL, /* 2002 */
843  0, 0
844  },
845  { "FIRST", 0, 0, FIRST, /* 2002 */
846  0, 0
847  },
848  { "FLOAT-BINARY-128", 0, 0, -1, /* 2011 */
849  0, 0
850  },
851  { "FLOAT-BINARY-32", 0, 0, -1, /* 2011 */
852  0, 0
853  },
854  { "FLOAT-BINARY-64", 0, 0, -1, /* 2011 */
855  0, 0
856  },
857  { "FLOAT-DECIMAL-16", 0, 0, FLOAT_DECIMAL_16, /* 2008 */
858  0, 0
859  },
860  { "FLOAT-DECIMAL-34", 0, 0, FLOAT_DECIMAL_34, /* 2008 */
861  0, 0
862  },
863 #if 0 /* RXWRXW - FP Decimal */
864  { "FLOAT-DECIMAL-7", 0, 0, -1, /* Extension */
865  0, 0
866  },
867 #endif
868  { "FLOAT-EXTENDED", 0, 0, -1, /* 2002 */
869  0, 0
870  },
871  { "FLOAT-INFINITY", 0, 0, -1, /* 2011 */
872  0, 0
873  },
874  { "FLOAT-LONG", 0, 0, FLOAT_LONG, /* 2002 */
875  0, 0
876  },
877  { "FLOAT-NOT-A-NUMBER", 0, 1, -1, /* 2011 */
878  0, 0
879  },
880  { "FLOAT-SHORT", 0, 0, FLOAT_SHORT, /* 2002 */
881  0, 0
882  },
883  { "FOOTING", 0, 0, FOOTING, /* 2002 */
884  0, 0
885  },
886  { "FOR", 0, 0, FOR, /* 2002 */
887  0, 0
888  },
889  { "FOREGROUND-COLOR", 0, 0, FOREGROUND_COLOR, /* 2002 (C/S) */
890  0, 0
891  },
892  { "FOREGROUND-COLOUR", 0, 0, FOREGROUND_COLOR, /* Extension */
893  0, 0
894  },
895  { "FOREVER", 0, 0, FOREVER, /* 2002 (C/S) */
896  0, 0
897  },
898  { "FORMAT", 0, 0, -1, /* 2002 */
899  0, 0
900  },
901  { "FREE", 0, 0, FREE, /* 2002 */
902  0, 0
903  },
904  { "FROM", 0, 0, FROM, /* 2002 */
906  },
907  { "FULL", 0, 0, FULL, /* 2002 (C/S) */
908  0, 0
909  },
910  { "FUNCTION", 0, 0, FUNCTION, /* 2002 */
911  0, 0
912  },
913  { "FUNCTION-ID", 0, 0, FUNCTION_ID, /* 2002 */
914  0, 0
915  },
916  { "FUNCTION-POINTER", 0, 0, -1, /* 2014 */
917  0, 0
918  },
919  { "GENERATE", 0, 0, GENERATE, /* 2002 */
920  0, 0
921  },
922  { "GET", 0, 0, -1, /* 2002 */
923  0, 0
924  },
925  { "GIVING", 0, 0, GIVING, /* 2002 */
926  0, 0
927  },
928  { "GLOBAL", 0, 0, GLOBAL, /* 2002 */
929  0, 0
930  },
931  { "GO", 0, 0, GO, /* 2002 */
932  0, 0
933  },
934  { "GOBACK", 0, 0, GOBACK, /* 2002 */
935  0, 0
936  },
937  { "GREATER", 0, 0, GREATER, /* 2002 */
938  0, 0
939  },
940  { "GRID", 0, 0, GRID, /* Extension */
941  0, 0
942  },
943  { "GROUP", 0, 0, GROUP, /* 2002 */
944  0, 0
945  },
946  { "GROUP-USAGE", 0, 0, -1, /* 2002 */
947  0, 0
948  },
949  { "HEADING", 0, 0, HEADING, /* 2002 */
950  0, 0
951  },
952  { "HIGH-VALUE", 0, 0, HIGH_VALUE, /* 2002 */
953  0, 0
954  },
955  { "HIGH-VALUES", 0, 0, HIGH_VALUE, /* 2002 */
956  0, 0
957  },
958  { "HIGHLIGHT", 0, 0, HIGHLIGHT, /* 2002 (C/S) */
959  0, 0
960  },
961  { "I-O", 0, 0, I_O, /* 2002 */
962  0, 0
963  },
964  { "I-O-CONTROL", 0, 0, I_O_CONTROL, /* 2002 */
965  0, 0
966  },
967  { "ID", 0, 0, ID, /* Extension */
968  0, 0
969  },
970  { "IDENTIFICATION", 0, 0, IDENTIFICATION, /* 2002 */
971  0, 0
972  },
973  { "IF", 1, 0, IF, /* 2002 */
974  0, 0
975  },
976  { "IGNORE", 0, 0, IGNORE, /* Extension */
977  0, 0
978  },
979  { "IGNORING", 0, 0, IGNORING, /* 2002 (C/S) */
980  0, 0
981  },
982  { "IMPLEMENTS", 0, 1, -1, /* 2002 (C/S) */
983  0, 0
984  },
985  { "IN", 0, 0, IN, /* 2002 */
986  0, 0
987  },
988  { "INDEX", 0, 0, INDEX, /* 2002 */
989  0, 0
990  },
991  { "INDEXED", 0, 0, INDEXED, /* 2002 */
992  0, 0
993  },
994  { "INDICATE", 0, 0, INDICATE, /* 2002 */
995  0, 0
996  },
997  { "INDIRECT", 0, 1, -1, /* 2008 (C/S) */
998  0, 0
999  },
1000  { "INHERITS", 0, 0, -1, /* 2002 */
1001  0, 0
1002  },
1003  { "INITIAL", 0, 0, TOK_INITIAL, /* 2002 */
1004  0, 0
1005  },
1006  { "INITIALISE", 0, 0, INITIALIZE, /* Extension */
1007  0, 0
1008  },
1009  { "INITIALISED", 0, 0, INITIALIZED, /* Extension */
1010  0, 0
1011  },
1012  { "INITIALIZE", 0, 0, INITIALIZE, /* 2002 */
1013  0, 0
1014  },
1015  { "INITIALIZED", 0, 0, INITIALIZED, /* 2002 */
1016  0, 0
1017  /* FIXME: 2014 Context-sensitive to ALLOCATE statement and OCCURS clause */
1018  },
1019  { "INITIATE", 0, 0, INITIATE, /* 2002 */
1020  0, 0
1021  },
1022  { "INPUT", 0, 0, INPUT, /* 2002 */
1023  0, 0
1024  },
1025  { "INPUT-OUTPUT", 0, 0, INPUT_OUTPUT, /* 2002 */
1026  0, 0
1027  },
1028  { "INSPECT", 0, 0, INSPECT, /* 2002 */
1029  0, 0
1030  },
1031  { "INTERFACE", 0, 0, -1, /* 2002 */
1032  0, 0
1033  },
1034  { "INTERFACE-ID", 0, 0, -1, /* 2002 */
1035  0, 0
1036  },
1037  { "INTERMEDIATE", 0, 1, -1, /* 2008 (C/S) */
1038  0, 0
1039  /* FIXME: 2014 Context-sensitive to OPTIONS paragraph */
1040  },
1041  { "INTO", 0, 0, INTO, /* 2002 */
1042  0, 0
1043  },
1044  { "INTRINSIC", 0, 1, INTRINSIC, /* 2002 (C/S) */
1045  0, 0
1046  },
1047  { "INVALID", 0, 0, INVALID, /* 2002 */
1048  0, 0
1049  },
1050  { "INVOKE", 0, 0, -1, /* 2002 */
1051  0, 0
1052  },
1053  { "IS", 0, 0, IS, /* 2002 */
1054  0, 0
1055  },
1056  { "JUST", 0, 0, JUSTIFIED, /* 2002 */
1057  0, 0
1058  },
1059  { "JUSTIFIED", 0, 0, JUSTIFIED, /* 2002 */
1060  0, 0
1061  },
1062  { "KEPT", 0, 0, KEPT, /* Extension */
1063  0, 0
1064  },
1065  { "KEY", 0, 0, KEY, /* 2002 */
1066  0, 0
1067  },
1068  { "KEYBOARD", 0, 1, KEYBOARD, /* Extension */
1069  0, CB_CS_ASSIGN
1070  },
1071  { "LABEL", 0, 0, LABEL, /* 85 */
1072  0, 0
1073  },
1074  { "LAST", 0, 0, LAST, /* 2002 */
1075  0, 0
1076  },
1077  { "LC_ALL", 0, 1, -1, /* 2002 (C/S) */
1078  0, 0
1079  },
1080  { "LC_COLLATE", 0, 1, -1, /* 2002 (C/S) */
1081  0, 0
1082  },
1083  { "LC_CTYPE", 0, 1, -1, /* 2002 (C/S) */
1084  0, 0
1085  },
1086  { "LC_MESSAGES", 0, 1, -1, /* 2002 (C/S) */
1087  0, 0
1088  },
1089  { "LC_MONETARY", 0, 1, -1, /* 2002 (C/S) */
1090  0, 0
1091  },
1092  { "LC_NUMERIC", 0, 1, -1, /* 2002 (C/S) */
1093  0, 0
1094  },
1095  { "LC_TIME", 0, 1, -1, /* 2002 (C/S) */
1096  0, 0
1097  },
1098  { "LEADING", 0, 0, LEADING, /* 2002 */
1099  0, 0
1100  },
1101  { "LEFT", 0, 0, LEFT, /* 2002 */
1102  0, 0
1103  },
1104  { "LEFT-JUSTIFY", 0, 0, -1, /* Extension */
1105  0, 0
1106  },
1107  { "LEFTLINE", 0, 0, LEFTLINE, /* Extension */
1108  0, 0
1109  },
1110  { "LENGTH", 0, 0, LENGTH, /* 2002 */
1111  0, 0
1112  },
1113  { "LENGTH-CHECK", 0, 0, FULL, /* Extension */
1114  0, 0
1115  },
1116  { "LESS", 0, 0, LESS, /* 2002 */
1117  0, 0
1118  },
1119  { "LIMIT", 0, 0, LIMIT, /* 2002 */
1120  0, 0
1121  },
1122  { "LIMITS", 0, 0, LIMITS, /* 2002 */
1123  0, 0
1124  },
1125  { "LINAGE", 0, 0, LINAGE, /* 2002 */
1126  0, 0
1127  },
1128  { "LINAGE-COUNTER", 0, 0, LINAGE_COUNTER, /* 2002 */
1129  0, 0
1130  },
1131  { "LINE", 0, 0, LINE, /* 2002 */
1132  0, 0
1133  },
1134  { "LINE-COUNTER", 0, 0, LINE_COUNTER, /* 2002 */
1135  0, 0
1136  },
1137  { "LINES", 0, 0, LINES, /* 2002 */
1138  0, 0
1139  },
1140  { "LINKAGE", 0, 0, LINKAGE, /* 2002 */
1141  0, 0
1142  },
1143  { "LOCAL-STORAGE", 0, 0, LOCAL_STORAGE, /* 2002 */
1144  0, 0
1145  },
1146  { "LOCALE", 0, 0, LOCALE, /* 2002 */
1147  0, 0
1148  },
1149  { "LOCK", 0, 0, LOCK, /* 2002 */
1150  0, 0
1151  },
1152  { "LOW-VALUE", 0, 0, LOW_VALUE, /* 2002 */
1153  0, 0
1154  },
1155  { "LOW-VALUES", 0, 0, LOW_VALUE, /* 2002 */
1156  0, 0
1157  },
1158  { "LOWER", 0, 1, LOWER, /* Extension */
1159  0, CB_CS_WITH
1160  },
1161  { "LOWLIGHT", 0, 0, LOWLIGHT, /* 2002 (C/S) */
1162  0, 0
1163  },
1164  { "MANUAL", 0, 0, MANUAL, /* 2002 (C/S) */
1165  0, 0
1166  },
1167  { "MEMORY", 0, 0, MEMORY, /* 85 */
1168  0, 0
1169  },
1170  { "MERGE", 0, 0, MERGE, /* 2002 */
1171  0, 0
1172  },
1173  { "METHOD", 0, 0, -1, /* 2002 */
1174  0, 0
1175  },
1176  { "METHOD-ID", 0, 0, -1, /* 2002 */
1177  0, 0
1178  },
1179  { "MINUS", 0, 0, MINUS, /* 2002 */
1180  0, 0
1181  },
1182  { "MODE", 0, 0, MODE, /* 2002 */
1183  0, 0
1184  },
1185  { "MOVE", 0, 0, MOVE, /* 2002 */
1186  0, 0
1187  },
1188  { "MULTIPLE", 0, 0, MULTIPLE, /* 2002 (C/S) */
1189  0, 0
1190  },
1191  { "MULTIPLY", 1, 0, MULTIPLY, /* 2002 */
1192  0, 0
1193  },
1194  { "NAME", 0, 1, NAME, /* Extension */
1195  0, CB_CS_FROM
1196  },
1197  { "NATIONAL", 0, 0, NATIONAL, /* 2002 */
1198  0, 0
1199  },
1200  { "NATIONAL-EDITED", 0, 0, NATIONAL_EDITED, /* 2002 */
1201  0, 0
1202  },
1203  { "NATIVE", 0, 0, NATIVE, /* 2002 */
1204  0, 0
1205  },
1206  { "NEAREST-AWAY-FROM-ZERO", 0, 1, NEAREST_AWAY_FROM_ZERO, /* 2008 (C/S) */
1207  0, CB_CS_ROUNDED
1208  },
1209  { "NEAREST-EVEN", 0, 1, NEAREST_EVEN, /* 2008 (C/S) */
1210  0, CB_CS_ROUNDED
1211  },
1212  { "NEAREST-TOWARD-ZERO", 0, 1, NEAREST_TOWARD_ZERO, /* 2008 (C/S) */
1213  0, CB_CS_ROUNDED
1214  },
1215  { "NEGATIVE", 0, 0, NEGATIVE, /* 2002 */
1216  0, 0
1217  },
1218  { "NESTED", 0, 0, -1, /* 2002 */
1219  0, 0
1220  },
1221  { "NEXT", 0, 0, NEXT, /* 2002 */
1222  0, 0
1223  },
1224  { "NO", 0, 0, NO, /* 2002 */
1225  0, 0
1226  },
1227  { "NO-ECHO", 0, 0, NO_ECHO, /* Extension */
1228  0, 0
1229  },
1230  { "NONE", 0, 1, -1, /* 2002 (C/S) */
1231  0, 0
1232  },
1233  { "NORMAL", 0, 1, NORMAL, /* 2002 (C/S) */
1234  0, CB_CS_STOP
1235  },
1236  { "NOT", 0, 0, NOT, /* 2002 */
1237  0, 0
1238  },
1239  { "NOTHING", 0, 0, NOTHING, /* Extension */
1240  0, 0
1241  },
1242  { "NULL", 0, 0, TOK_NULL, /* 2002 */
1243  0, 0
1244  },
1245  { "NULLS", 0, 0, TOK_NULL, /* Extension */
1246  0, 0
1247  },
1248  { "NUMBER", 0, 0, NUMBER, /* 2002 */
1249  0, 0
1250  },
1251  { "NUMBERS", 0, 0, NUMBERS, /* 2002 (C/S) */
1252  0, 0
1253  },
1254  { "NUMERIC", 0, 0, NUMERIC, /* 2002 */
1255  0, 0
1256  },
1257  { "NUMERIC-EDITED", 0, 0, NUMERIC_EDITED, /* 2002 */
1258  0, 0
1259  },
1260  { "OBJECT", 0, 0, -1, /* 2002 */
1261  0, 0
1262  },
1263  { "OBJECT-COMPUTER", 0, 0, OBJECT_COMPUTER, /* 2002 */
1264  0, 0
1265  },
1266  { "OBJECT-REFERENCE", 0, 0, -1, /* 2002 */
1267  0, 0
1268  },
1269  { "OCCURS", 0, 0, OCCURS, /* 2002 */
1270  0, 0
1271  },
1272  { "OF", 0, 0, OF, /* 2002 */
1273  0, 0
1274  },
1275  { "OFF", 0, 0, OFF, /* 2002 */
1276  0, 0
1277  },
1278  { "OMITTED", 0, 0, OMITTED, /* 2002 */
1279  0, 0
1280  },
1281  { "ON", 0, 0, ON, /* 2002 */
1282  0, 0
1283  },
1284  { "ONLY", 0, 0, ONLY, /* 2002 (C/S) */
1285  0, 0
1286  },
1287  { "OPEN", 0, 0, OPEN, /* 2002 */
1288  0, 0
1289  },
1290  { "OPTIONAL", 0, 0, OPTIONAL, /* 2002 */
1291  0, 0
1292  },
1293  { "OPTIONS", 0, 0, -1, /* 2002 */
1294  0, 0
1295  },
1296  { "OR", 0, 0, OR, /* 2002 */
1297  0, 0
1298  },
1299  { "ORDER", 0, 0, ORDER, /* 2002 */
1300  0, 0
1301  },
1302  { "ORGANISATION", 0, 0, ORGANIZATION, /* Extension */
1303  0, 0
1304  },
1305  { "ORGANIZATION", 0, 0, ORGANIZATION, /* 2002 */
1306  0, 0
1307  },
1308  { "OTHER", 0, 0, OTHER, /* 2002 */
1309  0, 0
1310  },
1311  { "OUTPUT", 0, 0, OUTPUT, /* 2002 */
1312  0, 0
1313  },
1314  { "OVERFLOW", 0, 0, TOK_OVERFLOW, /* 2002 */
1315  0, 0
1316  },
1317  { "OVERLINE", 0, 0, OVERLINE, /* Extension */
1318  0, 0
1319  },
1320  { "OVERRIDE", 0, 0, -1, /* 2002 */
1321  0, 0
1322  },
1323  { "PACKED-DECIMAL", 0, 0, PACKED_DECIMAL, /* 2002 */
1324  0, 0
1325  },
1326  { "PADDING", 0, 0, PADDING, /* 2002 */
1327  0, 0
1328  },
1329  { "PAGE", 0, 0, PAGE, /* 2002 */
1330  0, 0
1331  },
1332  { "PAGE-COUNTER", 0, 0, PAGE_COUNTER, /* 2002 */
1333  0, 0
1334  },
1335  { "PARAGRAPH", 0, 1, PARAGRAPH, /* 2002 (C/S) */
1336  0, CB_CS_EXIT
1337  },
1338  { "PERFORM", 1, 0, PERFORM, /* 2002 */
1339  0, 0
1340  },
1341  { "PF", 0, 0, PF, /* 2002 */
1342  0, 0
1343  },
1344  { "PH", 0, 0, PH, /* 2002 */
1345  0, 0
1346  },
1347  { "PIC", 0, 0, PICTURE, /* 2002 */
1348  0, 0
1349  },
1350  { "PICTURE", 0, 0, PICTURE, /* 2002 */
1351  0, 0
1352  },
1353  { "PLUS", 0, 0, PLUS, /* 2002 */
1354  0, 0
1355  },
1356  { "POINTER", 0, 0, POINTER, /* 2002 */
1357  0, 0
1358  },
1359  { "POSITION", 0, 0, POSITION, /* 85 */
1360  0, 0
1361  },
1362  { "POSITIVE", 0, 0, POSITIVE, /* 2002 */
1363  0, 0
1364  },
1365  { "PREFIXED", 0, 1, -1, /* 2008 (C/S) */
1366  0, 0
1367  /* FIXME: 2014 Context-sensitive to ANY LENGTH STRUCTURE clause */
1368  },
1369  { "PRESENT", 0, 0, PRESENT, /* 2002 */
1370  0, 0
1371  },
1372  { "PREVIOUS", 0, 0, PREVIOUS, /* 2002 (C/S) */
1373  0, 0
1374  },
1375  { "PRINT", 0, 1, PRINT, /* Extension */
1376  0, CB_CS_ASSIGN
1377  },
1378  { "PRINTER", 0, 1, PRINTER, /* Extension */
1379  0, CB_CS_ASSIGN
1380  },
1381  { "PRINTER-1", 0, 1, PRINTER_1, /* Extension */
1382  0, CB_CS_ASSIGN
1383  },
1384  { "PRINTING", 0, 0, PRINTING, /* 2002 */
1385  0, 0
1386  },
1387  { "PROCEDURE", 0, 0, PROCEDURE, /* 2002 */
1388  0, 0
1389  },
1390  { "PROCEDURE-POINTER", 0, 0, PROGRAM_POINTER, /* Extension */
1391  0, 0
1392  },
1393  { "PROCEDURES", 0, 0, PROCEDURES, /* Extension */
1394  0, 0
1395  },
1396  { "PROCEED", 0, 0, PROCEED, /* 85 */
1397  0, 0
1398  },
1399  { "PROGRAM", 0, 0, PROGRAM, /* 2002 */
1400  0, 0
1401  },
1402  { "PROGRAM-ID", 0, 0, PROGRAM_ID, /* 2002 */
1403  0, 0
1404  },
1405  { "PROGRAM-POINTER", 0, 0, PROGRAM_POINTER, /* 2002 */
1406  0, 0
1407  },
1408  { "PROHIBITED", 0, 1, PROHIBITED, /* 2008 (C/S) */
1409  0, CB_CS_ROUNDED
1410  },
1411  { "PROMPT", 0, 0, PROMPT, /* Extension */
1412  0, 0
1413  },
1414  { "PROPERTY", 0, 0, -1, /* 2002 */
1415  0, 0
1416  },
1417  { "PROTECTED", 0, 0, PROTECTED, /* Extension */
1418  0, CB_CS_WITH
1419  },
1420  { "PROTOTYPE", 0, 0, -1, /* 2002 */
1421  0, 0
1422  },
1423  { "QUOTE", 0, 0, QUOTE, /* 2002 */
1424  0, 0
1425  },
1426  { "QUOTES", 0, 0, QUOTE, /* 2002 */
1427  0, 0
1428  },
1429  { "RAISE", 0, 0, -1, /* 2002 */
1430  0, 0
1431  },
1432  { "RAISING", 0, 0, -1, /* 2002 */
1433  0, 0
1434  },
1435  { "RANDOM", 0, 0, RANDOM, /* 2002 */
1436  0, 0
1437  },
1438  { "RD", 0, 0, RD, /* 2002 */
1439  0, 0
1440  },
1441  { "READ", 1, 0, READ, /* 2002 */
1442  0, 0
1443  },
1444  { "RECORD", 0, 0, RECORD, /* 2002 */
1445  0, 0
1446  },
1447  { "RECORDING", 0, 0, RECORDING, /* Extension */
1448  0, 0
1449  },
1450  { "RECORDS", 0, 0, RECORDS, /* 2002 */
1451  0, 0
1452  },
1453  { "RECURSIVE", 0, 1, RECURSIVE, /* 2002 (C/S) */
1454  0, CB_CS_PROGRAM_ID
1455  },
1456  { "REDEFINES", 0, 0, REDEFINES, /* 2002 */
1457  0, 0
1458  },
1459  { "REEL", 0, 0, REEL, /* 2002 */
1460  0, 0
1461  },
1462  { "REFERENCE", 0, 0, REFERENCE, /* 2002 */
1463  0, 0
1464  },
1465  { "REFERENCES", 0, 0, REFERENCES, /* Obsolete */
1466  0, 0
1467  },
1468  { "RELATION", 0, 1, -1, /* 2002 (C/S) */
1469  0, 0
1470  },
1471  { "RELATIVE", 0, 0, RELATIVE, /* 2002 */
1472  0, 0
1473  },
1474  { "RELEASE", 0, 0, RELEASE, /* 2002 */
1475  0, 0
1476  },
1477  { "REMAINDER", 0, 0, REMAINDER, /* 2002 */
1478  0, 0
1479  },
1480  { "REMOVAL", 0, 0, REMOVAL, /* 2002 */
1481  0, 0
1482  },
1483  { "RENAMES", 0, 0, RENAMES, /* 2002 */
1484  0, 0
1485  },
1486  { "REPLACE", 0, 0, REPLACE, /* 2002 */
1487  0, 0
1488  },
1489  { "REPLACING", 0, 0, REPLACING, /* 2002 */
1490  0, 0
1491  },
1492  { "REPORT", 0, 0, REPORT, /* 2002 */
1493  0, 0
1494  },
1495  { "REPORTING", 0, 0, REPORTING, /* 2002 */
1496  0, 0
1497  },
1498  { "REPORTS", 0, 0, REPORTS, /* 2002 */
1499  0, 0
1500  },
1501  { "REPOSITORY", 0, 0, REPOSITORY, /* 2002 */
1502  0, 0
1503  },
1504  { "REQUIRED", 0, 0, REQUIRED, /* 2002 (C/S) */
1505  0, 0
1506  },
1507  { "RESERVE", 0, 0, RESERVE, /* 2002 */
1508  0, 0
1509  },
1510  { "RESET", 0, 0, RESET, /* 2002 */
1511  0, 0
1512  },
1513  { "RESUME", 0, 0, -1, /* 2002 */
1514  0, 0
1515  },
1516  { "RETRY", 0, 0, -1, /* 2002 */
1517  0, 0
1518  },
1519  { "RETURN", 1, 0, RETURN, /* 2002 */
1520  0, 0
1521  },
1522  { "RETURNING", 0, 0, RETURNING, /* 2002 */
1523  0, 0
1524  },
1525  { "REVERSE-VIDEO", 0, 0, REVERSE_VIDEO, /* 2002 (C/S) */
1526  0, 0
1527  },
1528  { "REVERSED", 0, 0, REVERSED, /* Obsolete */
1529  0, 0
1530  },
1531  { "REWIND", 0, 0, REWIND, /* 2002 */
1532  0, 0
1533  },
1534  { "REWRITE", 1, 0, REWRITE, /* 2002 */
1535  0, 0
1536  },
1537  { "RF", 0, 0, RF, /* 2002 */
1538  0, 0
1539  },
1540  { "RH", 0, 0, RH, /* 2002 */
1541  0, 0
1542  },
1543  { "RIGHT", 0, 0, RIGHT, /* 2002 */
1544  0, 0
1545  },
1546  { "RIGHT-JUSTIFY", 0, 0, -1, /* Extension */
1547  0, 0
1548  },
1549  { "ROLLBACK", 0, 0, ROLLBACK, /* Extension */
1550  0, 0
1551  },
1552  { "ROUNDED", 0, 0, ROUNDED, /* 2002 */
1553  CB_CS_ROUNDED, 0
1554  },
1555  { "ROUNDING", 0, 1, -1, /* 2002 (C/S) */
1556  0, 0
1557  /* FIXME: 2014 Context-sensitive to OPTIONS paragraph */
1558  },
1559  { "RUN", 0, 0, RUN, /* 2002 */
1560  0, 0
1561  },
1562  { "SAME", 0, 0, SAME, /* 2002 */
1563  0, 0
1564  },
1565  { "SCREEN", 0, 0, SCREEN, /* 2002 */
1566  0, 0
1567  },
1568  { "SCROLL", 0, 1, SCROLL, /* Extension */
1569  0, CB_CS_WITH
1570  },
1571  { "SD", 0, 0, SD, /* 2002 */
1572  0, 0
1573  },
1574  { "SEARCH", 1, 0, SEARCH, /* 2002 */
1575  0, 0
1576  },
1577  { "SECONDS", 0, 1, -1, /* 2002 (C/S) */
1578  0, 0
1579  },
1580  { "SECTION", 0, 0, SECTION, /* 2002 */
1581  0, 0
1582  },
1583  { "SECURE", 0, 0, SECURE, /* 2002 (C/S) */
1584  0, 0
1585  },
1586  { "SEGMENT-LIMIT", 0, 0, SEGMENT_LIMIT, /* 85 */
1587  0, 0
1588  },
1589  { "SELECT", 0, 0, SELECT, /* 2002 */
1590  0, 0
1591  },
1592  { "SELF", 0, 0, -1, /* 2002 */
1593  0, 0
1594  },
1595  { "SENTENCE", 0, 0, SENTENCE, /* 2002 */
1596  0, 0
1597  },
1598  { "SEPARATE", 0, 0, SEPARATE, /* 2002 */
1599  0, 0
1600  },
1601  { "SEQUENCE", 0, 0, SEQUENCE, /* 2002 */
1602  0, 0
1603  },
1604  { "SEQUENTIAL", 0, 0, SEQUENTIAL, /* 2002 */
1605  0, 0
1606  },
1607  { "SET", 0, 0, SET, /* 2002 */
1608  0, 0
1609  },
1610  { "SHARING", 0, 0, SHARING, /* 2002 */
1611  0, 0
1612  },
1613 #if 0 /* FIXME: 2014 Context-sensitive to ANY LENGTH STRUCTURE clause */
1614  { "SHORT", 0, 0, -1, /* 2014 */
1615  0, 0
1616  },
1617 #endif
1618  { "SIGN", 0, 0, SIGN, /* 2002 */
1619  0, 0
1620  },
1621  { "SIGNED", 0, 0, SIGNED, /* 2002 (C/S) */
1622  0, 0
1623  /* FIXME: 2014 Context-sensitive to ANY LENGTH STRUCTURE clause
1624  and USAGE clause */
1625  },
1626  { "SIGNED-INT", 0, 0, SIGNED_INT, /* Extension */
1627  0, 0
1628  },
1629  { "SIGNED-LONG", 0, 0, SIGNED_LONG, /* Extension */
1630  0, 0
1631  },
1632  { "SIGNED-SHORT", 0, 0, SIGNED_SHORT, /* Extension */
1633  0, 0
1634  },
1635  { "SIZE", 0, 0, SIZE, /* 2002 */
1636  0, 0
1637  },
1638  { "SORT", 0, 0, SORT, /* 2002 */
1639  0, 0
1640  },
1641  { "SORT-MERGE", 0, 0, SORT_MERGE, /* 2002 */
1642  0, 0
1643  },
1644  { "SOURCE", 0, 0, SOURCE, /* 2002 */
1645  0, 0
1646  },
1647  { "SOURCE-COMPUTER", 0, 0, SOURCE_COMPUTER, /* 2002 */
1648  0, 0
1649  },
1650  { "SOURCES", 0, 0, -1, /* 2002 */
1651  0, 0
1652  },
1653  { "SPACE", 0, 0, SPACE, /* 2002 */
1654  0, 0
1655  },
1656  { "SPACE-FILL", 0, 0, -1, /* Extension */
1657  0, 0
1658  },
1659  { "SPACES", 0, 0, SPACE, /* 2002 */
1660  0, 0
1661  },
1662  { "SPECIAL-NAMES", 0, 0, SPECIAL_NAMES, /* 2002 */
1663  0, 0
1664  },
1665  { "STANDARD", 0, 0, STANDARD, /* 2002 */
1666  0, 0
1667  },
1668  /* Note EBCDIC! */
1669 #ifdef COB_EBCDIC_MACHINE
1670  /* FIXME: 2014 Both are Context-sensitive to ARITHMETIC clause */
1671  { "STANDARD-BINARY", 0, 1, -1, /* 2008 (C/S) */
1672  0, 0
1673  },
1674  { "STANDARD-DECIMAL", 0, 1, -1, /* 2008 (C/S) */
1675  0, 0
1676  },
1677 #endif
1678  { "STANDARD-1", 0, 0, STANDARD_1, /* 2002 */
1679  0, 0
1680  },
1681  { "STANDARD-2", 0, 0, STANDARD_2, /* 2002 */
1682  0, 0
1683  },
1684  /* Note EBCDIC! */
1685 #ifndef COB_EBCDIC_MACHINE
1686  { "STANDARD-BINARY", 0, 1, -1, /* 2008 (C/S) */
1687  0, 0
1688  },
1689  { "STANDARD-DECIMAL", 0, 1, -1, /* 2008 (C/S) */
1690  0, 0
1691  },
1692 #endif
1693  { "START", 1, 0, START, /* 2002 */
1694  0, 0
1695  },
1696  { "STATEMENT", 0, 1, -1, /* 2002 (C/S) */
1697  0, 0
1698  },
1699  { "STATIC", 0, 1, STATIC, /* Extension */
1700  0, CB_CS_CALL
1701  },
1702  { "STATUS", 0, 0, STATUS, /* 2002 */
1703  0, 0
1704  },
1705  { "STDCALL", 0, 1, STDCALL, /* Extension */
1706  0, CB_CS_CALL
1707  },
1708  { "STEP", 0, 0, STEP, /* 2002 (C/S) */
1709  0, 0
1710  },
1711  { "STOP", 0, 0, STOP, /* 2002 */
1712  CB_CS_STOP, 0
1713  },
1714  { "STRING", 1, 0, STRING, /* 2002 */
1715  0, 0
1716  },
1717  { "STRONG", 0, 1, -1, /* 2002 (C/S) */
1718  0, 0
1719  },
1720  { "SUBTRACT", 1, 0, SUBTRACT, /* 2002 */
1721  0, 0
1722  },
1723  { "SUM", 0, 0, SUM, /* 2002 */
1724  0, 0
1725  },
1726  { "SUPER", 0, 0, -1, /* 2002 */
1727  0, 0
1728  },
1729  { "SUPPRESS", 0, 0, SUPPRESS, /* 2002 */
1730  0, 0
1731  },
1732  { "SYMBOL", 0, 1, -1, /* 2002 (C/S) */
1733  0, 0
1734  },
1735  { "SYMBOLIC", 0, 0, SYMBOLIC, /* 2002 */
1736  0, 0
1737  },
1738  { "SYNC", 0, 0, SYNCHRONIZED, /* 2002 */
1739  0, 0
1740  },
1741  { "SYNCHRONISED", 0, 0, SYNCHRONIZED, /* Extension */
1742  0, 0
1743  },
1744  { "SYNCHRONIZED", 0, 0, SYNCHRONIZED, /* 2002 */
1745  0, 0
1746  },
1747  { "SYSTEM-DEFAULT", 0, 0, SYSTEM_DEFAULT, /* 2002 */
1748  0, 0
1749  },
1750  { "SYSTEM-OFFSET", 0, 0, SYSTEM_OFFSET, /* Extension */
1751  0, 0
1752  },
1753  { "TAB", 0, 1, TAB, /* Extension */
1754  0, CB_CS_ACCEPT
1755  },
1756  { "TABLE", 0, 0, -1, /* 2002 */
1757  0, 0
1758  },
1759  { "TALLYING", 0, 0, TALLYING, /* 2002 */
1760  0, 0
1761  },
1762  { "TAPE", 0, 1, TAPE, /* 85 */
1763  0, CB_CS_ASSIGN
1764  },
1765  { "TERMINATE", 0, 0, TERMINATE, /* 2002 */
1766  0, 0
1767  },
1768  { "TEST", 0, 0, TEST, /* 2002 */
1769  0, 0
1770  },
1771  { "THAN", 0, 0, THAN, /* 2002 */
1772  0, 0
1773  },
1774  { "THEN", 0, 0, THEN, /* 2002 */
1775  0, 0
1776  },
1777  { "THROUGH", 0, 0, THRU, /* 2002 */
1778  0, 0
1779  },
1780  { "THRU", 0, 0, THRU, /* 2002 */
1781  0, 0
1782  },
1783  { "TIME", 0, 0, TIME, /* 2002 */
1784  0, 0
1785  },
1786  { "TIME-OUT", 0, 1, TIMEOUT, /* Ext (C/S) */
1787  0, CB_CS_WITH
1788  },
1789  { "TIMEOUT", 0, 1, TIMEOUT, /* Ext (C/S) */
1790  0, CB_CS_WITH
1791  },
1792  { "TIMES", 0, 0, TIMES, /* 2002 */
1793  0, 0
1794  },
1795  { "TO", 0, 0, TO, /* 2002 */
1796  0, 0
1797  },
1798  { "TOP", 0, 0, TOP, /* 2002 */
1799  0, 0
1800  },
1801  { "TOWARD-GREATER", 0, 1, TOWARD_GREATER, /* 2014 (C/S) */
1802  0, CB_CS_ROUNDED
1803  },
1804  { "TOWARD-LESSER", 0, 1, TOWARD_LESSER, /* 2014 (C/S) */
1805  0, CB_CS_ROUNDED
1806  },
1807  { "TRAILING", 0, 0, TRAILING, /* 2002 */
1808  0, 0
1809  },
1810  { "TRAILING-SIGN", 0, 0, -1, /* Extension */
1811  0, 0
1812  },
1813  { "TRANSFORM", 0, 0, TRANSFORM, /* OSVS */
1814  0, 0
1815  },
1816  { "TRUE", 0, 0, TOK_TRUE, /* 2002 */
1817  0, 0
1818  },
1819  { "TRUNCATION", 0, 1, TRUNCATION, /* 2014 (C/S) */
1820  0, CB_CS_ROUNDED
1821  },
1822  { "TYPE", 0, 0, TYPE, /* 2002 */
1823  0, 0
1824  },
1825  { "TYPEDEF", 0, 0, -1, /* 2002 */
1826  0, 0
1827  },
1828  { "UCS-4", 0, 1, -1, /* 2002 (C/S) */
1829  0, 0
1830  },
1831  { "UNDERLINE", 0, 0, UNDERLINE, /* 2002 (C/S) */
1832  0, 0
1833  },
1834  { "UNIT", 0, 0, UNIT, /* 2002 */
1835  0, 0
1836  },
1837  { "UNIVERSAL", 0, 0, -1, /* 2002 */
1838  0, 0
1839  },
1840  { "UNLOCK", 0, 0, UNLOCK, /* 2002 */
1841  0, 0
1842  },
1843  { "UNSIGNED", 0, 0, UNSIGNED, /* 2002 (C/S) */
1844  0, 0
1845  },
1846  { "UNSIGNED-INT", 0, 0, UNSIGNED_INT, /* Extension */
1847  0, 0
1848  },
1849  { "UNSIGNED-LONG", 0, 0, UNSIGNED_LONG, /* Extension */
1850  0, 0
1851  },
1852  { "UNSIGNED-SHORT", 0, 0, UNSIGNED_SHORT, /* Extension */
1853  0, 0
1854  },
1855  { "UNSTRING", 1, 0, UNSTRING, /* 2002 */
1856  0, 0
1857  },
1858  { "UNTIL", 0, 0, UNTIL, /* 2002 */
1859  0, 0
1860  },
1861  { "UP", 0, 0, UP, /* 2002 */
1862  0, 0
1863  },
1864  { "UPDATE", 0, 0, UPDATE, /* Extension */
1865  0, 0
1866  },
1867  { "UPON", 0, 0, UPON, /* 2002 */
1868  0, 0
1869  },
1870  { "UPPER", 0, 1, UPPER, /* Extension */
1871  0, CB_CS_WITH
1872  },
1873  { "USAGE", 0, 0, USAGE, /* 2002 */
1874  0, 0
1875  },
1876  { "USE", 0, 0, USE, /* 2002 */
1877  0, 0
1878  },
1879  { "USER", 0, 1, USER, /* Extension */
1880  0, CB_CS_FROM
1881  },
1882  { "USER-DEFAULT", 0, 0, USER_DEFAULT, /* 2002 */
1883  0, 0
1884  },
1885  { "USING", 0, 0, USING, /* 2002 */
1886  0, 0
1887  },
1888  { "UTF-16", 0, 1, -1, /* 2002 (C/S) */
1889  0, 0
1890  },
1891  { "UTF-8", 0, 1, -1, /* 2002 (C/S) */
1892  0, 0
1893  },
1894  { "VAL-STATUS", 0, 0, -1, /* 2002 */
1895  0, 0
1896  },
1897  { "VALID", 0, 0, -1, /* 2002 */
1898  0, 0
1899  },
1900  { "VALIDATE", 0, 0, -1, /* 2002 */
1901  0, 0
1902  },
1903  { "VALIDATE-STATUS", 0, 0, -1, /* 2002 */
1904  0, 0
1905  },
1906  { "VALUE", 0, 0, VALUE, /* 2002 */
1907  0, 0
1908  },
1909  { "VALUES", 0, 0, VALUE, /* 2002 */
1910  0, 0
1911  },
1912  { "VARYING", 0, 0, VARYING, /* 2002 */
1913  0, 0
1914  },
1915  { "WAIT", 0, 0, WAIT, /* Extension */
1916  0, 0
1917  },
1918  { "WHEN", 0, 0, WHEN, /* 2002 */
1919  0, 0
1920  },
1921  { "WITH", 0, 0, WITH, /* 2002 */
1923  },
1924  { "WORDS", 0, 0, WORDS, /* 85 */
1925  0, 0
1926  },
1927  { "WORKING-STORAGE", 0, 0, WORKING_STORAGE, /* 2002 */
1928  0, 0
1929  },
1930  { "WRITE", 1, 0, WRITE, /* 2002 */
1931  0, 0
1932  },
1933  { "YYYYDDD", 0, 1, YYYYDDD, /* 2002 (C/S) */
1934  0, CB_CS_DAY
1935  },
1936  { "YYYYMMDD", 0, 1, YYYYMMDD, /* 2002 (C/S) */
1937  0, CB_CS_DATE
1938  },
1939  { "ZERO", 0, 0, ZERO, /* 2002 */
1940  0, 0
1941  },
1942  { "ZERO-FILL", 0, 0, -1, /* Extension */
1943  0, 0
1944  },
1945  { "ZEROES", 0, 0, ZERO, /* 2002 */
1946  0, 0
1947  },
1948  { "ZEROS", 0, 0, ZERO, /* 2002 */
1949  0, 0
1950  }
1951 };
1952 
1953 static size_t num_reserved_words;
1954 #define NUM_DEFAULT_RESERVED_WORDS \
1955  sizeof (default_reserved_words) / sizeof (struct cobc_reserved)
1956 
1957 /* Intrinsic Function List */
1958 /* Must be ordered on name for binary search */
1959 
1960 /* Name, Routine, */
1961 /* Token, Parser token, Implemented */
1962 /* Number of arguments: Max [-1 = unlimited], Min, */
1963 /* Category, Can refmod */
1964 
1965 static const struct cb_intrinsic_table function_list[] = {
1966  { "ABS", "cob_intr_abs",
1968  1, 1,
1970  },
1971  { "ACOS", "cob_intr_acos",
1973  1, 1,
1975  },
1976  { "ANNUITY", "cob_intr_annuity",
1978  2, 2,
1980  },
1981  { "ASIN", "cob_intr_asin",
1983  1, 1,
1985  },
1986  { "ATAN", "cob_intr_atan",
1988  1, 1,
1990  },
1991  { "BOOLEAN-OF-INTEGER", "cob_intr_boolean_of_integer",
1993  2, 2,
1995  },
1996  { "BYTE-LENGTH", "cob_intr_byte_length",
1998  1, 1,
2000  },
2001  { "CHAR", "cob_intr_char",
2003  1, 1,
2005  },
2006  { "CHAR-NATIONAL", "cob_intr_char_national",
2008  1, 1,
2010  },
2011  { "COMBINED-DATETIME", "cob_intr_combined_datetime",
2013  2, 2,
2015  },
2016  { "CONCATENATE", "cob_intr_concatenate",
2018  -1, 1,
2020  },
2021  { "COS", "cob_intr_cos",
2023  1, 1,
2025  },
2026  { "CURRENCY-SYMBOL", "cob_intr_currency_symbol",
2028  0, 0,
2030  },
2031  { "CURRENT-DATE", "cob_intr_current_date",
2033  0, 0,
2035  },
2036  { "DATE-OF-INTEGER", "cob_intr_date_of_integer",
2038  1, 1,
2040  },
2041  { "DATE-TO-YYYYMMDD", "cob_intr_date_to_yyyymmdd",
2043  3, 1,
2045  },
2046  { "DAY-OF-INTEGER", "cob_intr_day_of_integer",
2048  1, 1,
2050  },
2051  { "DAY-TO-YYYYDDD", "cob_intr_day_to_yyyyddd",
2053  3, 1,
2055  },
2056  { "DISPLAY-OF", "cob_intr_display_of",
2058  2, 1,
2060  },
2061  { "E", "cob_intr_e",
2063  0, 0,
2065  },
2066  { "EXCEPTION-FILE", "cob_intr_exception_file",
2068  0, 0,
2070  },
2071  { "EXCEPTION-FILE-N", "cob_intr_exception_file_n",
2073  0, 0,
2075  },
2076  { "EXCEPTION-LOCATION", "cob_intr_exception_location",
2078  0, 0,
2080  },
2081  { "EXCEPTION-LOCATION-N", "cob_intr_exception_location_n",
2083  0, 0,
2085  },
2086  { "EXCEPTION-STATEMENT", "cob_intr_exception_statement",
2088  0, 0,
2090  },
2091  { "EXCEPTION-STATUS", "cob_intr_exception_status",
2093  0, 0,
2095  },
2096  { "EXP", "cob_intr_exp",
2098  1, 1,
2100  },
2101  { "EXP10", "cob_intr_exp10",
2103  1, 1,
2105  },
2106  { "FACTORIAL", "cob_intr_factorial",
2108  1, 1,
2110  },
2111  { "FORMATTED-CURRENT-DATE", "cob_intr_formatted_current_date",
2113  1, 1,
2115  },
2116  { "FORMATTED-DATE", "cob_intr_formatted_date",
2118  2, 2,
2120  },
2121  { "FORMATTED-DATETIME", "cob_intr_formatted_datetime",
2123  /* including implicit SYSTEM-OFFSET arg */
2124  5, 4,
2126  },
2127  { "FORMATTED-TIME", "cob_intr_formatted_time",
2129  /* including implicit SYSTEM-OFFSET arg */
2130  4, 3,
2132  },
2133  { "FRACTION-PART", "cob_intr_fraction_part",
2135  1, 1,
2137  },
2138  { "HIGHEST-ALGEBRAIC", "cob_intr_highest_algebraic",
2140  1, 1,
2142  },
2143  { "INTEGER", "cob_intr_integer",
2145  1, 1,
2147  },
2148  { "INTEGER-OF-BOOLEAN", "cob_intr_integer_of_boolean",
2150  1, 1,
2152  },
2153  { "INTEGER-OF-DATE", "cob_intr_integer_of_date",
2155  1, 1,
2157  },
2158  { "INTEGER-OF-DAY", "cob_intr_integer_of_day",
2160  1, 1,
2162  },
2163  { "INTEGER-OF-FORMATTED-DATE", "cob_intr_integer_of_formatted_date",
2165  2, 2,
2167  },
2168  { "INTEGER-PART", "cob_intr_integer_part",
2170  1, 1,
2172  },
2173  { "LENGTH", "cob_intr_length",
2175  1, 1,
2177  },
2178  { "LENGTH-AN", "cob_intr_byte_length",
2180  1, 1,
2182  },
2183  { "LOCALE-COMPARE", "cob_intr_locale_compare",
2185  3, 2,
2187  },
2188  { "LOCALE-DATE", "cob_intr_locale_date",
2190  2, 1,
2192  },
2193  { "LOCALE-TIME", "cob_intr_locale_time",
2195  2, 1,
2197  },
2198  { "LOCALE-TIME-FROM-SECONDS", "cob_intr_lcl_time_from_secs",
2200  2, 1,
2202  },
2203  { "LOG", "cob_intr_log",
2205  1, 1,
2207  },
2208  { "LOG10", "cob_intr_log10",
2210  1, 1,
2212  },
2213  { "LOWER-CASE", "cob_intr_lower_case",
2215  1, 1,
2217  },
2218  { "LOWEST-ALGEBRAIC", "cob_intr_lowest_algebraic",
2220  1, 1,
2222  },
2223  { "MAX", "cob_intr_max",
2225  -1, 1,
2227  },
2228  { "MEAN", "cob_intr_mean",
2230  -1, 1,
2232  },
2233  { "MEDIAN", "cob_intr_median",
2235  -1, 1,
2237  },
2238  { "MIDRANGE", "cob_intr_midrange",
2240  -1, 1,
2242  },
2243  { "MIN", "cob_intr_min",
2245  -1, 1,
2247  },
2248  { "MOD", "cob_intr_mod",
2250  2, 2,
2252  },
2253  { "MODULE-CALLER-ID", "cob_intr_module_caller_id",
2255  0, 0,
2257  },
2258  { "MODULE-DATE", "cob_intr_module_date",
2260  0, 0,
2262  },
2263  { "MODULE-FORMATTED-DATE", "cob_intr_module_formatted_date",
2265  0, 0,
2267  },
2268  { "MODULE-ID", "cob_intr_module_id",
2270  0, 0,
2272  },
2273  { "MODULE-PATH", "cob_intr_module_path",
2275  0, 0,
2277  },
2278  { "MODULE-SOURCE", "cob_intr_module_source",
2280  0, 0,
2282  },
2283  { "MODULE-TIME", "cob_intr_module_time",
2285  0, 0,
2287  },
2288  { "MONETARY-DECIMAL-POINT", "cob_intr_mon_decimal_point",
2290  0, 0,
2292  },
2293  { "MONETARY-THOUSANDS-SEPARATOR", "cob_intr_mon_thousands_sep",
2295  0, 0,
2297  },
2298  { "NATIONAL-OF", "cob_intr_national_of",
2300  2, 1,
2302  },
2303  { "NUMERIC-DECIMAL-POINT", "cob_intr_num_decimal_point",
2305  0, 0,
2307  },
2308  { "NUMERIC-THOUSANDS-SEPARATOR", "cob_intr_num_thousands_sep",
2310  0, 0,
2312  },
2313  { "NUMVAL", "cob_intr_numval",
2315  1, 1,
2317  },
2318  { "NUMVAL-C", "cob_intr_numval_c",
2320  2, 2,
2322  },
2323  { "NUMVAL-F", "cob_intr_numval_f",
2325  1, 1,
2327  },
2328  { "ORD", "cob_intr_ord",
2330  1, 1,
2332  },
2333  { "ORD-MAX", "cob_intr_ord_max",
2335  -1, 1,
2337  },
2338  { "ORD-MIN", "cob_intr_ord_min",
2340  -1, 1,
2342  },
2343  { "PI", "cob_intr_pi",
2345  0, 0,
2347  },
2348  { "PRESENT-VALUE", "cob_intr_present_value",
2350  -1, 1,
2352  },
2353  { "RANDOM", "cob_intr_random",
2355  -1, 0,
2357  },
2358  { "RANGE", "cob_intr_range",
2360  -1, 1,
2362  },
2363  { "REM", "cob_intr_rem",
2365  2, 2,
2367  },
2368  { "REVERSE", "cob_intr_reverse",
2370  1, 1,
2372  },
2373  { "SECONDS-FROM-FORMATTED-TIME", "cob_intr_seconds_from_formatted_time",
2375  2, 2,
2377  },
2378  { "SECONDS-PAST-MIDNIGHT", "cob_intr_seconds_past_midnight",
2380  0, 0,
2382  },
2383  { "SIGN", "cob_intr_sign",
2385  1, 1,
2387  },
2388  { "SIN", "cob_intr_sin",
2390  1, 1,
2392  },
2393  { "SQRT", "cob_intr_sqrt",
2395  1, 1,
2397  },
2398  { "STANDARD-COMPARE", "cob_intr_standard_compare",
2400  4, 2,
2402  },
2403  { "STANDARD-DEVIATION", "cob_intr_standard_deviation",
2405  -1, 1,
2407  },
2408  { "STORED-CHAR-LENGTH", "cob_intr_stored_char_length",
2410  1, 1,
2412  },
2413  { "SUBSTITUTE", "cob_intr_substitute",
2415  -1, 3,
2417  },
2418  { "SUBSTITUTE-CASE", "cob_intr_substitute_case",
2420  -1, 3,
2422  },
2423  { "SUM", "cob_intr_sum",
2425  -1, 1,
2427  },
2428  { "TAN", "cob_intr_tan",
2430  1, 1,
2432  },
2433  { "TEST-DATE-YYYYMMDD", "cob_intr_test_date_yyyymmdd",
2435  1, 1,
2437  },
2438  { "TEST-DAY-YYYYDDD", "cob_intr_test_day_yyyyddd",
2440  1, 1,
2442  },
2443  { "TEST-FORMATTED-DATETIME", "cob_intr_test_formatted_datetime",
2445  2, 2,
2447  },
2448  { "TEST-NUMVAL", "cob_intr_test_numval",
2450  1, 1,
2452  },
2453  { "TEST-NUMVAL-C", "cob_intr_test_numval_c",
2455  2, 2,
2457  },
2458  { "TEST-NUMVAL-F", "cob_intr_test_numval_f",
2460  1, 1,
2462  },
2463  { "TRIM", "cob_intr_trim",
2464  CB_INTR_TRIM, TRIM_FUNC, 1,
2465  2, 1,
2467  },
2468  { "UPPER-CASE", "cob_intr_upper_case",
2470  1, 1,
2472  },
2473  { "VARIANCE", "cob_intr_variance",
2475  -1, 1,
2477  },
2478  { "WHEN-COMPILED", "cob_intr_when_compiled",
2480  0, 0,
2482  },
2483  { "YEAR-TO-YYYY", "cob_intr_year_to_yyyy",
2485  3, 1,
2487  }
2488 };
2489 
2490 #define NUM_INTRINSICS sizeof(function_list) / sizeof(struct cb_intrinsic_table)
2491 
2492 #ifdef HAVE_DESIGNATED_INITS
2493 static const unsigned char cob_lower_tab[256] = {
2494  ['a'] = 'A',
2495  ['b'] = 'B',
2496  ['c'] = 'C',
2497  ['d'] = 'D',
2498  ['e'] = 'E',
2499  ['f'] = 'F',
2500  ['g'] = 'G',
2501  ['h'] = 'H',
2502  ['i'] = 'I',
2503  ['j'] = 'J',
2504  ['k'] = 'K',
2505  ['l'] = 'L',
2506  ['m'] = 'M',
2507  ['n'] = 'N',
2508  ['o'] = 'O',
2509  ['p'] = 'P',
2510  ['q'] = 'Q',
2511  ['r'] = 'R',
2512  ['s'] = 'S',
2513  ['t'] = 'T',
2514  ['u'] = 'U',
2515  ['v'] = 'V',
2516  ['w'] = 'W',
2517  ['x'] = 'X',
2518  ['y'] = 'Y',
2519  ['z'] = 'Z'
2520 };
2521 #else
2522 static unsigned char cob_lower_tab[256];
2523 static const unsigned char pcob_lower_tab[] = "abcdefghijklmnopqrstuvwxyz";
2524 static const unsigned char pcob_lower_val[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
2525 #endif
2526 
2527 /* Local functions */
2528 
2529 static int
2530 cob_strcasecmp (const void *s1, const void *s2)
2531 {
2532  const unsigned char *p1;
2533  const unsigned char *p2;
2534  unsigned char c1;
2535  unsigned char c2;
2536 
2537  p1 = (const unsigned char *)s1;
2538  p2 = (const unsigned char *)s2;
2539 
2540  for (;;) {
2541  if (cob_lower_tab[*p1]) {
2542  c1 = cob_lower_tab[*p1++];
2543  } else {
2544  c1 = *p1++;
2545  }
2546 
2547  if (cob_lower_tab[*p2]) {
2548  c2 = cob_lower_tab[*p2++];
2549  } else {
2550  c2 = *p2++;
2551  }
2552 
2553  if (c1 != c2) {
2554  return c1 < c2 ? -1 : 1;
2555  }
2556  if (!c1) {
2557  break;
2558  }
2559  }
2560  return 0;
2561 }
2562 
2563 static int
2564 reserve_comp (const void *p1, const void *p2)
2565 {
2566  return cob_strcasecmp (((struct cobc_reserved *)p1)->name,
2567  ((struct cobc_reserved *)p2)->name);
2568 }
2569 
2570 static int
2571 intrinsic_comp (const void *p1, const void *p2)
2572 {
2573  return cob_strcasecmp (p1, ((struct cb_intrinsic_table *)p2)->name);
2574 }
2575 
2576 static const char *
2578 {
2579  const char *s;
2580 
2581  switch (category) {
2582  case CB_DEVICE_NAME:
2583  s = _("Device name");
2584  break;
2585  case CB_SWITCH_NAME:
2586  s = _("Switch name");
2587  break;
2588  case CB_FEATURE_NAME:
2589  s = _("Feature name");
2590  break;
2591  default:
2592  s = _("Unknown");
2593  break;
2594  }
2595  return s;
2596 }
2597 
2598 static struct cobc_reserved
2599 create_dummy_reserved (const char *word)
2600 {
2601  struct cobc_reserved ret;
2602 
2603  ret.name = word;
2604  ret.nodegen = 0;
2605  ret.context_sens = 0;
2606  ret.token = -1;
2607  ret.context_set = 0;
2608  ret.context_test = 0;
2609 
2610  return ret;
2611 }
2612 
2616 };
2617 
2618 static void
2620  const enum free_word_action action,
2621  struct reserved_word_list * to_delete)
2622 {
2623  if (prev) {
2624  prev->next = to_delete->next;
2625  }
2626  if (to_delete == cobc_user_res_list) {
2627  cobc_user_res_list = to_delete->next;
2628  }
2629 
2630  if (action == FREE_WORD_STR) {
2631  cobc_main_free (to_delete->word);
2632  }
2633 
2634  cobc_main_free (to_delete->alias_for);
2635 
2636  cobc_main_free (to_delete);
2637 }
2638 
2639 static COB_INLINE COB_A_INLINE int
2640 has_context_sensitive_indicator (const char *word, const size_t size)
2641 {
2642  return word[size - 1] == '*';
2643 }
2644 
2645 static void
2646 allocate_str_removing_asterisk (const char *word, const size_t size, char ** const out_str)
2647 {
2648  size_t chars_to_copy;
2649 
2650  if (has_context_sensitive_indicator (word, size)) {
2651  /* Don't copy the trailing asterisk */
2652  chars_to_copy = size - 1;
2653  } else {
2654  chars_to_copy = size;
2655  }
2656 
2657  *out_str = cobc_main_malloc (chars_to_copy + 1U);
2658  strncpy (*out_str, word, chars_to_copy);
2659  (*out_str)[chars_to_copy] = '\0';
2660 }
2661 
2662 static COB_INLINE COB_A_INLINE void
2663 initialize_word (const char *word, const size_t size,
2664  struct reserved_word_list * const reserved)
2665 {
2666  allocate_str_removing_asterisk (word, size, &reserved->word);
2667 }
2668 
2669 static void
2670 initialize_alias_for (const char *alias_for,
2671  struct reserved_word_list * const reserved,
2672  const char *fname, const int line)
2673 {
2674  const size_t size = strlen (alias_for);
2675 
2676  if (has_context_sensitive_indicator (alias_for, size)) {
2677  configuration_warning (fname, line, _("Ignored asterisk at end of alias target"));
2678  }
2679  allocate_str_removing_asterisk (alias_for, size, &reserved->alias_for);
2680 }
2681 
2682 static void
2683 add_reserved_word_without_init (const char *word, const char *fname,
2684  const int line)
2685 {
2686  struct reserved_word_list *reserved;
2687  size_t size;
2688  char *equal_sign_pos;
2689 
2690  /* Check the word has not already been specified */
2691  for (reserved = cobc_user_res_list; reserved; reserved = reserved->next)
2692  {
2693  if (cob_strcasecmp (reserved->word, word) == 0) {
2694  return;
2695  }
2696  }
2697 
2698  /* Find how the length of the word */
2699  equal_sign_pos = strchr (word, '=');
2700  if (equal_sign_pos) {
2701  size = equal_sign_pos - word;
2702  } else {
2703  size = strlen (word);
2704  }
2705 
2706  reserved = cobc_main_malloc (sizeof (struct reserved_word_list));
2707  reserved->is_context_sensitive
2708  = has_context_sensitive_indicator (word, size);
2709  initialize_word (word, size, reserved);
2710 
2711  /* If it is an alias, copy what it is an alias for */
2712  if (equal_sign_pos) {
2713  initialize_alias_for (equal_sign_pos + 1, reserved, fname,
2714  line);
2715  } else {
2716  reserved->alias_for = NULL;
2717  }
2718 
2719  /* Insert word at beginning of cobc_user_res_list. */
2720  reserved->next = cobc_user_res_list;
2721  cobc_user_res_list = reserved;
2722 }
2723 
2724 static void
2726 {
2727  const size_t num_default_words = NUM_DEFAULT_RESERVED_WORDS;
2728  int i;
2729 
2730  if (likely (cobc_user_res_list || cb_specify_all_reserved)) {
2731  return;
2732  }
2733 
2734  /* Initialize the list with the words from the default list. */
2735  for (i = 0; i < num_default_words; ++i) {
2736  add_reserved_word_without_init (default_reserved_words[i].name,
2737  NULL, 0);
2738  }
2739 }
2740 
2741 static size_t
2743 {
2745  size_t length;
2746 
2747  for (length = 0; l; ++length, l = l->next);
2748  return length;
2749 }
2750 
2751 static COB_INLINE COB_A_INLINE struct cobc_reserved *
2753 {
2754  return bsearch (to_find, default_reserved_words,
2756  sizeof (struct cobc_reserved), reserve_comp);
2757 }
2758 
2759 static struct cobc_reserved
2761 {
2762  struct cobc_reserved to_find;
2763  struct cobc_reserved cobc_reserved
2764  = create_dummy_reserved (user_reserved.word);
2765  struct cobc_reserved *p;
2766 
2767  if (!user_reserved.alias_for) {
2768  cobc_reserved.context_sens
2769  = user_reserved.is_context_sensitive;
2770  } else {
2771  to_find = create_dummy_reserved (user_reserved.alias_for);
2772  p = find_default_reserved_word (&to_find);
2773 
2774  if (p) {
2775  cobc_reserved.token = p->token;
2776  } else {
2777  configuration_error (NULL, 0, 1,
2778  _("Alias target '%s' is not a default reserved word"),
2779  user_reserved.alias_for);
2780  }
2781  }
2782 
2783  return cobc_reserved;
2784 }
2785 
2786 static COB_INLINE COB_A_INLINE void
2788 {
2789  delete_reserved_word_from_list (NULL, action, cobc_user_res_list);
2790 }
2791 
2792 static void
2794 {
2795  int i;
2796  struct cobc_reserved to_find;
2797  struct cobc_reserved *p;
2798 
2800  reserved_words = cobc_main_malloc (num_reserved_words
2801  * sizeof (struct cobc_reserved));
2802 
2803  /*
2804  Populate reserved_words array with data from default_reserved_words,
2805  where possible. Free each word once processed.
2806  */
2807  for (i = 0; cobc_user_res_list; ++i) {
2808  to_find = create_dummy_reserved (cobc_user_res_list->word);
2809  p = find_default_reserved_word (&to_find);
2810  if (p) {
2811  reserved_words[i] = *p;
2812  /*
2813  Note that we ignore if the user specified this word
2814  as context-sensitive.
2815  */
2816 
2817  /*
2818  We use the string literal in the default_reserved_
2819  words array.
2820  */
2822  } else {
2823  reserved_words[i] = get_user_specified_reserved_word (*cobc_user_res_list);
2824 
2825  /*
2826  We use the string copy allocated for cobc_user_res_
2827  list.
2828  */
2830  }
2831  }
2832 
2833  /* Later code assumes the array to be sorted */
2834  qsort (reserved_words, num_reserved_words,
2835  sizeof (struct cobc_reserved), reserve_comp);
2836 }
2837 
2838 static void
2840 {
2841  reserved_words = default_reserved_words;
2843 }
2844 
2845 static void
2847 {
2848  if (!reserved_words) {
2849  if (cobc_user_res_list) {
2851  } else {
2853  }
2854  }
2855 }
2856 
2857 /* Global functions */
2858 
2859 cb_tree
2861 {
2862  size_t i;
2863 
2864  for (i = 0; i < SYSTEM_TAB_SIZE; ++i) {
2865  if (cob_strcasecmp (name, system_table[i].name) == 0) {
2866  return cb_build_system_name (system_table[i].category,
2867  system_table[i].token);
2868  }
2869  }
2870  if (cb_flag_syntax_extension) {
2871  for (i = 0; i < EXT_SYSTEM_TAB_SIZE; ++i) {
2872  if (cob_strcasecmp (name, ext_system_table[i].name) == 0) {
2873  return cb_build_system_name (ext_system_table[i].category,
2874  ext_system_table[i].token);
2875  }
2876  }
2877  }
2878  return NULL;
2879 }
2880 
2881 void
2882 remove_reserved_word (const char *word)
2883 {
2884  struct reserved_word_list *reserved;
2885  struct reserved_word_list *prev = NULL;
2886 
2888 
2889  for (reserved = cobc_user_res_list; reserved; reserved = reserved->next) {
2890  /*
2891  We can only remove the word if it has already been specified.
2892  */
2893  if (cob_strcasecmp (reserved->word, word) == 0) {
2895  reserved);
2896  return;
2897  }
2898  prev = reserved;
2899  }
2900 }
2901 
2902 void
2903 add_reserved_word (const char *word, const char *fname, const int line)
2904 {
2906  add_reserved_word_without_init (word, fname, line);
2907 }
2908 
2909 struct cobc_reserved *
2911 {
2912  struct cobc_reserved *p;
2913  struct cobc_reserved to_find;
2914 
2916 
2917  to_find = create_dummy_reserved (name);
2918  p = bsearch (&to_find, reserved_words, num_reserved_words,
2919  sizeof (struct cobc_reserved), reserve_comp);
2920  if (!p) {
2921  return NULL;
2922  }
2923 
2924  /* Check word is implemented */
2925  if (unlikely(p->token <= 0)) {
2926  /* Not implemented - If context sensitive, no error */
2927  if (!p->context_sens) {
2928  cb_error (_("'%s' reserved word, but not supported"), name);
2929  }
2930  return NULL;
2931  }
2932 
2933  /* Special actions / Context sensitive */
2934  if (p->context_set) {
2935  if (unlikely(p->context_test)) {
2936  /* Dependent words */
2937  if (!(cobc_cs_check & p->context_test)) {
2938  return p;
2939  }
2940  }
2941  cobc_cs_check |= p->context_set;
2942  return p;
2943  }
2944 
2945  if (p->context_test) {
2946 #if 0 /* RXWRXW - CS check */
2947  if (!(cobc_cs_check & p->context_test)) {
2948 #endif
2949  if ((cobc_cs_check & p->context_test) != p->context_test) {
2950  return NULL;
2951  }
2952  if (!cobc_in_procedure) {
2953  cobc_cs_check = 0;
2954  }
2955  return p;
2956  }
2957 
2958  if (p->token == FUNCTION_ID) {
2959  cobc_cs_check = 0;
2960  cobc_force_literal = 1;
2961  } else if (p->token == INTRINSIC) {
2962  if (!cobc_in_repository) {
2963  return NULL;
2964  }
2965  } else if (p->token == PROGRAM_ID) {
2967  cobc_force_literal = 1;
2968  } else if (p->token == REPOSITORY) {
2969  cobc_in_repository = 1;
2970  }
2971 
2972  return p;
2973 }
2974 
2975 struct cb_intrinsic_table *
2976 lookup_intrinsic (const char *name, const int checkres, const int checkimpl)
2977 {
2978  struct cb_intrinsic_table *cbp;
2979 
2980  cbp = bsearch (name, function_list, NUM_INTRINSICS,
2981  sizeof (struct cb_intrinsic_table), intrinsic_comp);
2982  if (cbp && (checkimpl || cbp->implemented)) {
2983  return cbp;
2984  }
2985  return NULL;
2986 }
2987 
2988 void
2990 {
2991  const char *s;
2992  const char *p;
2993  size_t i;
2994  size_t n;
2995 
2997 
2998  putchar ('\n');
2999  printf (_("Reserved Words\t\t\tImplemented (Y/N)"));
3000  puts ("\n");
3001  for (i = 0; i < num_reserved_words; ++i) {
3002  n = strlen (reserved_words[i].name);
3003  switch (n / 8) {
3004  case 0:
3005  s = "\t\t\t\t";
3006  break;
3007  case 1:
3008  s = "\t\t\t";
3009  break;
3010  case 2:
3011  s = "\t\t";
3012  break;
3013  default:
3014  s = "\t";
3015  break;
3016  }
3017  if (reserved_words[i].token > 0) {
3018  if (reserved_words[i].context_sens) {
3019  p = _("Y (Context sensitive)");
3020  } else {
3021  p = _("Y");
3022  }
3023  } else {
3024  if (reserved_words[i].context_sens) {
3025  p = _("N (Context sensitive)");
3026  } else {
3027  p = _("N");
3028  }
3029  }
3030  printf ("%s%s%s\n", reserved_words[i].name, s, p);
3031  }
3032  putchar ('\n');
3033  puts (_("Extra (obsolete) context sensitive words"));
3034  puts ("AUTHOR");
3035  puts ("DATE-COMPILED");
3036  puts ("DATE-MODIFIED");
3037  puts ("DATE-WRITTEN");
3038  puts ("INSTALLATION");
3039  puts ("REMARKS");
3040  puts ("SECURITY");
3041  putchar ('\n');
3042  puts (_("Extra internal registers\tDefinition"));
3043  puts ("RETURN-CODE\t\t\tUSAGE BINARY-LONG");
3044  puts ("SORT-RETURN\t\t\tUSAGE BINARY-LONG");
3045  puts ("NUMBER-OF-CALL-PARAMETERS\tUSAGE BINARY-LONG");
3046  puts ("COB-CRT-STATUS\t\t\tPIC 9(4)");
3047  puts ("TALLY\t\t\t\tGLOBAL PIC 9(5) USAGE BINARY VALUE ZERO");
3048  puts ("'LENGTH OF' phrase\t\tUSAGE BINARY-LONG");
3049 }
3050 
3051 void
3053 {
3054  const char *s;
3055  const char *t;
3056  char *argnum;
3057  size_t i;
3058  size_t n;
3059 
3060  putchar ('\n');
3061  puts (_("Intrinsic Function\t\tImplemented\tParameters"));
3062  for (i = 0; i < NUM_INTRINSICS; ++i) {
3063  n = strlen (function_list[i].name);
3064  switch (n / 8) {
3065  case 0:
3066  s = "\t\t\t\t";
3067  break;
3068  case 1:
3069  s = "\t\t\t";
3070  break;
3071  case 2:
3072  s = "\t\t";
3073  break;
3074  default:
3075  s = "\t";
3076  break;
3077  }
3078  if (function_list[i].implemented) {
3079  t = _("Y");
3080  } else {
3081  t = _("N");
3082  }
3083  if (function_list[i].args == -1) {
3084  printf ("%s%s%s\t\t%s\n", function_list[i].name, s, t, _("Unlimited"));
3085  } else {
3086  if (function_list[i].args != function_list[i].min_args) {
3087  argnum = cob_malloc (7);
3088  snprintf (argnum, 7, "%d - %d", (int)function_list[i].min_args,
3089  (int)function_list[i].args);
3090  } else {
3091  argnum = cob_malloc (3);
3092  snprintf (argnum, 3, "%d", (int)function_list[i].args);
3093  }
3094  printf ("%s%s%s\t\t%s\n", function_list[i].name, s, t, argnum);
3095  cob_free (argnum);
3096  }
3097  }
3098 }
3099 
3100 void
3102 {
3103  const char *tabs;
3104  const char *feature;
3105  size_t i;
3106 
3107  putchar ('\n');
3108  puts (_("Mnemonic names"));
3109  for (i = 0; i < SYSTEM_TAB_SIZE; ++i) {
3110  if (strlen (system_table[i].name) < 8) {
3111  tabs = "\t\t";
3112  } else {
3113  tabs = "\t";
3114  }
3115  feature = res_get_feature (system_table[i].category);
3116  printf ("%s%s%s\n", system_table[i].name, tabs, feature);
3117  }
3118  putchar ('\n');
3119  puts (_("Extended mnemonic names (with -fsyntax-extension)"));
3120  for (i = 0; i < EXT_SYSTEM_TAB_SIZE; ++i) {
3121  if (strlen (ext_system_table[i].name) < 8) {
3122  tabs = "\t\t";
3123  } else {
3124  tabs = "\t";
3125  }
3126  feature = res_get_feature (ext_system_table[i].category);
3127  printf ("%s%s%s\n", ext_system_table[i].name, tabs, feature);
3128  }
3129 }
3130 
3131 #ifndef HAVE_DESIGNATED_INITS
3132 void
3134 {
3135  const unsigned char *p;
3136  const unsigned char *v;
3137 
3138  memset (cob_lower_tab, 0, sizeof(cob_lower_tab));
3139  p = pcob_lower_tab;
3140  v = pcob_lower_val;
3141  for (; *p; ++p, ++v) {
3142  cob_lower_tab[*p] = *v;
3143  }
3144 }
3145 #endif
static COB_INLINE COB_A_INLINE void pop_reserved_word(const enum free_word_action action)
Definition: reserved.c:2787
Definition: parser.c:1852
#define CB_SWITCH_22
Definition: tree.h:180
#define CB_FEATURE_C01
Definition: tree.h:198
Definition: parser.c:1532
void cob_free(void *mptr)
Definition: common.c:1284
static size_t get_length_of_user_res_list(void)
Definition: reserved.c:2742
Definition: parser.c:1437
Definition: parser.c:1583
#define CB_SWITCH_1
Definition: tree.h:159
void * cobc_main_malloc(const size_t size)
Definition: cobc.c:702
const char * name
Definition: tree.h:979
Definition: parser.c:1577
Definition: parser.c:1792
Definition: parser.c:1504
unsigned int cobc_force_literal
Definition: parser.c:181
Definition: parser.c:1563
Definition: parser.c:1785
#define CB_FEATURE_C07
Definition: tree.h:204
static void add_reserved_word_without_init(const char *word, const char *fname, const int line)
Definition: reserved.c:2683
#define CB_FEATURE_C10
Definition: tree.h:207
#define CB_FEATURE_C09
Definition: tree.h:206
const int implemented
Definition: tree.h:983
Definition: parser.c:1364
static void initialize_alias_for(const char *alias_for, struct reserved_word_list *const reserved, const char *fname, const int line)
Definition: reserved.c:2670
#define CB_SWITCH_20
Definition: tree.h:178
Definition: parser.c:1363
Definition: parser.c:1653
#define CB_DEVICE_SYSOUT
Definition: tree.h:154
#define CB_SWITCH_8
Definition: tree.h:166
static size_t num_reserved_words
Definition: reserved.c:1953
const int min_args
Definition: tree.h:985
Definition: parser.c:1671
static void initialize_user_res_list_if_needed(void)
Definition: reserved.c:2725
Definition: parser.c:1562
#define CB_DEVICE_SYSERR
Definition: tree.h:155
Definition: parser.c:1392
Definition: parser.c:1592
unsigned short context_sens
Definition: tree.h:420
const int token
Definition: tree.h:982
#define CB_SWITCH_9
Definition: tree.h:167
static struct cobc_reserved default_reserved_words[]
Definition: reserved.c:200
Definition: parser.c:1856
static void initialize_reserved_words_if_needed(void)
Definition: reserved.c:2846
void add_reserved_word(const char *word, const char *fname, const int line)
Definition: reserved.c:2903
#define SYSTEM_TAB_SIZE
Definition: reserved.c:114
#define CB_CS_ASSIGN
Definition: cobc.h:105
#define CB_FEATURE_FORMFEED
Definition: tree.h:196
Definition: parser.c:1389
#define NUM_INTRINSICS
Definition: reserved.c:2490
#define CB_SWITCH_35
Definition: tree.h:193
#define CB_SWITCH_0
Definition: tree.h:158
void cb_list_intrinsics(void)
Definition: reserved.c:3052
static void get_reserved_words_from_user_list(void)
Definition: reserved.c:2793
static int intrinsic_comp(const void *p1, const void *p2)
Definition: reserved.c:2571
struct cb_intrinsic_table * lookup_intrinsic(const char *name, const int checkres, const int checkimpl)
Definition: reserved.c:2976
Definition: parser.c:1854
void cb_list_mnemonics(void)
Definition: reserved.c:3101
#define CB_SWITCH_36
Definition: tree.h:194
#define COB_INLINE
Definition: common.h:354
Definition: parser.c:1366
Definition: parser.c:1397
Definition: parser.c:1659
Definition: parser.c:1843
void remove_reserved_word(const char *word)
Definition: reserved.c:2882
static unsigned char cob_lower_tab[256]
Definition: reserved.c:2522
Definition: parser.c:1450
Definition: parser.c:1613
Definition: parser.c:1445
void cobc_main_free(void *prevptr)
Definition: cobc.c:778
#define CB_CS_DATE
Definition: cobc.h:108
Definition: parser.c:1697
Definition: parser.c:1655
Definition: parser.c:1365
Definition: parser.c:1409
Definition: parser.c:1695
Definition: parser.c:1796
static const unsigned char pcob_lower_val[]
Definition: reserved.c:2524
Definition: parser.c:1793
#define CB_CS_EXIT
Definition: cobc.h:112
Definition: parser.c:1404
#define CB_SWITCH_17
Definition: tree.h:175
struct reserved_word_list * cobc_user_res_list
Definition: reserved.c:36
Definition: parser.c:1606
Definition: parser.c:1379
Definition: parser.c:1371
Definition: parser.c:1839
Definition: parser.c:1405
Definition: parser.c:1440
void configuration_warning(const char *, const int, const char *,...) COB_A_FORMAT34
Definition: error.c:144
free_word_action
Definition: reserved.c:2613
Definition: parser.c:1520
Definition: parser.c:1580
static const char * res_get_feature(const enum cb_system_name_category category)
Definition: reserved.c:2577
Definition: parser.c:1381
Definition: parser.c:1815
Definition: parser.c:1471
int is_context_sensitive
Definition: cobc.h:225
Definition: parser.c:1607
Definition: parser.c:1787
Definition: parser.c:1731
Definition: parser.c:1842
static struct cobc_reserved * reserved_words
Definition: reserved.c:198
Definition: parser.c:1596
static int reserve_comp(const void *p1, const void *p2)
Definition: reserved.c:2564
void cobc_init_reserved(void)
Definition: reserved.c:3133
Definition: parser.c:1773
Definition: parser.c:1388
#define CB_FEATURE_C02
Definition: tree.h:199
unsigned int context_set
Definition: tree.h:422
#define CB_SWITCH_29
Definition: tree.h:187
Definition: parser.c:1553
unsigned int cobc_in_repository
Definition: parser.c:180
Definition: parser.c:1417
static const struct cb_intrinsic_table function_list[]
Definition: reserved.c:1965
Definition: parser.c:1631
Definition: parser.c:1584
Definition: parser.c:1557
Definition: parser.c:1789
#define VALUE(offset)
Definition: typeck.c:71
#define _(s)
Definition: cobcrun.c:59
Definition: parser.c:1841
cb_tree lookup_system_name(const char *name)
Definition: reserved.c:2860
Definition: parser.c:1629
Definition: parser.c:1496
#define EXT_SYSTEM_TAB_SIZE
Definition: reserved.c:188
#define unlikely(x)
Definition: common.h:437
#define CB_DEVICE_SYSIN
Definition: tree.h:153
Definition: parser.c:1348
Definition: parser.c:1662
enum cb_system_name_category category
Definition: reserved.c:42
Definition: parser.c:1672
#define CB_FEATURE_C11
Definition: tree.h:208
#define CB_FEATURE_C03
Definition: tree.h:200
Definition: parser.c:1698
#define CB_SWITCH_3
Definition: tree.h:161
cb_system_name_category
Definition: tree.h:138
#define CB_SWITCH_2
Definition: tree.h:160
static void allocate_str_removing_asterisk(const char *word, const size_t size, char **const out_str)
Definition: reserved.c:2646
#define CB_CS_ALPHABET
Definition: cobc.h:104
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
Definition: parser.c:1774
Definition: parser.c:1735
Definition: parser.c:1539
Definition: parser.c:1859
#define CB_CS_CONSTANT
Definition: cobc.h:107
#define CB_SWITCH_25
Definition: tree.h:183
Definition: parser.c:1569
Definition: parser.c:1598
struct reserved_word_list * next
Definition: cobc.h:223
Definition: parser.c:1559
Definition: parser.c:1590
#define CB_SWITCH_31
Definition: tree.h:189
#define CB_SWITCH_7
Definition: tree.h:165
Definition: parser.c:1652
struct cobc_reserved * lookup_reserved_word(const char *name)
Definition: reserved.c:2910
#define CB_SWITCH_32
Definition: tree.h:190
#define CB_CS_CALL
Definition: cobc.h:106
static const unsigned char pcob_lower_tab[]
Definition: reserved.c:2523
Definition: parser.c:1373
#define CB_SWITCH_19
Definition: tree.h:177
#define CB_CS_ROUNDED
Definition: cobc.h:115
Definition: parser.c:1751
Definition: parser.c:1351
static COB_INLINE COB_A_INLINE struct cobc_reserved * find_default_reserved_word(struct cobc_reserved *to_find)
Definition: reserved.c:2752
Definition: parser.c:1779
enum cb_category category
Definition: tree.h:986
Definition: parser.c:1681
const int token
Definition: reserved.c:43
const int args
Definition: tree.h:984
void cb_list_reserved(void)
Definition: reserved.c:2989
static void get_reserved_words_from_default_list(void)
Definition: reserved.c:2839
Definition: parser.c:1572
Definition: parser.c:1849
Definition: parser.c:1467
Definition: parser.c:1758
#define CB_FEATURE_CONVENTION
Definition: tree.h:197
Definition: parser.c:1736
Definition: parser.c:1446
Definition: parser.c:1375
Definition: parser.c:1473
Definition: parser.c:1447
#define CB_SWITCH_27
Definition: tree.h:185
#define CB_CS_DAY
Definition: cobc.h:109
#define CB_CS_FROM
Definition: cobc.h:113
unsigned short nodegen
Definition: tree.h:419
#define CB_CS_STOP
Definition: cobc.h:117
Definition: parser.c:1616
#define CB_SWITCH_30
Definition: tree.h:188
Definition: parser.c:1503
Definition: parser.c:1705
#define CB_DEVICE_CONSOLE
Definition: tree.h:156
Definition: parser.c:1541
#define CB_SWITCH_24
Definition: tree.h:182
char * alias_for
Definition: cobc.h:226
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
Definition: parser.c:1657
Definition: parser.c:1394
#define COB_A_INLINE
Definition: common.h:440
Definition: parser.c:1850
#define CB_FEATURE_C04
Definition: tree.h:201
#define CB_FEATURE_C12
Definition: tree.h:209
Definition: parser.c:1764
Definition: parser.c:1732
static struct cobc_reserved create_dummy_reserved(const char *word)
Definition: reserved.c:2599
void configuration_error(const char *, const int, const int, const char *,...) COB_A_FORMAT45
Definition: error.c:178
static int cob_strcasecmp(const void *s1, const void *s2)
Definition: reserved.c:2530
#define CB_SWITCH_18
Definition: tree.h:176
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
Definition: parser.c:1656
Definition: parser.c:1660
Definition: parser.c:1472
#define CB_SWITCH_33
Definition: tree.h:191
Definition: parser.c:1586
unsigned int cobc_in_procedure
Definition: parser.c:179
#define CB_CS_DISPLAY
Definition: cobc.h:110
Definition: parser.c:1753
Definition: parser.c:1824
Definition: parser.c:1448
#define CB_SWITCH_16
Definition: tree.h:174
Definition: parser.c:1760
Definition: parser.c:1538
Definition: parser.c:1790
#define CB_CS_ERASE
Definition: cobc.h:111
Definition: parser.c:1361
Definition: parser.c:1675
Definition: parser.c:1552
static void delete_reserved_word_from_list(struct reserved_word_list *const prev, const enum free_word_action action, struct reserved_word_list *to_delete)
Definition: reserved.c:2619
Definition: parser.c:1831
Definition: parser.c:1634
int token
Definition: tree.h:421
Definition: parser.c:1398
const char * name
Definition: tree.h:418
Definition: parser.c:1505
Definition: parser.c:1721
void * cob_malloc(const size_t size)
Definition: common.c:1250
static COB_INLINE COB_A_INLINE void initialize_word(const char *word, const size_t size, struct reserved_word_list *const reserved)
Definition: reserved.c:2663
#define CB_SWITCH_26
Definition: tree.h:184
Definition: parser.c:1617
#define CB_CS_SET
Definition: cobc.h:116
#define CB_SWITCH_12
Definition: tree.h:170
Definition: parser.c:1581
Definition: parser.c:1769
#define CB_FEATURE_C05
Definition: tree.h:202
#define CB_SWITCH_23
Definition: tree.h:181
Definition: parser.c:1360
Definition: parser.c:1834
#define CB_SWITCH_4
Definition: tree.h:162
Definition: parser.c:1667
Definition: parser.c:1412
Definition: parser.c:1502
char * word
Definition: cobc.h:224
Definition: parser.c:1614
#define CB_CS_ACCEPT
Definition: cobc.h:103
Definition: parser.c:1501
Definition: parser.c:1832
unsigned int cobc_cs_check
Definition: parser.c:182
Definition: parser.c:1462
#define CB_SWITCH_14
Definition: tree.h:172
static const struct system_struct ext_system_table[]
Definition: reserved.c:116
Definition: parser.c:1791
#define CB_FEATURE_C06
Definition: tree.h:203
static struct cobc_reserved get_user_specified_reserved_word(struct reserved_word_list user_reserved)
Definition: reserved.c:2760
Definition: parser.c:1521
#define NUM_DEFAULT_RESERVED_WORDS
Definition: reserved.c:1954
Definition: parser.c:1795
const char * name
Definition: reserved.c:41
#define CB_FEATURE_C08
Definition: tree.h:205
#define CB_CS_WITH
Definition: cobc.h:118
Definition: parser.c:1369
Definition: parser.c:1500
Definition: parser.c:1548
Definition: parser.c:1512
Definition: parser.c:1402
Definition: parser.c:1730
Definition: parser.c:1390
Definition: parser.c:1352
#define CB_SWITCH_5
Definition: tree.h:163
#define CB_SWITCH_13
Definition: tree.h:171
#define CB_CS_PROGRAM_ID
Definition: cobc.h:114
#define CB_SWITCH_21
Definition: tree.h:179
#define CB_SWITCH_15
Definition: tree.h:173
#define likely(x)
Definition: common.h:436
#define CB_SWITCH_28
Definition: tree.h:186
Definition: parser.c:1740
Definition: parser.c:1576
Definition: parser.c:1822
Definition: parser.c:1439
Definition: parser.c:1516
Definition: parser.c:1620
unsigned int context_test
Definition: tree.h:423
#define CB_SWITCH_11
Definition: tree.h:169
cb_tree cb_build_system_name(const enum cb_system_name_category category, const int token)
Definition: tree.c:1667
Definition: parser.c:1846
Definition: parser.c:1408
#define CB_SWITCH_10
Definition: tree.h:168
#define CB_SWITCH_34
Definition: tree.h:192
Definition: parser.c:1461
static COB_INLINE COB_A_INLINE int has_context_sensitive_indicator(const char *word, const size_t size)
Definition: reserved.c:2640
#define CB_SWITCH_6
Definition: tree.h:164