Reorganising the Database
`About the Database` 
`Briefly` 
_5 Sorry, kein Zugriff 
This is a collection of functions occasionally needed by anybody running a database. 
A database consists of several files serving various functions. "Reorganising" means different things for each of these files. What exactly it is and when it is necessary, is described in handbook Chap. 0.11.2. Under normal circumstances it doesn't happen often that one needs to use this menu. In-depth descriptions are contained in `Chapter 7` of the handbook. 
If one of these functions needs to be activated, no user must be working on the database. Unlike the DOS CockPit, this program will check first whether there's no one active, and will do nothing in that case. 
`Hints for the Sysop` (Novell Server) 
Lets say the name of your database is MARC and you are using the configuration U.CFG. 

`Index Recreation` 
The Index file MARC.UDX contains all the alphanumeric indexes. A database cannot function without this file. It has to be recreated if it cannot be accessed or if it is obviously corrupt. Also, if changes have been made in the index parameters. Such changes are not automatically executed for the database as a whole but will affect new records only. In the process or Index recreation, all records are indexed from scratch and all parameter changes will thus take effect globally. At the same time, the brief display file, restrictions file and the address table are all newly created whether they exist or not at that moment. The time it takes depends on the number of records and the speed of the computer and network.
 
`Address Table Recreation`	
The MARC.TBL file will be refreshed. You need this only if it was accidentally erased or if you get an error message like  "no access to this record" , which is a rare event. The file might then have been damaged by external influences. It is a very fast function. 
(The address table contains the physical addresses of records in the .xLD files while the index contains only logical record numbers instead.)

`Brief Display Recreation` 
Only the MARC.STL file (the index 0) is produced by this function. This file contains the lines you see in a result set window. One line per record. Much faster than index recreation. 

`Restriction File Recreation` 
The MARC.RES contains the data for the qualifiers, like dates, with which a result set may be made smaller. (if the index parameters contain such specifications, see `Chap. 10.2.9`). Works quite as fast as the previous function. 

`Index Compaction`
After a while and many transactions, the index file MARC.UDX becomes bigger than it would have to be, due to deletions and changes; it may also become a bit slower because of that. This function is a lot faster than "Index recreation" because the entries themselves need not be recreated from the records! Before starting this there should be as much free space as the index file takes up at that moment. It will become smaller, but how much smaller is not possible to estimate.  
 
`Recreate Entire Database`
 (all files it consists of)
MARC.UDX, .TBL, .STL and .RES files are all deleted, the .ULD files are then processed and all records contained therein written into new files, skipping deleted records, keys are produced, TBL, STL and RES files recreated. All records receive new internal numbers, the file numbers, however, are preserved if there is more than one file of .ULD type. Subsequently, the old .ULD files are still in existence but renamed into .U8D. After you have made sure everything is OK with the new database, delete these old files. 
Attention for free disk space: Before starting this, there has to be double the amount of the current database size.
Attention "Old files": If old .U8D files remain from an earlier activity, you'll get the message 
	There are old files: <name> 
	Are you sure these can be deleted? 
If the database worked alright up to this moment, answer [Yes]. But if you had encountered faulty records before this, copy the old files to some other secure place, just to make sure you lose nothing. 

`Number-faithful Recreation`
 (internal numbers will be preserved)
The same as before, but the old internal record numbers remain unchanged. 
For your information: There will be unused record numbers after this (belonging to deleted records which no longer physically exist after recreation). These numbers are registered under the special key /[0] in Index 1 but will be reused subsequently as the database keeps growing. 
Attention "Old files": The same as above applies here. 

`Reclaim Wasted Space`
 (remove deleted and unused record storage space)
The MARC_nnn.ULD files are read and then written into new files, a number of filler characters (as specified in the U.CFG) is added to each record. Internal record numbers remain unchanged. For deleted records and unused record numbers the same applies as described under "Number-faithful Recreation". This "reclaiming"  requires only a fraction of the time needed for Entire Database Recreation. There hast to be as much free space as taken ub by the .ULD files. The new files will be somewhat smaller in any case.
Attention "Old files": The same as above applies here. 

`Same, but selected files only`
If the database has several .ULD files (there can be as many as 255) you may reclaim them selectively. The system manager can apply this, to save time. for very large databases when knowing that there are many deleted records in this or that file. 
Attention "Old files": The same as above applies here. 

