FI2 Tools
                                  =========

This is a suit of SBASIC scripts to make some bulk changes to your
FileInfo2 database.

There are various reasons why you might wish to change or refresh your
FileInfo2 database. If you have lots of entries it can be very time
consuming and fiddly to do this one at a time via the FI2 supplied
Configurator.

With this suit of scripts you can get the whole database into an editor or
some other program, like Abacus or Archive, to make wholesale changes,
like changing program locations, translating the Action List language,
removing unused entries, or ordering the extensions alphabetically. And then
build the database anew from the ground up.


Requirements and compatibility
==============================

The scripts are written for SBASIC, to be executed via QD's SBAS/QD Thing
or EXecuted directly (preferably using FEW() as they return an error code
using QUIT <error>).

Some functions optionally require my QUICKSORT command, while the import
script, FI2imp_bas, needs my IMPARSE command. They are both available off
my website Knoware.no/toolkits.

With a little alteration they could be made to RUN under SuperBASIC with
TK2; mainly changing integer FOR loops and SELect statements to floating
point.

Obviously, you also need FileInfo2, compatible with V3.50, loaded.

This manual has nothing to say about FileInfo2, so if you want to know
more about it you will need to check its manual.


Usage
=====

These are "scripts", ie not full programs, but routines that may require
some settings in the code itself to be changed to fit with local
circumstances and user choices. These changes are normally to be made in
the first few lines of code, as will be described separately here for each.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                       *
* Make sure you have backups of all important files, and a safe way of  *
*         re-booting should a script fail for any reason!               *
*                                                                       *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


MakeFI2_bas
-----------

This script takes a list of formatted DATA statements and builds an
entirely new FileInfo2 database from them. The old database is unlinked and
the new one adopted immediately so you can try it out. However, the old
database is not overwritten until you replace the old database file with the
new one.

The list of DATA statements is not intended to be written by hand! but
will be based on an existing FI2 database, extracted in a human-readable
form for example using the GetDBarr script, below.

Unless you alter the file name in the first (active) program line the file
will be written to ram1_ If you are satified with the result, make a
backup copy of your original fileinfo2_bin file (check your boot file for
the correct location) and copy the ram1 file in its place.


GetDBarr_bas
------------

Get Database into Arrays.

This script contains a number of routines, one to extract the FileInfo2
database from the live database as loaded and active in memory, another to
sort the database by extension and finally two or three others to output
the database, either as DATA statements or as export files.

You may want to change the file name in the first (active) program line
else files will end up in ram1_

FI2sort can be REMark'ed out if you dont want the database sorted by
extension. If you DO want it sorted you need to ensure that the QUICKSORT
command is LRESPRed before you start.

Init and FI2read are mandatory routines to initialise the arrays and read
the data into them.

The three lines under "Choose DATA or Export" determine the output format:

FI2MkData outputs the data as DATA statements, which can be MERGEd into
the script above and converted straight back into an FileInfo2 database.

FI2MkExp creates an export version of the database. The routine takes two
parameters: The full file name and the delimeter to use to separate the
fields of each record. For PSION export file compatibility use comma, as
in the first of the two export lines.

Note: Export files have an additional field prepended to the necessary
data. This is to enable a logical grouping of the records belonging to the
same extension, making it possible to sort the records.

If you wish to try to export to some other program, like M$ Excel, try tab
(CHR$(9)) as the delimeter. However, I have not provided a way for
importing any other format of export file than the PSION one!


FI2imp_bas
----------

This takes a file in PSION export format and converts it into DATA
statements that can then be merged into MakeFI2_bas and converted back
into an FI2 database file.

Before you start make sure the IMPARSE command is loaded. You can get
this command off my website at Knoware.no/toolkits.

You then need to set the input and output file names in the first few
active program lines.

Note: Export files have an additional field prepended to the necessary
data. This is to enable a logical grouping of the records belonging to the
same extension, making it possible to sort the records.


Program Status
==============

FileInfo2 is © 1993-2005 Thierry Godefroy, adapted from the original
Wolfgang Lenerz' FileInfo thing.


These tools are

V0.01, pjw, 2022 Jan 09

Conditions and DISCALIMER as per Knoware.no