|
Hi Ewart, I just re-read your e-mail and I am afraid you are mis quoting me. I do not recommend using the same column name for both the Supplier and the Customer names. I Think you skipped this bit of the article Think of NAME as being a data type as opposed to a field and it should have been taken care of in the field reference file, as shown in Figure 4. The NAME field is defined as a "generic" name, and the actual fields (CUSNAME and SUPPNAME) refer back to it for their definitions. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= * Field Reference File (FLDREF) R FLDREFR NAME 30 TEXT('Generic Name') CUSNAME R REFFLD(NAME *SRC) TEXT('Customer Name') SUPPNAME R REFFLD(NAME *SRC) TEXT('Supplier Name') Figure 4: RPG IV Program reading records with duplicate field names. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= So, in an RPG program the only fields that should be "double defined" are key reference fields, and more then likely we will have the same value in them, since we use them to link between files (e.g. use a CHAIN operation to get the record from the invoice header and use a READE loop to read all corresponding records from the invoice details file). Regards Paul Tuohy ----- Original Message ----- From: "Ewart Desouza" <ewart.desouza@xxxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Thursday, August 05, 2004 5:38 AM Subject: Same field names in different files > > > > > Hello All ! > > I had posted this mail in another forum rpgiv@xxxxxxxxx & it created quite > a stir. Hope it does not create too much here. > > Thanks & best regards > Ewart > > PS: Sorry Paul Tuohy if you read this, I just want to get some more views > to help me decide what is best for me before I develop a new production > system for our company. > ------------------------------ > Hello ! > > I've just read the article by Paul Tuohy at > http://search400.techtarget.com/tip/1,289483,sid3_gci953818,00.html where > he suggests to use the same field names in various files like NAME in > Customer Master & NAME in Supplier master. This will save a lot of coding > in the RPG programs specially in the print & display files. > > I fully agree with him but I've experienced only one problem and that is if > there is a difference in sizes then the program gives a compilation error. > > Eg: The NAME is 30 chrs in the Customer file & you want to print/display > only the first 25 characters. If we use the same field names i.e NAME it > gives a compilation error. > > Is there any way these errors could be avoided ?? If so then this will be a > very useful technique. > > Thanks & best regards > Ewart > > -- > 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.