| 
 | 
I recommend using SETLL instead of CHAIN before a WRITE. It will help
performance and prevent any field values from changing.
Patrick Conner
www.ConnecTown.com
(828) 244-0822
                                                                                
               
                    Rizwan Ahmed                                                
               
                    <rizwan@nscsa.com        To:     "'RPG400-L@midrange.com'"  
               
                    .sa>                     <RPG400-L@midrange.com>            
               
                    Sent by:                 cc:                                
               
                    owner-rpg400-l@mi        Subject:     RE: beginner's 
question              
                    drange.com                                                  
               
                                                                                
               
                                                                                
               
                    12/07/00 04:59 AM                                           
               
                    Please respond to                                           
               
                    RPG400-L                                                    
               
                                                                                
               
                                                                                
               
Ange
Also you could check for the existence of the record first by a chain with
the keyfield and if it doesn't exist then you could attempt to write it.
Rizwan
     -----Original Message-----
     From:   Fabrice CALMELAT [SMTP:f.calmelat@itech-international.com]
     Sent:   Thursday, December 07, 2000 1:23 AM
     To:     RPG400-L@midrange.com
     Subject:        RE: beginner's question
     What it means is :
     - Your file Test28 has a key (one or more fields).
     - The UNIQUE keyword is used in the DDS of your file (TEST28).
     TEST28 is a file that can be accessed by a key (CHAIN in RPG) and the
     key
     has to be unique. You get the error message because your program tries
     to
     add a new record in TEST28, but, the record your trying to add has a
     key
     that already exist in TEST28.
     I hope this helps,
     Fabrice Calmelat
     ITech International Ltd - http://www.itech-international.com
     +44 (0) 798 99 77 601
     -----Original Message-----
     From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com
     ]On
     Behalf Of ange
     Sent: 07 December 2000 08:12
     To: RPG400-L@midrange.com
     Subject: beginner's question
     hi, all
         I want to add records to and update the same file in one of my RPG
     program. I used as follow in my F specs.
      FTEST28    UF A E           K DISK
     and  I used WRITE to add the records and UPDATE to update the records?
         The compile is passed,  but when I run it, I met the message: '
     Attempt to write a duplicate record to file TEST28 (C G D F).'
         What is the problem? Thanks.
     +---
     | This is the RPG/400 Mailing List!
     | To submit a new message, send your mail to RPG400-L@midrange.com.
     | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
     | To unsubscribe from this list send email to
     RPG400-L-UNSUB@midrange.com.
     | Questions should be directed to the list owner/operator:
     david@midrange.com
     +---
     +---
     | This is the RPG/400 Mailing List!
     | To submit a new message, send your mail to RPG400-L@midrange.com.
     | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
     | To unsubscribe from this list send email to
     RPG400-L-UNSUB@midrange.com.
     | Questions should be directed to the list owner/operator:
     david@midrange.com
     +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
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.