[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

392.0. "Convert the data file And change the key field" by MISFIT::KINNEYD (Aruba Bound Soon!!) Wed Apr 01 1992 17:39

    I have done many data file conversions to add fields or change the
    order of things relating to an entry form using the oa$con_convert
    function. 
    
    This time, there is a twist. The customer wants to add an additional
    field and wants to make this new field the key. There are a couple of
    thousand records in the data file.
    
    I assume that I will have to do one convert to add the field. Then run
    a script to load something unique in that field for all the records,
    probably a sequntial number, ie 1,2,3,4,5.... Then I suppose I will
    have to create a new file with the new key name specified in the file
    directive and do a final convert. 
    
    Am I missing something? 
    
    Dave.
T.RTitleUserPersonal
Name
DateLines
392.1Another alternativeSHALOT::NICODEMWho told you I'm paranoid???Wed Apr 01 1992 19:0215
	OA$CNV_CONVERT is a useful function if you're keeping to some basic
ground rules -- like, you're not adding a new key field as your primary key!
You can certainly take the approach you suggested, but I guess I'd look at
another possibility, depending on the size of the records.

	You could create the new entry form (with the new field as the key),
and then use a FOR loop to "walk through" all of the records in the existing
data base, and use either the WRITE or DATA_FILE functions to write the same
record out to the new file, while at the same time generating your key field
(by incrementing a symbol, or something like that).

	If your new key is going to be anything more complex than just 1, 2, 
3, 4... etc., then you may be asking for a bigger project!

	F