Interactive Query for CDS/ISIS Search System

Introducing IQUERY© v1.0.2 Engine



Description
IQUERY is a software designed to run under three plataforms, Linux, SCO and DOS. The system was designed to act as an interactive search engine for Mini Micro CDS/ISIS DataBases, it was developed taking the directives showed in the ISIS 3.0 version. The software can run in three different modes, as an interactive command shell, as a CGI to run under WWW servers, and as an interpreter taking the statements from a file.

How it Works
When you start up IQUERY, the fisrt thing, is search for the SYSPAR.PAR file in the default ISIS install path defined by IQUERY ( '/usr/local/isis-3.0/' for Linux and SCO or 'C:\ISIS\' for DOS) or the path that you can pass to the program with the '-conf absolute_path' parameter, in that file is searched for the DataPath that is where your databases files resides in ( IQUERY also recognizes that you can have your files redirected by the dbn.PAR file where dbn is the Data Base Name), from there, it changes to one of the three modalities: shell, html or file. In any of the modalities IQUERY reads and process one line at a time showing the results in the standard output terminal.
Keep in mind that when you pass an 'absolute_path' with the '-conf' parameter this path must have the final slash, this is, if your 'SYSPAR.PAR' is located in the 'isis' directory under '/usr' your parameter would be '/usr/isis/' and NOT '/usr/isis'.
The Search Engine have two special parameters to play with, there are '-nocase' permitting you the search of KeyWords case insensitive, and '-nostrict' that consider all the blank spaces on the beginig and end of the KeyWord to find for, case sensitive searchs and strict delete of blank spaces is the default for IQUERY.
The line below describes all the parameters to IQUERY, refer to the Specification for HTML for a complete explanation on how IQUERY works for httpd CGI interfaces.

iquery [ -conf isis_path ][ -html | -file absolute_path_to_file ] [ -nocase ] [ -nostrict ]

Statements recognized in v1.0.2
#FILEPRINT FileName Reads the file identified by 'FileName' and outputs its contents. Note that 'FileName' would be an absolute file path or a relative one ( relative to the isis system path).
#STRPRINT OutputString This statement prints the 'OutputString', this string can be of any format, but be carefull when you are in HTML (read the Specification for HTML later in this document).
#OPEN DBFile:DBAlias Open the Data Base file determined by 'DBFile' and build inside IQUERY all the structures necessary to managing the information, from there, this Data Base were be refered as 'DBAlias'.
#CLOSE DBAlias Closes and free the memory of the Data Base file structure that was created by a previous OPEN statement.
#CLOSEALL Do a 'CLOSE DBAlias' for any open alias in the internal IQUERY Data Base Structure.
#


SELECT
FROM
WHERE
OutputFormat
DBFile_1:DBAlias_1, ...
QueryCondition
First the SELECT statement opens all the comma separated DBFile_x asociating DBAlias_x, and those alias/files were maintained open as long as IQUERY terminates or when is encountered a CLOSE statement. Iterates along the Data Base, secuential or indexed, and for those registers that match the 'QueryCondition' prints in the standard output the 'OutputFormat', read later in this document the Field Replacement Section, to understand how to build in IQUERY SELECT statements, the 'OutputFormat' and 'QueryCondition' fields.

Field Replacement
Each field in each register have two identifers, Field Tag and Field Name, and also you may have more than one open Alias corresponding to different Data Base Files, thus, we need to set a convention on naming each field in each Alias in some part of the output string or in a query condition of a SELECT statement.
When you are constructing the 'QueryCondition' you have to put your query like: DBAlias, folowed by a '.', the Tag Number, the match separator '=', and finally the string that you have to match. The matches will be reached by default when the string is part of the field in the record, if you would like to change this type of match be sure to check the Match String Modifiers below. For example, i have to select in the alias CORPORATION those records that have in the Tag number 40 ( that is identified also by the Field Name 'Section') the string 'Sales', then my 'QueryCondition' must be 'CORPORATION.40=Sales'.
The format of the 'OutputFormat' is so similar, you can put anything you want that will be printed when a match were found, and when you would like to replace a Field Value in the string, you have to put there a '%' Field Replacement Character folowed by the DBAlias, a '.' and finally the Tag Number of the field. Continuing with the example in the previous paragraph, now i would like to output the Tag numer 20 ( that is identified also by the Field Name 'Employer's Name'), so, my 'OutputFormat' must be '%CORPORATION.20', if you also would like to output the real character '%' then you have to put a '%%' to say IQUERY that ignore the Field Replacement function.
Of course this is not the format used in CDS/ISIS program, this is because the software is oriented to WWW Clients that have its own Format Macro Language, unless you can use it in text only format. Also in this IQUERY version there isn't a way to extract a Sub Field nor defining a block of repeatable extraction, i'm working now in this features for a newer version...

Match String Modifiers
The match string modifier is the first character in the string you want to match, and the actions taken are described below...
'=' Match exactly the string passed, i.e., 'ALIAS.40==Sales' match for 'Sales' and do not match for 'Sales Representative'
'!' Is the complement of the '=' modifier, do not match for 'Sales', and match for 'Sales Representative or any other field string value.
'~' Do not match those fields that have the match string inside, i.e, 'ALIAS.40=~Sales', do not match for 'Sales', 'Sales Representative' or 'Dept. of Sales', and do match for 'February Sale' or any other.
'^' Match those fields that begins with the match string passed, the match were reached for 'Sales' and do not for 'Sales Representative' or 'Corp. Sales'
'\' Is the escape char, for example if your fields have in its first position any of the Modifiers Characters and you'd like to match exactly for '^Sales-Rep', then your match string must be '\^Sales-Rep'.

Specification for HTML
In shell mode or file mode, there are no mystery, the statement you enter is the order that IQUERY will process and the iquery program could be installed in any directory; in html mode there are three things that you have to keep in mind when you pass data to the IQUERY CGI.
First, you have to link or copy your iquery program to your CGI execute path and rename it to iquery.cgi or do anything you want that permits to the httpd server to execute iquery. Also, you have to learn the HTML code to build FORMS (maybe you are a doctor in that), and the convention to pass data to a CGI, the prefered method of passing data to IQUERY is POST, in any case GET is also covered by IQUERY.
Second, if you would like to pass more than one command line parameter to a CGI, the HTML interface only can pass the first, that's why I added a variable that you must call 'HTMLPARAMS' to pass there the other parameters like '-nocase' and '-nostrict', and you have to pass only '-html' parameter to the CGI.
Third, IQUERY takes the statements from the 'QUERY' variable, so when you are writing an IQUERY code you must have to put it in a variable called 'QUERY', inside this variable IQUERY takes its order statements ignoring spaces and CR's/LF's (like HTML code), and translate the ';' character as a CR/LF, so the line 'strprint hi world; strprint bye', will be translated inside IQUERY as
strprint hi world
strprint bye
prosessing 'strprint hi world' and then 'strprint bye', if you forget to put the ';' in the end of each statement in your code, IQUERY understands nothing.

Macro Substitution
Up to here, you have the knowledge for writing IQUERY code for static orders, now i will explain how you can write code to pass inside the 'QUERY' variable a macro substitution to tell IQUERY that replace that macro with a real value.
A Macro Substitution will occur when you put the begin macro character '$' followed by a '{', the variable name and the close macro character '}', when IQUERY finds a macro, try to obtain the real value from the variable that has a name equal to the name of the macro, for example the statement 'strprint ${SEARCH}' will be interpreted inside IQUERY as a print out of the value of the variable 'SEARCH' passed to IQUERY. Also you have to know that IQUERY do the macro substitution before the execution of the first statement passed.

IQUERY Examples
Employers Corporation Database. This is a simple example putting all the information in this document together. I make a separate html page for the real form & query code explanation so you can view or save in a simple action of 'View -> Document Source'.

Spanish Web Servers This is a real IQUERY example of a search in a CDS/ISIS DataBase that have information for all the Spanish Web Hosts maintained here by Marcelo Kruk.



WebEdition and IQUERY Design by Alejandro Ferreira Guido.