|
>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? > >confusing? i hope so.. > >M.K. You -can- use tables that are not linked on the same E spec as pairs: (Thanks to Buck for providing a chunk of code I could mangle. Seems I can't create code out of thin air anymore... (: ) E TABID 1 4 5 TABNAM 30 E TABADR 1 4 30 ** C* Use the customer number to LOKUP in the ID table, and the NAM C* table, and the ADR table: ** = C CUST# LOKUPTABID TABNAM 20 C CUST# LOKUPTABID TABADR 21 ** C *IN20 IFEQ '1' C MOVE TABID OUTID <-- your output fields C MOVE TABNAM OUTNAM C ENDIF C *IN21 IFEQ '1' C MOVE TABADR OUTADR C ENDIF C* ** Main problem with this idea is that the machine has to keep searching ** the TABID table in order to find entries in the table. C* C SETON LRRT ** 00000Amalgamated Anglers, Inc. 00001Best Bovines, Inc. 00020Delightful Dogs, Inc. <<< note the tables do NOT have 00005Excellent Eclairs, Inc. to be in any specific sequence; ** but the Nth elements of each table Anaheim, CA have to 'go together' Sioux City, SD New York, NY Cincinnati, OH ** Arrays work much like Tables, but you can use a numerical index field and eliminate much of that searching: [all you folks better proofread this one...] E ID 1 4 5 NAM 30 E ADR 1 4 30 ** C* Use the customer number to LOKUP in the ID table, and the NAM C* table, and the ADR table: ** = C Z-ADD1 Y 2.0 C CUST# LOKUPID,Y 20 C* C* After that one LOKUP, you can use the data from all 3 arrays: C* C *IN20 IFEQ '1' C MOVE ID,Y OUTID <-- your output fields C MOVE NAM,Y OUTNAM C MOVE ADR,Y OUTADR C ENDIF ** C* C SETON LRRT ** 00000Amalgamated Anglers, Inc. 00001Best Bovines, Inc. 00020Delightful Dogs, Inc. <<< note the tables do NOT have 00005Excellent Eclairs, Inc. to be in any specific sequence; ** but the Nth elements of each table Anaheim, CA have to 'go together' Sioux City, SD New York, NY Cincinnati, OH ** >From what you're describing (ie "How do I do calculations that will appear in a 4th table or even 5th table"), methinks you're approaching the concept of a report from an unusual point of view. Perhaps you can give us some more information on what you're trying to accomplish. >From the sound of your 2nd note I have the impression that you are going to be storing all of your data in your tables, and picking the data from the tables for printing. Are you confusing TABLES (in the SQL meaning of the word) with TABLES (in the RPG meaning of the word)? An SQL table is a collection of data that consists of a number of rows, each row of which is the data for a particular part or customer (for example). An RPG table is a storage area for miscellaneous information (ie discount codes, summarized data accumulated while your program runs, zip codes, etc) (usually constants). In RPG, a FILE is the equivalent of an SQL Table. This is where you store all of your inventory information, your customer names and addresses, etc. (Actually, except for the most simple of data, most RPG tables would be better off if created as RPG Files. Data should NOT be hard-coded in a program (as compile-time tables and arrays are)). --Paul E Musselman PaulMmn@ix.netcom.com +--- | 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 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.