The table form of the VALUE clause, with FROM and TO, does nothing in cobc. A table such as OCCURS 3 TIMES VALUES 1 2 3 FROM (1) keeps its default content (zeros), and inside a larger record the FROM and TO phrases are mostly ignored. cobc gives no diagnostic, so the program runs with tables that were never initialized as written.
tfy.cob (attached) has two stand-alone tables:
IDENTIFICATION DIVISION.
PROGRAM-ID. TFY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 T.
05 E PIC 9 OCCURS 3 TIMES VALUES 1 2 3 FROM (1).
01 U.
05 F PIC 9 OCCURS 3 TIMES VALUES 0 FROM (1) TO (1) 7 FROM (2) TO (3).
PROCEDURE DIVISION.
DISPLAY E (1) E (2) E (3) " " F (1) F (2) F (3)
STOP RUN.
cobc -std=cobol2014 -fformat=free -Wall -x tfy.cob && ./tfy
Output on 3.2.0 (run exit 0):
000 000
The output is the same with the default dialect. In the C generated with -C, the WORKING-STORAGE initialization of both tables is only:
/* initialize field E */
memset (b_1, 48, 3);
/* initialize field F */
memset (b_3, 48, 3);
3.3-dev r5751 gives byte-identical output in both dialects (run exit 0).
The BS2000 form without FROM, 05 E PIC 9 OCCURS 3 TIMES VALUES 1 2 3. alone in a record (tfz.cob attached, displaying E (1) E (2) E (3)), also prints 000 on both versions, with the default dialect and with -std=bs2000.
tfm.cob (attached) puts several tables in one record:
IDENTIFICATION DIVISION.
PROGRAM-ID. TFM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 T.
05 G OCCURS 1 TIMES.
10 H PIC X VALUES "Z" FROM (1).
05 E PIC 9 OCCURS 3 TIMES VALUES 1 2 3 FROM (1).
05 F PIC 9 OCCURS 3 TIMES VALUES 0 FROM (1) TO (1) 7 FROM (2) TO (3).
05 W PIC 9 OCCURS 3 TIMES VALUES 7 FROM (1) TO (3).
05 S PIC 9 OCCURS 3 TIMES VALUES 8 FROM (2) TO (3).
PROCEDURE DIVISION.
DISPLAY H (1) " " E (1) E (2) E (3) " " F (1) F (2) F (3)
" " W (1) W (2) W (3) " " S (2) S (3)
STOP RUN.
Output of cobc -std=cobol2014 -fformat=free -Wall -x tfm.cob && ./tfm on 3.2.0 (run exit 0):
123 000 700 00
3.3-dev r5751 gives byte-identical output with the same command (run exit 0).
Here E is right, but H is a space, F gets nothing from its second range, W gets the literal once instead of up to element 3, and S (2) and S (3) stay 0.
tfy should print 123 077, and tfm should print Z 123 077 777 88. ISO/IEC 1989:2023 §13.18.63 (VALUE clause), format 2 (table), is {VALUE IS | VALUES ARE} {{literal-1}... FROM ({subscript-1}...) [TO ({subscript-2}...)]}.... The 2002 and 2014 editions have the same format and rules.
The NEWS file says "OCCURS with multiple VALUEs supported (BS2000 format, FROM and TO pending)". While FROM and TO are pending, a diagnostic for the clause would at least avoid a table that silently keeps its default content.
The attached table-value-from-to-silent.patch (against 3.3-dev r5751, applies with patch -p1 at the top of the tree) changes cobc/codegen.c, cobc/parser.y and cobc/field.c:
output_initialize_compound: the memset shortcut for an OCCURS item with table VALUES now sets needs_table_format_value. The deferred multi-value step then also runs for a record whose only table VALUES are such items (tfy.cob, tfz.cob).output_initialize_multi_values: each entry of the clause is now handled in order by a new output_initialize_value_entry. An entry starts at its FROM element (or the first element). It steps the least inclusive subscript and carries into the next one (rule 12). It reuses the literals until the TO element is initialized, or the last element when there is no TO (rules 13 and 14). Because entries run in order, a later FROM overrides an earlier one (rule 15). The same routine handles the BS2000 forms: REPEATED integer TIMES (previously used once), REPEATED TO END, and every entry of a repeated VALUE FROM (...) IS (previously only the first). An OCCURS 1 level no longer skips the step, which left H in tfm.cob blank. The routine replaces incr_table_index, get_table_offset and their static state, which only this function used.parser.y: value_table_item without TO passes cb_null as the repeat count ("to the last element", rule 14). This separates it from the BS2000 FROM form, where the literals are used once. value_from_subscripts_is_are returned the FROM token ($2) instead of the subscripts ($3), so VALUE FROM (2) IS 5 6 started at element 1.field.c validate_multi_value: checks that FROM and TO have one subscript per OCCURS level and that each is within its OCCURS (syntax rules 20 and 21), reusing the messages '%s' requires %d subscripts and subscript of '%s' out of bounds: %d. It now checks the literal count per entry against the elements from that entry's FROM element on, instead of the sum over all entries. Before, an out-of-range FROM compiled silently, and two overlapping entries could be refused although rule 15 allows them.With the patch, using the built-in-tree cobc and libcob, every compile exits 0 with no diagnostic and every run exits 0:
$ cobc -std=cobol2014 -fformat=free -Wall -x tfy.cob && ./tfy
123 077
$ cobc -std=cobol2014 -fformat=free -Wall -x tfm.cob && ./tfm
Z 123 077 777 88
$ cobc -std=cobol2014 -fformat=free -Wall -x tfz.cob && ./tfz
123
The default dialect gives the same three outputs, and tfz.cob with -std=bs2000 prints 123.
make check on 3.3-dev r5751 with the patch: 1,373 behaved as expected, 9 skipped, 0 failed, as unpatched (1,372 + the new test). The new test 705 "table-format VALUES with FROM and TO" (tests/testsuite.src/run_initialize.at) passes. It covers single and two-level FROM/TO, a later FROM overriding an earlier one, OCCURS 1, REPEATED 2 TIMES, REPEATED TO END, VALUE FROM (2) IS, INITIALIZE ... ALL TO VALUE, and the new FROM/TO diagnostics. The existing test "INITIALIZE to table-format VALUES ARE" passes unchanged.
The patch leaves two things as they are. First, the parser still checks FROM <= TO subscript by subscript (entry in FROM (%d) must be <= entry in TO (%d)). That is stricter than syntax rule 21, which compares element positions, so FROM (1 3) TO (2 1) is legal. Second, the DYNAMIC-capacity parts of rules 14 and 16 do not apply while OCCURS DYNAMIC is not implemented.
VALUES with three values works, is answered by tfz.cob above: it prints 000.VALUES ARE (some values corrupted in a group-level OCCURS).GnuCOBOL 3.2.0 (Ubuntu gnucobol3 3.2-4build1) and 3.3-dev r5751 (CI snapshot 3.3-dev.138 of 2026-10-29), x86_64 Linux, both re-run 2026-10-30. Every compile exits 0 with no cobc diagnostic, with -Wall. On 3.2.0 the Ubuntu C compiler step also prints <command-line>: warning: ‘_FORTIFY_SOURCE’ redefined and its note; that is the distribution's build setting.