The 2002 COBOL standard established the possibility of using the VALUE clause to assign values to table elements. Even individually and even on multi-dimensional tables.
See in the attached screenshots the FORMAT 2 of the VALUE clause and the examples of how to initialize the elements of tables.
This was added to GnuCOBOL some weeks ago, while it isn't finished yet you may want to check the nightly builds.
Thanks Simon, very very good !
I don't know how to use the nightly build.
Perhaps now an updated version would be useful that we can download from Arnold's site.
Current implementation is expected to be "quite stable" and won't go away.
The parsing is fully done for several formats, the FROM and TO options don't land correctly in the codegen and are therefore PENDING - patches welcome -.
Again, the most important part seems to be documentation - @dilodilo maybe you can checkout what is working and create the notes to add to the PG?
ok I can try asap, but ... the question is the following : can I use the latest release that I'm going to download from the Arnold site to test these new features?
Is this one the correct compiler release to use for ?
(NEW) GnuCOBOL 3.2 BDB Preview (23Oct2022) GC32-BDB-Preview-rename-7z-to-exe.7z --
MinGW GnuCOBOL compiler for Windows XP/7/8/10. Includes GCC 9.2.0, Berkeley DataBase 18.1.40 for Indexed Sequential file access support, GMP 6.2.1, and PDCursesMod 4.3.4 (25.6 megabytes). Rename .7z to .exe for self-extracting archive.
That part was a bit buggy in the preview, I'd suggest to use the nightly binaries für testing instead.
@dilodilo: could you please recheck the state and suggest additions to the PG?
I did a small test but unfortunately it doesn't seem to work yet.
see screenshot
using this from Arnold site:
Can you please try with
VALUESinstead ofVALUEand - if you still see an error with specifying 3 values?Hi, using the VALUES clause instead of VALUE, the program compiles without errors (!?!?!) . but VALUE and VALUES should work the same way.
However, the execution does not provide the expected result.
Table fields are not initialized as they should according to the VALUES clause.
The following program demonstrates the above.
The program display as attached screenshot::
Last edit: Eugenio Di Lorenzo 2023-03-22
Does it work if you change the value clause to : VALUE 1 2 3. ?
On 22/03/2023 12:54, Eugenio Di Lorenzo wrote:
Related
Wish List: #417
Last edit: Vincent (Bryan) Coen 2024-03-09
The error doesn't change even if I assign three values instead of two.
this gives following compilation error
** "syntax error, unexpected ."**
Even if the tests have not yet been successful, I have nevertheless prepared this documentation. It should be added to the Programmer's Guide at chapter
6.9.53. VALUE
A new format should be added that we can call
VALUE (for tables) Syntax
The syntax to add is as follows:
I cannot add any vaporware and that includes vaporfeatures.
Let me know when it works for v3.2 and I will add it.
Please see https://sourceforge.net/p/gnucobol/code/HEAD/tree/tags/gnucobol-3.2-rc2/tests/testsuite.src/run_initialize.at#l655 for what is implemented.
If you can find a resolution to support that in the parser - patches welcome.
Note: standard COBOL allows multiple values only with the
FROMclause - in this case the parser can differentiate that; otherwise it can't and therefore don't expect multiple values if you just specifyVALUE a b.Today I have added this to the Programmer Guide.
So this can be closed After successful testing by ???