`Last Message List` 
All of the above functions are ececuted by the DOS programs INDEX and QRIX. Each of these write a log file, called PROTOK and PROTOQ, resp. In case of trouble one may look at these lists. Consult chapter 7 in cases of trouble with any function on this menu!

`Database Copy`
 (in particular, backup copy) 
All of the files mentioned above will be copied to a directory of the user's choice, including CFG, help files and some others. This copy may subsequently be used as an independent database, for example for testing purposes. This procedure can also serve for backup copies. For this, it is strongly recommended that the other directory be on another physical disk. 

`Database Export`
 (Copy data in a different format) 
There will be a choice of different formats for copying the data. 
The export language, however, provides for unlimited variety! Not without a price, though. The system handbook documents the export system in chapter 10. 

`Lock Current Record / Unlock it`
 (for write access) 
The DOS program PRESTO.EXE locks a record while someone is working on it. Other users can read it meanwhile but not enter the editing mode. (For good reasons, the Windows programs and avanti use a different method!) This function can be used to intentionally lock the current record to prevent its editing. Read accss remains unimpeded. Use this again to revert the lock! 
By the menu command "Extras | Database | Locked records" all locked records in the database can be found as well as freed. This is useful because permanently locked records may occur, for example, after a power outage at the moment of editing.

`Lock/Unlock Database`
 (for all write activities) 
In certain situations the administrator wants to prevent all write access. This may be effected by locking the MARC.TBL file. Read accss is still possible, but nobody may save a record. Activate this again to unlock.

`Total Lock Set / Reset`
 (prevent all accesses) 
The recreation functions described above should be done at times when nobody is using the database, not even in reading mode. Obviously, when the index is being recreated, it cannot be used at the same time. A so-called  "signal file" may be placed on the data directory, containing nothing but a digit 1 in the first byte and a comment following it. When this file is there, nobody can access the database using a99 or alcarta. (The DOS programs are unaffected!) This menu function checks for the presence of a signal file. If it exists, you may choose to remove it, if it does not exist, to set it. 

`Sniffer`
 (Tool for database analysis)
This tool detects faulty record numbers and addresses. To repair such damage, one will usually have to recreate the data files, index file, address file etc. No software is immune against damage from external sources! Sniffer can find such damage, which is better than nothing at all. 

Novell Flag Command : Hint for the system manager
A Novell file system requires a flag to be set on every newly created file that is supposed for multi-user access. The Novell "flag" command exists for this purpose. This command is contained in the  `ORG.FLX`  file which is invoked in most of the functions in this menu. There is a comment in the ORG.FLX telling you what to do. 

?Index Recreation=x var "iIndex recreation"\ins #uxO\exec X org.flx 
?Address Table Recreation=x var "tAddress table recreation"\ins #uxO\exec X org.flx 
?Brief Display Recreation=x var "sBrief display recreation"\ins #uxO\exec X org.flx 
?Restriction File Recreation=x var "xRestr. file recreation"\ins #uxO\exec X org.flx 
?Index Compaction=x var "cIndex compaction"\ins #uxO\exec X org.flx 
?Recreate Entire Database=x var "7Entire database rebuild"\ins #uxO\exec X org.flx 
?Number-faithful Recreation=x var "nNumber faithful rebuild"\ins #uxO\exec X org.flx 
?Same, but Selected Files Only=x var "rSelected file reclaim"\ins #uxO\exec X org.flx 
?Reclaim Wasted Space=x var "RWasted space reclamation"\ins #uxO\exec X org.flx 
?Briefly=h org 
?Lock Current Record / Unlock it=X reclock.flx 
?Lock/Unlock Database=X tbllock.flx 
?Total Lock Set / Reset=X signfile.flx 
?About the Database=X dbinfo.flx 
?Database Copy=X _backup.flx 
?Database Restoration=X _restore.flx 
?Export=X _dbxport.flx 
?Last Message List=x var "INDEX-Protokoll?" n " (Nein = QRIX-Protokoll)"\yes\if yes help protok\if no help protoq 
?Sniffer=x get env comspec\ins #uvC\var #uvC " /c " P "sniffer.exe -x"\call 
?CockPit=X cockpit.flx 
?Chapter 7=h ac7-1 
?Kap. 10.2.9=h ac10-12 
?Handbuchkapitel 7=h ac7-1 
?ORG.FLX=h org.flx