Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,527 changes: 3,793 additions & 3,734 deletions cobj/parser.c

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions cobj/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2027,17 +2027,26 @@ record_delimiter_clause:
/* RECORD KEY clause */

record_key_clause:
RECORD _key _is reference
RECORD _key _is reference flag_duplicates
{

if($5 == cb_int1) {
cb_error (_("Record keys with duplicates are not yet supported"));
}

current_file->key = $4;
}
| RECORD _key _is reference key_is_eq split_key_list
| RECORD _key _is reference key_is_eq split_key_list flag_duplicates
{
/* SPLIT KEY use */

cb_tree composite_key;
struct cb_key_component *comp;

if($7 == cb_int1) {
cb_error (_("Record keys with duplicates are not yet supported"));
}

/* generate field (in w-s) for composite-key */
if (!$5) {
/* dialect */
Expand Down
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ misc_DEPENDENCIES = \
misc.src/compile-multiple-files.at \
misc.src/compare-large-number.at \
misc.src/validate-indexed-file-keys.at \
misc.src/record-key-duplicates-error.at \
misc.src/copy-comments.at

EXTRA_DIST = $(srcdir)/package.m4 \
Expand Down
1 change: 1 addition & 0 deletions tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ misc_DEPENDENCIES = \
misc.src/compile-multiple-files.at \
misc.src/compare-large-number.at \
misc.src/validate-indexed-file-keys.at \
misc.src/record-key-duplicates-error.at \
misc.src/copy-comments.at

EXTRA_DIST = $(srcdir)/package.m4 \
Expand Down
1 change: 1 addition & 0 deletions tests/misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ m4_include([fd-external.at])
m4_include([compile-multiple-files.at])
m4_include([compare-large-number.at])
m4_include([validate-indexed-file-keys.at])
m4_include([record-key-duplicates-error.at])
#m4_include([copy-comments.at])
28 changes: 28 additions & 0 deletions tests/misc.src/record-key-duplicates-error.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
AT_SETUP([Error on record keys with duplicates])

AT_DATA([prog.cbl],
[ IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT TEST-FILE ASSIGN TO "./TEST-FILE"
ORGANIZATION IS INDEXED
RECORD KEY IS TEST-KEY1 WITH DUPLICATES
ALTERNATE RECORD KEY IS ALT-KEY1
ALT-KEY2.
DATA DIVISION.
FILE SECTION.
FD TEST-FILE.
01 TEST-REC.
03 TEST-KEY1 PIC X(4).
03 ALT-KEY1 PIC X(4).
03 ALT-KEY2 PIC X(4).
PROCEDURE DIVISION.
STOP RUN.
])

AT_CHECK([${COBJ} prog.cbl], [1], [],
[prog.cbl:8: Error: Record keys with duplicates are not yet supported
])
AT_CLEANUP