|
Just a shot in the dark here.... does the SiteCursor element contain the same letter case as the FMACRO field? If FMACRO = 'abc' and SITECURSOR(3)='ABC' LookUp will of course fail. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CarollaT@xxxxxxxxxxxxxx Sent: Wednesday, June 30, 2004 6:43 PM To: rpg400-l@xxxxxxxxxxxx Subject: Reasons for %Lookup failure I am having a problem with the %Lookup BIF. I am performing a %Lookup on an array that has the value in it (I have debugged), and yet the %Lookup does not produce the index number of the array element. The array is very simple: D SiteCursor S 3A Inz(*Blanks) D Dim(300) D Ascend I read through a file (in Key order, the key being the value that will fill in the SiteCursor elements), and populate each element in the array with the site ID value (3 Alpha). I am also populating a similar element of a data structure array, which will hold numerics. Once populated, I read through an accounts file, and for each record, I %lookup the site ID in the SiteCursor array: ElemNumber=%Lookup(Fmacro:SiteCursor); I then use the ElemNumber index value to add up dollar amounts from the accounts file, in the other data structure array: Sitesum(ElemNumber).SumChgs += Fmcrch; In debugging, for some reason, the %Lookup never works. I have verified that the array contains the element being looked up, but it fails to place any value in the ElemNumber variable. I know the values are in order in the SiteCursor array, so I don't do a SortA, because this would sort all of the blanks to the top. Does a SortA need to be run for %Lookup to work? Tony Carolla MedAmerica Billing Services, Inc. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx 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.