× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: 1st rpg question, fellows
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Fri, 17 Jul 1998 17:47:48 -0400
  • Organization: commsoft

On Friday, July 17, 1998 4:18 PM, Rick Baird [SMTP:rbbaird@Premsys.com] 
wrote:

When I first read this note, I thought Mohammad was talking about 
alternating tables: CODE LOKUP TAB1 TAB2.  If this is the case, and he 
really needs to have multiple "alternate" tables associated with the LOKUP 
argument, then perhaps he's better served by using a regular data 
structure to describe the alternate portion of the table.

Assuming something like getting column attributes from a column name, this 
may be more what he needs.  Of course, I could be a complete idiot (late 
Friday...)  This is RPG III, but the same idea holds for RPG IV.  Use 
CVTRPGPGM to make it RPG IV code...

ColName    Length    DecPos    Text
NAME       30                  Customer name
AMT         7         2        Purchase amount

     E                    TABCOD  1   2  5   TABDTA 42
     I* Map internal fields from alternate table
     IRIGHT       DS
     I                                        1   50DTALEN
     I                                        6   70DTADEC
     I                                        8  37 DTATXT
     C* Find the column name in the attribute table
     C* If found, map alternate table to individual fields
     C* via the data structure named RIGHT
     C                     MOVEL'NAME'    LEFT    5
     C           LEFT      LOKUPTABCOD    TABDTA         20
     C           *IN20     IFEQ *ON
     C                     MOVELTABDTA    RIGHT
     C                     ELSE
     C                     MOVE *BLANKS   RIGHT
     C                     ENDIF
     C*
     C                     MOVEL*ON       *INLR
**  Convert column name to column attributes
NAME 00030 0Customer name
AMT  00007 2Purchase amount

Buck

> First, I'm wondering why you feel you NEED to use tables to set up
> your report output.  There are easier ways, depending upon what you
> are trying to accomplish.
>
> But, having said that, if you are dead set on tables/arrays, it sounds
> like you need (to be really confused) to use a multiple occurance data
> structure, with an accompanying index array.
>
> I was going to put in an example, but I see someone else has already
> done it for me (thanks, Eric)
>
> Good luck, and keep those questions coming.  We're more than willing
> to help.

> mohammad khan 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)
> <snip>
> > 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..
> >

Buck Calabro
Commsoft, Albany, NY
mailto:mcalabro@commsoft.net

+---
| 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 ...


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.