|
I don't use tables anymore. Haven't in years. There was a time in the distant past when all we had were tables. There's nothing you can do with a table that you can't do with an array. On 1/12/07, Jonathan Mason <jonathan.mason@xxxxxxxxxxxxxxxx> wrote:
Hi Michael Thank you sir, that does the trick. I've been programming in RPG for over 20 years now and I've never come across that before, I've always used the terms "table" and "array" interchangeably when it's always been arrays that I've been using. Other than using different BIFs to search tables and the name having to begin with TAB is there any reason why one should be used instead of the other in any situation? Thanks Jonathan -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael Ryan Sent: 12 January 2007 11:31 To: RPG programming on the AS400 / iSeries Subject: Re: Compiler not recognising array definition Is it because your array name starts with TAB and the compiler thinks it's a table and not an array? On 1/12/07, Jonathan Mason <jonathan.mason@xxxxxxxxxxxxxxxx> wrote: > Hi Group > > > > Why is it that the simplest programs always give the most trouble? > > > > I'm trying to create what should be a simple program that reads through a > compile time table and writes/updates a physical file with the content. The > source of which is shown below: > > > > FSYSP900A UF A E K Disk > > F* User Defined Tables > > > > D* Work Fields > > D ix s 5p 0 Inz(2) > > > > D MaxSize s 5p 0 Inz(0035) > > 42 D Tables s Like(ArrEntry) Dim(0035) CtData > > > > D ArrEntry ds > > D TableID 5a > > D TableKey 15a > > > D TableData 60a > > > > > > C* Key List > > > C keySYSP900A KList > > > C KFld TableID > > > C KFld TableKey > > > > > > C* Read through the table until all records have been read or a blank > element > > C* is found... > > > 74 C DoW (ix <= MaxSize) and (Tables(ix) <> > *Blanks) > > > > > C* Retrieve the entry and attempt to retrieve a matching record from > the User > > C* Defined Table file... > > > 78 C Eval ArrEntry = Tables(ix) > > > > > C keySYSP900A Chain(e) SYSP900A > > > > C Eval TBTABL = TableID > > C Eval TBKEY = TableKey > > C Eval TBDATA = TableData > > > > C If Not %Found(SYSP900A) > > C Write(e) SYSR900A > > C Else > > C Update(e) SYSR900A > > C EndIf > > > > C* Get the next table entry... > > C Eval ix = ix + 1 > > C EndDo > > > > C* Exit the program... > > C Eval *InLr = *On > > > > **CTDATA Tables > > > Tbl++Key++++++++++++Data++++++++++++++++++++++++++++++++++++++++++++B+xxxxxx > xxxxComment+++++++++++++ > > 0000100001 User Defined Table Definitions > 0002 > > 0000137001 CRF Status Codes > 0003 > > 370010 Logged 0 > 0004 > > 370011 Assigned 0 > 0005 > > 370012 Assigned - Waiting Feedback 0 > 0006 > > 370013 Assigned - Work Scheduled 0 > 0007 > > 370014 Assigned - Work in Progress 0 > 0008 > > 370015 Assigned - Work Completed 0 > 0009 > > 370017 Cancelled 1 > 0010 > > 370018 Closed 1 > 0011 > > 370019 Closed - Available to Purge 1 > 0012 > > > 0013 > > > .. > > > .. > > > 0035 > > > > > > However, when I try to compile the program I get the following errors: > > > > Msg id Sv Number Seq Message text > > > *RNF0528 20 74 006100 Index is not allowed for name that is not an > array; index > > is ignored. > > > *RNF0528 20 78 006500 Index is not allowed for name that is not an > array; index > > is ignored. > > > > > Although the compiler cross reference shows the field definition as: > > > > TABLES(35) A(80) 42D 74 78 > > > > If I compile with GENLVL(20) to ignore the error and then run the program in > debug mode the first time I get to the DOW statement there is a value in > Tables(ix). However, if I check the value of the data structure before the > CHAIN is executed then it contains blanks and is not being populated by the > array. Stepping through the source I get to the ENDDO where all conditions > for the loop to repeat are met, yet the program steps straight on to set > *INLR and exits. > > > > I'm figuring this is related to the compiler not recognising the array, but > can't see for the life of me what is wrong with the definition, although I'm > bound to have missed something obvious. If anybody has any suggestions I'd > be grateful to receive them. > > > Thanks > > > > Jonathan > > -- > 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. > > -- 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. -- 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-2025 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.