I want to create a file containing a split key defined as
alternate record key split-invoice = invoice-year invoice-number with duplicates
Under Windows Gnucobol 3.3, there is no problem.
Under Redhat Linux 9.4 or Centos 7 and Gnucobol 3.2.0, the program compiles but returns a file status error 22 each time the program tries to write a record in the file.
For information , our configuration under Centos 7:
cobc(GnuCOBOL)3.2.0Copyright(C)2023FreeSoftwareFoundation,Inc.LicenceGPLv3+á:GNUGPLversion3ouultÚrieure<https://gnu.org/licenses/gpl.html>Ceciestunlogiciellibre;consultezlessourcespourlesconditionsdecopie.Iln'y a AUCUNE garantie; pas mŕme pour la COMMERCIALISATION ou l'AD╔QUATION└UNBESOINPARTICULIER.╔critparKeisukeNishida,RogerWhile,RonNorman,SimonSobisch,EdwardHartCompilÚAug15202314:32:31EmpaquetÚJul28202317:02:56UTCVersionC"4.8.5 20150623 (Red Hat 4.8.5-44)"informationdecompilationenvironnementdecompila:x86_64-redhat-linux-gnuCC:gccVersionC:"4.8.5 20150623 (Red Hat 4.8.5-44)"CPPFLAGS:-U_FORTIFY_SOURCE-D_FORTIFY_SOURCE=2CFLAGS:-O2-g-pipe-Wall-Wp,-D_FORTIFY_SOURCE=2-fexceptions-fstack-protector-strong--param=ssp-buffer-size=4-grecord-gcc-switches-m64-mtune=generic-fstack-protector-strong-pipe-finline-functions-fsigned-char-Wall-Wwrite-strings-Wmissing-prototypes-Wno-format-y2kLD:/usr/bin/ld-melf_x86_64LDFLAGS:-Wl,-z,relro-Wl,-z,relro,-z,now,-O1informationGnuCOBOLCOB_CC:gccCOB_CFLAGS:-pipe-Wall-Wp,-D_FORTIFY_SOURCE=2-fexceptions-fstack-protector-strong--param=ssp-buffer-size=4-grecord-gcc-switches-m64-mtune=generic-fstack-protector-strong-pipe-U_FORTIFY_SOURCE-D_FORTIFY_SOURCE=2-I/usr/include-Wno-unused-fsigned-char-Wno-pointer-sign-OCOB_DEBUG_FLAGS:-ggdb3-fasynchronous-unwind-tablesCOB_LDFLAGS:-Wl,-z,relro-fstack-protector-strongCOB_LIBS:-L/usr/lib64-lcobCOB_CONFIG_DIR:/usr/share/gnucobol/configCOB_COPY_DIR:/usr/share/gnucobol/copyCOB_MSG_FORMAT:GCCCOB_OBJECT_EXT:oCOB_MODULE_EXT:soCOB_EXE_EXT:64bit-mode:ouiBINARY-C-LONG:8octetsboutisme:petit-boutisteEBCDICnatif:nonE/SÚcranÚtendue:ncurseswfichierdeformatvariab:0gestionnairedefichier:integregestionnairedefichier:BDBbibliothŔquemathÚmatiqu:GMPbibliothŔqueXML:libxml2bibliothŔqueJSON:json-c
For information , our configuration under RHEL9.4:
cobc(GnuCOBOL)3.2.0Copyright(C)2023FreeSoftwareFoundation,Inc.LicenceGPLv3+:GNUGPLversion3ouultérieure<https://gnu.org/licenses/gpl.html>Ceciestunlogiciellibre;consultezlessourcespourlesconditionsdecopie.Iln'y a AUCUNE garantie; pas même pour la COMMERCIALISATION ou l'ADÉQUATIONÀUNBESOINPARTICULIER.ÉcritparKeisukeNishida,RogerWhile,RonNorman,SimonSobisch,EdwardHartCompiléJul28202300:00:00EmpaquetéJul28202317:02:56UTCVersionC"11.3.1 20221121 (Red Hat 11.3.1-4)"informationdecompilationenvironnementdecompila:x86_64-redhat-linux-gnuCC:gccVersionC:"11.3.1 20221121 (Red Hat 11.3.1-4)"CPPFLAGS:-U_FORTIFY_SOURCE-D_FORTIFY_SOURCE=2CFLAGS:-O2-fexceptions-g-grecord-gcc-switches-pipe-Wall-Werror=format-security-Wp,-D_FORTIFY_SOURCE=2-Wp,-D_GLIBCXX_ASSERTIONS-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1-fstack-protector-strong-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1-m64-march=x86-64-v2-mtune=generic-fasynchronous-unwind-tables-fstack-clash-protection-fcf-protection-fstack-protector-strong-pipe-finline-functions-fsigned-char-Wall-Wwrite-strings-Wmissing-prototypes-Wno-format-y2kLD:/usr/bin/ld-melf_x86_64LDFLAGS:-Wl,-z,relro-Wl,--as-needed-Wl,-z,now-specs=/usr/lib/rpm/redhat/redhat-hardened-ld-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1-Wl,-z,relro,-z,now,-O1informationGnuCOBOLCOB_CC:gccCOB_CFLAGS:-fexceptions-grecord-gcc-switches-pipe-Wall-Werror=format-security-Wp,-D_FORTIFY_SOURCE=2-Wp,-D_GLIBCXX_ASSERTIONS-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1-fstack-protector-strong-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1-m64-march=x86-64-v2-mtune=generic-fstack-clash-protection-fcf-protection-fstack-protector-strong-pipe-U_FORTIFY_SOURCE-D_FORTIFY_SOURCE=2-I/usr/include-Wno-unused-fsigned-char-Wno-pointer-sign-OCOB_DEBUG_FLAGS:-ggdb3-fasynchronous-unwind-tablesCOB_LDFLAGS:-Wl,-z,relro-Wl,--as-needed-Wl,-z,now-specs=/usr/lib/rpm/redhat/redhat-hardened-ld-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1-fstack-protector-strongCOB_LIBS:-L/usr/lib64-lcobCOB_CONFIG_DIR:/usr/share/gnucobol/configCOB_COPY_DIR:/usr/share/gnucobol/copyCOB_MSG_FORMAT:GCCCOB_OBJECT_EXT:oCOB_MODULE_EXT:soCOB_EXE_EXT:64bit-mode:ouiBINARY-C-LONG:8octetsboutisme:petit-boutisteEBCDICnatif:nonE/Sécranétendue:ncurseswfichierdeformatvariab:0gestionnairedefichier:intégrégestionnairedefichier:BDBbibliothèquemathémati:GMPbibliothèqueXML:libxml2bibliothèqueJSON:json-c
and under Windows 11-64 (installled from Superbol binaries):
The Linux versions were not built from the tarball but come from the EPEL repo : EPEL 9 for x86_64, EPEL 8 for x86_64 and EPEL 7 for x86_64.
They were install from the rpm files : gnucobol-3.2-1.el9.x86_64.rpm (el8, e7 respectively) and worked out of the box ... or almost!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
no compilation error is returned although the line " alternate record key split-facture = b-aaaa b-numfacture with duplicates" is longer than 78 chars. The executable is generated but the program returns an error 22 when trying to write data in the indexed file because many the values of "split-facture" field are not unique.
It seems that the "with duplicates" clause in simply ignored.
When compiled:
cobc -x --free convertfiles.cbl
the program runs correctly and does not return any error when adding records to the indexed file.
The same is reproduced under gnucobol 3.2 for Linux, 3.3 for Windows.
Attached : a small program and a text file with values.
It is as you say. I would think? that it would at least issue a warning if you are Not useing -free and there is text past column 80. I know documentation says this:
Ok, so I was not the only one!
This should raise an error during compilation. @sf-mensch : is it a problem that should be reported as a bug ?
Regards,
Alain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes of course. But a compilation error or at least a warning should be raised. No error is reported, so you think the generated executable is correct although its behaviour does not match the program specification concerning the duplicates in the split key.
Anyway, it is good to know what happens!
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes of course. But a compilation error or at least a warning should be
raised. No error is reported, so you think the generated executable is
correct although its behaviour does not match the program
specification concerning the duplicates in the split key.
Anyway, it is good to know what happens!
If you use FIXED format but without any text in cc 72 - 80 I would
recommend the first line of code in source contains :
source variable starting cc8. I migrated over a system using fixed
where some lines went over cc72 but none used cc72 -80 normally and that
fixed it.
Hello,
I want to create a file containing a split key defined as
Under Windows Gnucobol 3.3, there is no problem.
Under Redhat Linux 9.4 or Centos 7 and Gnucobol 3.2.0, the program compiles but returns a file status error 22 each time the program tries to write a record in the file.
For information , our configuration under Centos 7:
For information , our configuration under RHEL9.4:
and under Windows 11-64 (installled from Superbol binaries):
I thought that from version 3, split keys where implemented.
They all are under BDB as file handler.
Best regards,
Alain
Yes, split keys are implemented and should work fine with BDB as well.
I assume that the Linux builds were done from source of the release tarball?
If yes, what is the result of "make checkall" - any reported failures?
The Linux versions were not built from the tarball but come from the EPEL repo : EPEL 9 for x86_64, EPEL 8 for x86_64 and EPEL 7 for x86_64.
They were install from the rpm files : gnucobol-3.2-1.el9.x86_64.rpm (el8, e7 respectively) and worked out of the box ... or almost!
I think that I found the problem!
A file is declared so :
When the program is compiled so:
no compilation error is returned although the line " alternate record key split-facture = b-aaaa b-numfacture with duplicates" is longer than 78 chars. The executable is generated but the program returns an error 22 when trying to write data in the indexed file because many the values of "split-facture" field are not unique.
It seems that the "with duplicates" clause in simply ignored.
When compiled:
the program runs correctly and does not return any error when adding records to the indexed file.
The same is reproduced under gnucobol 3.2 for Linux, 3.3 for Windows.
Attached : a small program and a text file with values.
Can you reproduce that ?
Regards,
Alain
It is as you say. I would think? that it would at least issue a warning if you are Not useing -free and there is text past column 80. I know documentation says this:
But still a warning would be nice?
Last edit: Mickey White 2024-05-22
Ok, so I was not the only one!
This should raise an error during compilation.
@sf-mensch : is it a problem that should be reported as a bug ?
Regards,
Alain
. . .
alternate record key split-facture =
b-aaaa b-numfacture with duplicates
file status bilans-status.
I presume the above restructure, into REAL Cobol, would obviate the need for --free
yes that is the fix.
Yes of course. But a compilation error or at least a warning should be raised. No error is reported, so you think the generated executable is correct although its behaviour does not match the program specification concerning the duplicates in the split key.
Anyway, it is good to know what happens!
On 22/05/2024 15:44, Alain REYMOND wrote:
If you use FIXED format but without any text in cc 72 - 80 I would
recommend the first line of code in source contains :