support for OCCURS
Opened this issue · 2 comments
we are still missing TABLEs and I have no idea how to tackle it.
Originally posted by @brunopacheco1 in #30 (comment)
This one should really be tracked separately so I've moved it here.
Theoretically cobc
could generate an array of cob_fields for this, pre-set with the actual field position, but an OCCURS UNBOUNDED
would be cob_field[999999998]
which brings up another question: How much items in occurs should be shown in general, and how to ask the UI to print/set my-item(685743)
and how to print/set my-other-item(1, 4, 3)
(nested OCCURS
)?
What about OCCURS 0 TO 9876 DEPENDING on some-var
and some-var being 3 - or 9866?
Implementation-wise the simple some-item OCCURS 10
could theoretically be done with a single cob_field for some-item
that the extension sets the offset with "field data + field size * (entry - 1)" before using it, but this won't work for anything more complex...
I suggest to have a look at the dump code that is generated with -fdump-all
as it shows how OCCURS
can be handled (resolving the amount of the appropriate depending
variable or max
constant first, then using an intermediate cob_field
to output the data via the existing field logic). With the use of #92 this can be also generated (as comment) without being active.
@brunopacheco1 Would you mind giving this a try?