From 40dbf98cd2304025f0cb641d957d7589913762aa Mon Sep 17 00:00:00 2001 From: n-isaka Date: Sat, 2 Aug 2025 12:20:33 +0000 Subject: [PATCH] fix(codegen): split key fields in external file --- cobc/codegen.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cobc/codegen.c b/cobc/codegen.c index 5f3aedf1..e90b2894 100644 --- a/cobc/codegen.c +++ b/cobc/codegen.c @@ -3764,6 +3764,19 @@ output_file_initialization (struct cb_file *f) output_line ("%s%s->file_version = %d;", CB_PREFIX_FILE, f->cname, COB_FILE_VERSION); if (f->external) { output_indent ("}"); + output_line ("else"); + output_indent ("{"); + nkeys = 0; + for (l = f->alt_key_list; l; l = l->next) { + nkeys++; + if (l->component_list != NULL) { + output ("("); + output_param (l->key, -1); + output (")->data = %s%s->keys[%d].field->data;\n", CB_PREFIX_FILE, f->cname, + nkeys); + } + } + output_indent ("}"); } }