Skip to content

Commit 40dbf98

Browse files
committed
fix(codegen): split key fields in external file
1 parent c3d9146 commit 40dbf98

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cobc/codegen.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,19 @@ output_file_initialization (struct cb_file *f)
37643764
output_line ("%s%s->file_version = %d;", CB_PREFIX_FILE, f->cname, COB_FILE_VERSION);
37653765
if (f->external) {
37663766
output_indent ("}");
3767+
output_line ("else");
3768+
output_indent ("{");
3769+
nkeys = 0;
3770+
for (l = f->alt_key_list; l; l = l->next) {
3771+
nkeys++;
3772+
if (l->component_list != NULL) {
3773+
output ("(");
3774+
output_param (l->key, -1);
3775+
output (")->data = %s%s->keys[%d].field->data;\n", CB_PREFIX_FILE, f->cname,
3776+
nkeys);
3777+
}
3778+
}
3779+
output_indent ("}");
37673780
}
37683781
}
37693782

0 commit comments

Comments
 (0)