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






Hello Paul !

I apologies if I have mis quoted you. Please forgive me for this. I feel
what may have confused me are the lines further down the article - maybe I
linked it to the wrong reference:

"On the other hand, think of the problems that unique identifiers cause. We
have all had that old chestnut during testing where we can't understand why
we are getting that duplicate record error until we notice that we are
writing records with a blank key field -- because we forgot to move the
"parent" key field to the "child" key field. It would not have been a
problem if we were using the same field name on both files.

Worse still, what about using unique field names on display files and print
files -- now we have to move all the fields, not just key reference fields.
You just have to remember that when you add a new field to a file and any
corresponding display files, you must put in the appropriate MOVE
operations as well.

There seems to be much less code when we are not using unique identifiers."

Please do keep writing those lovely articles as each one is entitled to
express what he/she thinks will benefit the community, and it is up to us
to choose what's good for us.

Thanks  again & sorry again
Ewart



                                                                                
                                                       
                                                                                
                                                       
                                                                                
                                                       
                                                  To:                           
                                                       
                                                         "RPG programming on 
the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>              
           "Paul Tuohy" <tuohyp@xxxxxxxxxxxxx>                                  
                                                       
                                                                                
                                                       
                                                  cc:                           
                                                       
                                                                                
                                                       
           Sent by:                                                             
                                                       
           rpg400-l-bounces@xxxxxxxxxxxx                                        
                                                       
                                                                                
                                                       
                                                                                
                                                       
           2004/08/07 04:42 AM                    Subject:                      
                                                       
           Please respond to RPG programming on          Re: Same field names 
in different files                                       
           the AS400 / iSeries                                                  
                                                       
                                                                                
                                                       
                                                                                
                                                       




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


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