| Title: | *OLD* ALL-IN-1 (tm) Support Conference | 
| Notice: | Closed - See Note 4331.l to move to IOSG::ALL-IN-1 | 
| Moderator: | IOSG::PYE | 
| Created: | Thu Jan 30 1992 | 
| Last Modified: | Tue Jan 23 1996 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 4343 | 
| Total number of notes: | 18308 | 
    Customer has a file which allows records with duplicate primary
    key. He would like to delete one of such record from a script
    but WRITE DELETE doesn't allows that.
    
    Is there any way to selectively delete a record with duplicate
    primary key from a script ? 
    
    regards,
    ching-U
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 3465.1 | Try using DATA_FILE | SCOTTC::MARSHALL | Spitfire Drivers Do It Topless | Thu Oct 28 1993 11:25 | 7 | 
|     WRITE DELETE will (I think) always select the first record that has the key
    you specify.
    
    You may be able to use the DATA_FILE functions to position yourself at
    the correct record, then delete it.
    
    Scott
 | |||||
| 3465.2 | Use .%ADDRESS (RFA) | GANTRY::HULL | Digital Consulting [Delivery]/Motown | Thu Oct 28 1993 16:12 | 29 | 
| There's a much simpler way to get rid of the dupe.
Just find out the RFA of the record using something like:
 for DSAB {with .field = "something"} do .text .%key:30 .%address
I tested this by adding a junk rec to the PHPENT (DIR PER) datafile, and
did the top command which gave me a list like this:
DUMMY REC		%#220000000300
LOTUS SALES 		%#0A0000000D00
MICROSOFT INC.		%#0D0000000200
MICROSOFT SALES		%#0D0000000700
etc.
.%address is the absolute Record File Address.  If you are writing a new
app and mess up with some WRITE ADD commands and create records with a
BLANK key, etc, this is the only way to kill them off (easily)., since A1
cannot select a blank field.
Now plug in the RFA (.%address) of the bogus rec into the WRITE DELETE
command:
 write delete DSAB %key = "%#220000000300"    for instance
This tip was imparted to me years ago by our ex-coworker/wizard Rick
Warford.
	Al
 | |||||
| 3465.3 | AIMTEC::ZANIEWSKI_D | Why would CSC specialists need training? | Thu Oct 28 1993 17:17 | 4 | |
|         Check into the way CAM in the TM subsystem handles duplicate
        primary records.
        
        Dave Zaniewski
 | |||||