|
Hans, > I understand what you're saying. It's just that we suspect that tables are relics of an older era, and that there's not much need to do much with them. Functionally, there's nothing that you can do with tables that you can't also do with arrays. And since arrays are so much more powerful anyways, why bother limiting yourself by using a table? > On the other hand, if there really is some overwhelmingly compelling reason that tables should be enhanced, I'm all ears! One word: "simplicity". I'll say at the outset that if I were designing the language from the ground up, there would be no diference between a table and an array. But since there is this concept built into the language, I may as well use it. I recently had occasion to use it, so it's fresh in my mind. I have a simple compile time table with static data that contains the "columns": Source type, Type code and Description. Source type is unique. Type code can repeat and Description will be ignored by the program (it's only for the programmer's edification.) The requirements are simple: If it's found in the table, use the alternating table's value. So the code looks like this: IF %TLookup( SrcAttribute: TabSrcTypes: TabTypeChars ) = *Off ; RETURN '-' ; ELSE ; RETURN TabTypeChars ; ENDIF ; With arrays this would require a separate lookup, an additional variable (the index), code to reset the index. It's not a large amount of code difference, but it is slightly more complex. Can the ALT keyword be used w/ compile time arrays? (I still want to keep the values side-by-side on the bottom.) If not, then I would have to define it as an OVERLAYed DS, but it would still require using an index variable; not as elegant. -mark -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.