At 08:09 07/17/98 -0700, you wrote:
>well for starters i'm learning tables & arrays.
>
>i have a multicolumn report that i'm constructing all
>by tables (arrays are too confusing for me now)
>
>rpg iv lets you define only 2 tables in alternating
>format. so in order to make a table of say 3 columns, you would need
>to define 2 columns as a single table and then split apart the 2
>pieces after a successful lookup.
>
>i think i can do this. but how do i do calculations that will appear
>in a 4th table or even 5th table?

You could also use a based data structure. Making a few changes to Eric's 
program:

     D DS2@            S         *         inz(*NULL)  basing pointer for 
structure
     D DS2             DS                  based(DS2@) template for Ary2 
elements     
     D  Value1
     D  Value2
     D  ...
     D  Valuex
      
     D Ary1            S            10A    dim(100)  <-holds lookup value
     D Ary2            S                   like(DS1) dim(%elem(Ary1)) <-holds 
the data   

     C                Clear              x  
     C      Value     Lookup    Ary1(x)       
      * Overlay the element containing the data with the template data structure
      *  by setting the basing pointer to the address of the array element
     C                eval      DS2@ = %addr(Ary2(x))
      * subfields values can be retrieved directly from DS2 by name here
     C                if        Value1 < Value2
      *  ... bla bla bla

The underlying data structures are virtually identical to Eric's program, since 
a MODS is really a based template over an array, but RPG does the pointer 
manipulation for you.


Pete Hall
peteh@inwave.com 
http://www.inwave.com/~peteh/

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.