A. What does it do?
Refield is a large program running under ARCHIVE that allows one of add, restructure, delete fields from your ARCHIVE database. If you are familiar with ARCHIVE programming you can do that on your own but it is tedious and easy to make errors. There are also ways to do it by exporting to ABACUS and re-importing. Refield attempts to make it fun and error free, even for a beginner. It works on an unexpanded machine.
What is a field you ask? Well it is a category to hold information for each entry in your database. The Gazet database provided with your computer has these fields for each country : country$, continent$, capital$, currency$, languages$, pop, area, gdp. For each country record we have this information. Now if we also wanted to keep track of miles of roadway in each country we would have a problem. With Refield it would be very easy to add a field called ‘roads’. What would happen is that it would make a new database with the extra field and copy the records over. Suppose we named a field badly in our database. With refield we could easily rename the field. Suppose we were running out of room on our cartridge and there were a few fields we could do without. With refield we could make a new database and leave out those fields to gain a little more room. Or we could break the database into two parts and keep them on separate cartridges. It takes the tedium out of such problems and is fun to watch because it tells you what it is doing as it chuges along.
B. Starting up
1. Set up files in RAM if you want fastest running
2. Start archive normally
3. Type: run "()step1"<ENTER> where () = device holding refield
programs(mdv1_,mdv2_,flp1_,flp2_)
4. Follow directions
C. Brief Explanation On How To Use The Program
To start from archive : run ‘()step1′<ENTER> () = device programs are on.
It will work on an unexpanded QL but only works in 80 column mode.
The Source database is what you have and the Target database is what you want.
It transfers records from the Source to the newly defined Target.
The program is divided into step1_prg to step7_prg which are run in sequence.
It works by writing the procedures needed to make the Target database.
These are merged and run at the appropriate times.
Prompts are usually at the very bottom of the screen.
All responses require the <ENTER> key being pressed as part of the response.
Possible answers to prompts are often within [ ] and separated by /.
Comments within 8 9 clarify prompts.
Comments within ( ) indicate action program is taking.
Often just <ENTER> can replace the normal expected response.
Error messages appear at top right of screen.
You can usually restart the step if an error occurs.
This series of procedures works with an archive database. It allows for the addition of new fields, removal of fields, reordering of fields, renaming of fields, changing a numeric field to a string and viceversa. It uses your original (Source) database as a template and creates a new (Target) database with the changes you want. The Source records are then transfered to the Target database. You are given the opportunity to select and order the Source records to be transfered so the Target database can have the structure you want. One use of this program would be to make an exact copy of your database because the new version would be cleaner as it would not have the holes and disorder of the original caused by record deletions and alterations.
I have attempted to trap most errors and give ample directions. You should have some knowledge of archive fields and the select and order commands. If you use ramdisk you should set that up before starting archive. The procedures have been broken up into a series of steps so they will work on an unexpanded machine. If you don’t have ramdisk or floppies then put your Source database in mdv1_ after archive is loaded and have the refield programs in mdv2_. Near the end you will be notified that the programs are no longer needed so you can remove them from mdv2_ and put the Target cartridge there so the transfer can take place. The Source and Target files can be on the same device but must have different names.
D. Hints about using this program
1. Pressing <ESC> a few times will stop the program and get command mode.
2. Typing help<ENTER> when in command mode will fix screen and give help.
3. When an error is detected you will be given a message in top right of the screen with a prompt. Then you usualy are given the option of restarting the step you are on or from step1 or going to command mode.
4. Some errors may not be detected and will put you at command mode with an archive error message and a line of code from the program. You will have to deal with that as best you can. Typing help<ENTER> will give help.
5. Some errors cause archive to lose track of what files are accessed. If you really get stuck, quit archive and start it up again.
6. I have used the archive convention of field numbers (#) starting at 0. so if a database has 8 fields, the field numbers will be 0 through 7.
7. I gave the field name ‘tag’ a special meaning. If you give the Target database a new field called ‘tag’ it can be given a special value so that each record in the Target database will be given a unique increasing integer in the ‘tag’ field.
8. Apparently the basic rules of field names are : up to 13 characters, the first character must be A-Z, a-z then 0-9 and _ can also be used. If a field ends in $ then it is string, otherwise it is numeric. I may not catch all illegal field names. Especially if you use an archive reserve word in a field name. This could cause step5 to crash. Type help<ENTER> to restart.
9. When you are defining the Target fields, giving it the same number of fields as the Source and making then the same will create an exact copy with a ‘cleaner’ structure.
10. If you have a new name for an old field, you enter the new name where you want it and give the Source field # when prompted.
11. With a completely new field you will be prompted in step 6, if you want it to have a default value different than for string or 0 for numeric.
12. If you give a numeric Source field a string name in the Target database it will automatically make the conversion when transferring.
13. While defining target fields, a little note (S#, where # is the Source field #) is put by the Target field name when Target value = Source value.
14. Using ramdisk for programs, Source, and Target is pretty fast. Some messages appear and disappear instantly. Using all microdrives can take a very long time for large databases.
15. If you want to multitask, you can shut off the screen updating of progress.
E. PROGRAM STRUCTURE
There are 7 files of programs chained together
step1_prg : Asks for device programs are on ( mdv1_,mdv2_,flp1_,ram1_ ,etc.).
It checks that temporary files can be written to that device
and provides these detailed instructions.
step2_prg : Asks for Source database device and file name. It opens the
Source database for 'look'.
step3_prg : Creates an select/order procedure file on the target device
and writes your select/order commands there.
step4_prg : Merges with the select/order procedures and carries them out.
Only activated if selecting or ordering are requested.
step5_prg : Makes creater procedure file for Target database. Prompts for
Target fields. Can have partial or complete duplication of the
Source. You can type in a Target field name or get it from the
Source. Each new name can get its value from the Source. A temp-
porary database is created on the programs device.
step6_prg : Makes transfer procedure file. prompts for special values for
new fields (normally string = and numeric = 0).
step7_prg : Merges creater and transfer procedures. Gets Target device and
file name. Creates Target database and does the transfer.
F. ERROR/HELP Message
Suggestions
Type 'help<ENTER>' to get this screen again when in command mode"
Make sure specified devices and files are correct
Make sure a necessary drive is not full
Make sure tabs aren't removed from a necessary cartridge
Jot down error number and look it up on page 53 in archive manual
Last error # =
If you can fix the problem without closing files type start<ENTER> or
Try starting from step1 again or that failing quit archive and restart
Specified refield programs device :
Specified Source database :
Specified Target database :
Restart this step - [ y/n ] :
Restart with step1 - [ y/n ] :
Close all files before stoping - [ y/n ] :
C. Support software development
This software is not intended to be free. If you obtained it from UPDATE Magazine or directly from me, Thank You. If you got it for free and find it helpful, please support my effort in trying to make good applications software for the QL. Send me $5.00.
Bill Cable
Wood and Wind Computing
RR 2 Box 92
Cornish, NH 03745 USA
603-675-2218
Specializing in Business Applications for the QL
You should find this to be a very reliable and flexible program with lots of different applications. Please notify me of any problems or useful features to add.
Bill Cable March, 1988