[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

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

3465.0. "Delete one Duplicate primary key record ?" by ZPOVC::CHINGYUE () Thu Oct 28 1993 09:26

    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.RTitleUserPersonal
Name
DateLines
3465.1Try using DATA_FILESCOTTC::MARSHALLSpitfire Drivers Do It ToplessThu Oct 28 1993 11:257
    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.2Use .%ADDRESS (RFA)GANTRY::HULLDigital Consulting [Delivery]/MotownThu Oct 28 1993 16:1229
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.3AIMTEC::ZANIEWSKI_DWhy would CSC specialists need training?Thu Oct 28 1993 17:174
        Check into the way CAM in the TM subsystem handles duplicate
        primary records.
        
        Dave Zaniewski