Page 1 of 1

Delete a secondary index file

Posted: Thu Nov 04, 2004 3:09 pm
by tonystark622
I have a few instances where I create a secondary index on a hash file using CREATE.INDEX hash_name keyname. These hash files have been created in a directory other than the project directory. When I run the CREATE.INDEX command, DataStage creates a directory named I_hash_name (where hash_name is the name of the hash file) in the same directory as the hash_file.

The problem that I'm having is after re-creating this index several times, I have multiple files associated with this index. For example, if I have a hash file called tony_hash and I create a secondary index on it, I'll have a directory called I_tony_hash. The next time I run the routine that creates the secondary index DataStage creates a new directory and puts a "sequence number" in the name, e.g. I_tony_ha00. The original directory I_tony_hash still exists. If I run the routine that creates this index again, I will have a third directory, I_tony_ha01. This continues until I 1) run out of disk space, or 2) I run out of new directory names (it won't increment the name past I_tony_ha99).

At the top of the routine that creates this index, I have a DELETE.INDEX hash_name ALL command, so, I'm at least attempting to remove the index.

How do I keep this from happening? Is my only solution to physically delete the directory I_tony_ha?? before I create the index again?

Thanks,
Tony

Posted: Thu Nov 04, 2004 3:29 pm
by ray.wurlod
That won't be enough. At one time a DELETE.INDEX has failed to complete, which is why you're seeing what you're seeing. To get back to a clean, no-index situation:
  • delete the I_... directories associated with your hashed file

    execute the UniVerse command SET.INDEX hashedfile NULL
This form of the SET.INDEX command removes the linkage between the hashed file and its index directory.

The other I_... names were created when a CREATE.INDEX command could not create I_hashedfile because it already existed.

Posted: Thu Nov 04, 2004 3:40 pm
by tonystark622
Thanks, Ray! I knew it had to be something like this, but didn't know where to go with it. I appreciate your help.

Tony