Copying tables with Relational Indexes (AREV Specific)
At 18 OCT 2001 03:30:04PM David Kafka wrote:
I can't believe that this hasn't been covered here before, but if it has, I can't find it. (I am aware of the various index utilities in the KB, but I don't THINK any of them really does what I need.)
I have an app where from time to time I want to set up a new volume/location with a Dict and Index structure identical to a source location, but with empty data files (i.e. create a new company in an accounting app.) Long ago, I had written a program which does this automatically (in ARev 1.16). It works by first creating files of the same name at the new location, then by SETFILEing/ALIASing each original FILE/TABLE one by one, and then FILECOPYing/COPYTABLEing all the DICT's (which in 1.16 does not attempt to move indexes), then going back and RECORDCOPYing/COPYROWing all the DICTS which sets up all the indexes, including RELATIONAL. When it is done, you are ready to roll. The COPYROW process sets up the indexing properly, including !FILES.
Well, needless to say, this doesn't quite work in 3.12. I get a number of different errors, but the main problems seem to be 1. A refusal to TABLECOPY the DICT of a TABLE with RELATIONAL indexes, and 2. more important, the fact that although the index information contained in the DICTS is transferred, no !TABLES are created in the new location.
Does anyone have a built program or utility which would solve this problem, or do I have to write one myself (I don't have time for this!!!)
Thanks,
David Kafka
At 18 OCT 2001 07:27PM Curt Putnam wrote:
You can copy Dict.FIle * to: (Dict.NewFile but that will leave your index references pointing to the source volume.
Curt
At 19 OCT 2001 08:45AM Don Miller - C3 Inc. wrote:
David..
Limber up your fingers. You'll have to roll your own routine. It's not terribly difficult if you analyze the source DICT record to check for 1) B-Trees, 2) B-Tree'd XREF's, and 3) the dreaded Relational. The first 2 will be a piece of cake. The 3'rd requires you to create the Relational Target before you copy, then change the pointers to the correct volume.
Kind of ugly prospect, but …
Don Miller
C3 Inc.