|
You ought to remove the subscript altogether if you want to search the table starting at the beginning every time. "When LOOKUP is processed on an array and an index is used, the LOOKUP begins with the element specified by the index. The index value is set to the position number of the element located." So, if your last lookup set the value of X = 20, it will start the lookup at 20 and ignore 1-19. Bob Bob Slaney/Atlanta/IBM@IBMUS (Lotus Notes) Internet id: rjslaney@us.ibm.com VM id: DALVM1.RJSLANEY@VM Tieline 445-7374 Direct (770)835-7374 FAX tie 445-7232 Direct (770)835-7232 IBM Learning Services iSeries Courseware Developer IBM Corp. 3200 Windy Hill Road Atlanta, GA 30339 Internal Zip WG08C "Ann E. Gerling" <agerling@nemonet To: <rpg400-l@midrange.com> .com> cc: Sent by: Subject: Re: Array question rpg400-l-admin@mi drange.com 04/04/2002 10:55 AM Please respond to rpg400-l Try resetting your index (x) before your lookup operation. This is to make sure you are always starting at the beginning of the array. EVAL X = 1 ----- Original Message ----- From: <THarteau@felkerbrothers.com> To: <rpg400-l@midrange.com> Sent: Thursday, April 04, 2002 8:43 AM Subject: Array question > > Hi, > Another programmer here is having an array problem, and I don't know > how it is happening, or how to fix it. It is a RPG program with a compile > time array. It is only used in one lookup command. It is defined > correctly, and works most of the time. We added an output file to the > program so we could see what certain fields contained as the program is > running. Its a long story, but we are trying to capture the input file > (that causes the error) so we can use debug. Below is part of the file. At > one point, the array is cleared, and then is repopulated when the next > parent starts. I didn't think a compile time array could work this way! > Anyone have any ideas on why this is happening? > > This is the array: > D ALP S 1 DIM(26) CTDATA PERRCD(26) > C BUB LOOKUP ALP(X) > 92 > ** ALP > ABCDEFGHIJKLMNOPQRSTUVWXYZ > > Parent Child Bubble Pipe U/M BBX ALP > AM-3088-0098 WF10VG200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0098 WF10GR200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0100 PP308813 1 P EA 5 ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0100 WF10SF200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0100 WF10PC200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0100 WF10VG200 W EA 5 > AM-3088-0100 WF10GR200 W EA 5 > AM-3088-0100 H01B6200 2 H EA 5 > AM-3088-0102 WF10GR200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0102 WF10VG200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0102 WF10PC200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0102 WF10SF200 W EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0102 PP308813 1 P EA 5 ABCDEFGHIJKLMNOPQRSTUVWXYZ > AM-3088-0102 H01B6200 2 H EA 5 > ABCDEFGHIJKLMNOPQRSTUVWXYZ > > <===================================================> > > Terri Harteau > **************** > "There's no point in being grown up if you can't be childish sometimes." > - Dr. Who > **************** > > > > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.