ODBiC
Open DataBase
Internet
Connector

Version 1.4

User's Guide

Contents
Introduction
ODBiC Template Files
ODBiC Variables
ODBiC Commands
String Functions
Math functions
Running ODBiC as a CGI Program
Running ODBiC from the Command Prompt
Predefined Variables
Using ODBiC Without a Template File
Registering ODBiC


Introduction

ODBiC provides an interface between your Web pages and your ODBC databases. (ODBC stands for Open Database Connectivity, a standard for interfacing applications programs to a variety of databases.)

ODBiC may be used as a CGI program to access the data in "real time", or it may be used as a DOS program to generate the Web pages and save them as disk files. (CGI stands for Common Gateway Interface, a standard for interfacing applications programs to the Web.)

The interface to the database is provided by connecting to any ODBC driver. ODBC uses SQL (Structured Query Language) statements to SELECT, INSERT, UPDATE or DELETE the data. Some ODBC drivers support additional SQL statements such as CREATE and ALTER (table definitions) and GRANT (access privileges).

ODBiC provides commands for connecting to the database and executing SQL, but it also provides many other useful commands to facilitate the Web page generation.

This User's Guide will assume that you are already fairly familiar with the HTML (Hypertext Markup Language, which is used to format Web pages) and with SQL. If you are not, there is much information available on the Web, and you will need this information to use ODBiC effectively. For the HTML part, you might consider using one of the specialized Web page editors.

ODBiC reads "template" files as input. The template files generally contain standard HTML commands and text, which are simply copied directly to the output, but they also contain ODBiC commands and variable references. When ODBiC finds a command statement, that statement is executed immediately. Some commands cause text to be inserted into the output at that point. When ODBiC finds a variable reference, the current value of the variable is inserted into the output text.

Variables are referenced in an ODBiC template file by enclosing a variable name within a pair of dollar signs ($).

Commands are embedded in the template files by using the standard HTML "comment" notation: The start of an HTML comment is marked by the characters "<!--" and the end of the comment is marked by the characters "-->". Browsers ignore these comments, but ODBiC will look for command names beginning immediately after the characters "<!--". Here is an example of how ODBiC commands will appear in a template file:

    <!--DATABASE DSN=MyData -->
    <!--SQL select * from Products -->
    <!--TABLE-->

The DATABASE specifies on ODBC database "connection string" for a "Data Source Name" of "MyData". The SQL command will select all the data (i.e., all columns and all rows) from a database table named "Products". The TABLE command will automatically format all of the results into an HTML output table.


ODBiC Template Files

Template files are the input to ODBiC and they control the output as stated above. They will look very similar to normal HTML Web page files. In fact, you may wish to start with an existing Web page and add the ODBiC commands. Although it is possible to generate simple output without a template file (see the section Using ODBiC Without a Template File), you can get much more sophisticated results with a template.

When ODBiC is used as a CGI program, there are two ways to specify the template file. The easiest way is to include it as part of the URL that is used to invoke (execute) ODBiC. For example, if ODBiC is used as the ACTION function for a FORM declaration, then you need a URL that "points to" ODBiC on your system. The minimum specification might be something like this (depending on where you installed the program):

  <FORM METHOD="post" ACTION="http://www.yourdomain.com/scripts/odbic.exe">
But the CGI interface allows you to include some "extra path" information after such a URL, and this information is available to the CGI program when it executes. You can use this "extra path" information to tell ODBiC the path and file name for your template file. For example, this URL:
  "http://www.yourdomain.com/scripts/odbic.exe/your_dir/template1.html"
will tell ODBiC that you want to process a file named "template1.html", and it is on subdirectory "your_dir". That is, "your_dir" is a subdirectory of the Web server's main HTML file directory. This "root" directory is defined in your server's configuration file; refer to your server's documentation. If your template is directly on the server's "root" directory -- not on a subdirectory -- then you would just give the file name. (Note that your server's "root" directory for HTML files might actually be a subdirectory itself, such as "\www\htmlfile\".)

Like regular Web pages, your template files must be on a directory that is accessible to the server. Like regular URLs, the server's "root" directory is omitted from the "extra path" specification. Therefore, the "extra path" information for your template file, immediately following the "odbic.exe", will be the same as the path you would use following "www.yourdomain.com" to access that file directly through the Web: "http://www.yourdomain.com/your_dir/template1.html". (In fact, you should use your browser to try to access your template file that way, to make sure that you've got it in the right place.)

NOTE: This method only works if your Web server properly sets up a CGI input variable named PATH_TRANSLATED. If ODBiC is unable to open the template file, then it will give you an error message showing the file path and name that it tried to open. If you get this error message, examine the path carefully: This should be the full directory path, including the Web server's "root" directory. If it is not, then your server does not properly set up the PATH_TRANSLATED CGI variable.

However, if ODBiC does not get the PATH_TRANSLATED variable from the Web server, then it will try to use a variable named PATH_INFO, which is simply everything following the "odbic.exe" in the URL. If the path shown in the error message is only this "extra path" string (e.g., in the example above, just "/your_dir/template1.tmpl"), then you should try using the full path (including the root) following the "odbic.exe":

  "http://www.yourdomain.com/scripts/odbic.exe/htmlroot/your_dir/template1.html"
If you are forced to use this method, however, remember that your URLs may not work if you install a different server or move your files to a system with a different server.

If neither of these methods work, then you will have to tell ODBiC the name of the template file by passing in a variable named "input". There are two ways to do this, depending on whether you are using a FORM (with ODBiC as the ACTION function), or you are using a direct "anchor" link in the text (i.e., <A HREF="..."> link text </A>) For an "anchor" link, you can include the "input" variable after a question mark (?) in the URL:

  <A HREF="http://www.yourdomain.com/scripts/odbic.exe?input=/htmlroot/your_dir/template1.html">
Note that if you specify the template file with the "input" variable, then you must provide the full file system directory path, starting at the "root" directory. (That is, no Web server directory "mapping" can be used.)

If you are using a FORM to execute ODBiC, then the "input" variable should be given as a FORM variable. (It can be anywhere after the <FORM ...> declaration but before the </FORM>.) This variable should be specified as a "hidden" form field, such as:

<INPUT TYPE="hidden" NAME="input" VALUE="/htmlroot/your_dir/template1.html">.) 

Refer to the section Running ODBiC as a CGI Program for more information on invoking and passing variables to ODBiC.

If you are using ODBiC as a "command prompt" program, rather than as a CGI online program, then the input file (and the output file) can be specified in the "run" command line. See the section Running ODBiC from the Command Prompt.


ODBiC Variables

As noted above, variable references in a template file are replaced by their "current value" within ODBiC. Variable references may be used anywhere in the template file: in ordinary text that is to be output; in HTML commands that are to be output; or within ODBiC command statements.

A variable is referenced in an ODBiC template file by enclosing a variable name within a pair of dollar signs ($). Variable names must always begin with an alphabetic character, "a" to "z" or "A" to "Z". (This helps to avoid confusion with an actual dollar amount like $100.) After the initial character, variable names may be any uppercase or lowercase alphabetic character, any numeric digit, the underscore character (_), or a space (blank) character.

There are four ways that variables can be defined and set to values in ODBiC: they are input when ODBiC is run; they are selected as data from the database; they can be explicitly declared and set in the template; or they are special predefined variables that are set by the program.

See the sections Running ODBiC as a CGI Program and Running ODBiC from the Command Prompt for more details on input-type variables. In the ODBiC template file, any variable name that exactly matches an input variable name is assumed to be a reference to that input variable, and that reference is replaced by the input value. (Actually, for all variables, variable names match "exactly" if they are spelled the same, but character case does not matter. For example, "name" would match "Name" or "NAME".)

The second source for ODBiC variables is from a database. Whenever any SQL SELECT statement is executed, variables are automatically created for each of the result column names. These variables are initialized with the values from the first result row after the SELECT is executed. (There is no "fetch" command; a "fetch" of the first row is automatically performed when the SQL statement is a SELECT.) There is a command syntax for "looping through" multiple result rows, which changes the "current value" of the column variables on each row.

The third way that a variable can receive a value is by using the SET command in the template. With this command, you can set a variable to be a specific number or character string (which might be called a "constant" or "literal" value), or to another variable's value, or to the value of an arithmetic or character string "expression" using variables and constants.

In addition to the SET command, there are two ODBiC commands that affect variable values. One allows you to set default values for any variables that you wish to use in the template file, but which might not have an actual value. (For example, a user might leave a form input field blank, or a column retrieved from the database might be blank or null.) If no other value for a variable is found, then its default value will be used.

The second command for variables allows you to define translation tables for values. This is useful when database values employ codes that are not immediately obvious or readable. The translation table for a variable consists of a set of translation pairs, each pair being an actual value and the desired display text for that value. For example, you might have a database "flag" for some option where a value of "1" means "Yes" and "0" means "No". The translation table for that variable would have two entries: 1=Yes, 0=No.

ODBiC also has certain predefined variables that may be used for output, such as the current date and the current SQL result row number. There are also some predefined input variables that you may use to control processing. These are documented in the section Predefined Variables.

NOTE: If an undefined variable name is encountered in the template file, then the variable name itself will be output "as is", including the enclosing "$" signs. (The one exception to this rule is that undefined variables used in any logic expressions or string functions are treated as null strings.)

Any variable's text value may contain other variable references, and the embedded variables may also reference other variables. All variables are resolved before output or before execution of any command containing variables.

There are some special character "string functions" that you may use anywhere that you can use a variable. For example, there are functions for taking left, right, or middle "substrings" from a variable. Another function encodes a variable in "URL format" so that it may be passed to a CGI program in an HTML link. The names of these functions begin with a "$" sign, and they will always have one or more "function arguments" enclosed in parentheses. For example, this expression, "$mid($string$,3,4)" is replaced by the value of variable $string$, starting from the third character for a length of four characters. Any of the arguments to a string function may be arithmetic or logic expressions using variables or literals.

Some of the "math" functions are intended to be used with character-string variables: len( ), pos( ), char( ), isNumber( ), isAlpha( ), and isAlphaNum( )). These may be used anywhere in SET expressions or string-function arguments, or they may be used as true/false logic tests in IF statements to validate input data.


ODBiC Commands

ODBiC commands are embedded in the template files by using the standard HTML "comment" notation: The start of an HTML comment is marked by the characters "<!--" and the end of the comment is marked by the characters "-->". Browsers ignore these comments, but ODBiC will look for command names beginning immediately after the characters "<!--". NOTE: There must not be any spaces between the "<!--" character sequence and the first character of the command name, so the "<!--" is effectively part of the command name. Command names may be typed in uppercase or lowercase characters.

All command statements must be ended with the "-->" characters to make the entire command a valid HTML comment. Many commands will have additional parameters or processing specifications between the command name and the ending "-->" marker. Some commands will require more specifications than will fit comfortably on one line, so multiply lines are allowed before the ending "-->".

NOTE: Any comments that are not recognized as ODBiC commands are simply copied to the output. If you see that a "command" is being output as a comment instead of being executed, check the spelling and syntax carefully. (Remember to use your browser's "View Source" option to see these unrecognized commands, however, since the browser will not show HTML comments in the normal display.)

For security reasons, ODBiC commands cannot be embedded in variables. That is, only commands that are actually in the template file, before variable text substitution, will be recognized.

Quick Command Reference

DATABASE Define ODBC database connection string
DEFAULT Define default values for "empty" variables
EACHROW, ENDROW Define formatting for each result row after a SELECT statement
EXEC Execute a system command or run a DOS program
EXIT Terminate the template file processing
FORMAT Define output format "mask" for a variable
IF, ELSE, ENDIF Conditional test of variables
IFNEW Test an "ORDER BY" column in sorted result rows for new group
INCLUDE Read and process an additional template file
OPTIONLIST Create an HTML "select option" list from a query
OUTPUT Write the output to a disk file
QBE Generate and execute a "query by example" SQL statement
REDIRECT Redirect user's browser to a different URL
SET Set variable to value
SQL Execute an ODBC SQL statement
TABLE Format SELECT results as an HTML table
TRANSLATE Define translation table for a variable
UPDATEFORM Generate a database update form

<!--DATABASE odbc_connection_string -->

The DATABASE statement specifies the ODBC database connection that will be used for subsequent SQL commands. ODBiC uses the ODBC SQLDriverConnect function to connect to databases, so any of the optional arguments supported by a particular driver are valid in this connection string. Typical arguments are "DSN" (Data Source Name), "DRIVER" (explicit driver specification), "UID" (database-defined user ID), and "PWD" (user password).

A minimal connection string should define the ODBC "Data Source Name" as "DSN=data_source_name" (where "data_source_name" is the actual Data Source Name defined in your ODBC setup; see below). For databases that support security, the connection string should also specify a UID user ID and PWD password.

You must have a DATABASE statement in your HTML template file before any SQL commands. (Optionally, you may pass in a connection string in the variable named "database"; see the section Predefined Variables.) This command does not actually establish a connection, however. Rather, the connection string specified by this statement will be used to connect when an SQL command is executed.

The connection string set by this statement applies to all subsequent SQL commands until a different DATABASE command is encountered. If you need to access another database, just use another DATABASE statement before those SQL statements. (This does not mean that the database connection is re-established for each SQL statement, however. The connection established by the first SQL statement stays open until another SQL statement is executed with a different connection string, or until ODBiC terminates.)

You can use variables anywhere in the DATABASE statement (including the DSN). One common usage would be variables to insert the user's ID and password, which you might get from an input form:

    <!--DATABASE DSN=Employees; UID=$user$; PWD=$password$ -->
DSN names are defined using the ODBC DSN definition dialog box (which can be accessed from the Control Panel by clicking on the ODBC icon). Note that on Windows NT systems, which associates DSNs with NT user IDs, any DSNs accessed by ODBiC will need to be defined as System DSNs, or they will need to be defined for the user ID that your Web Server uses. (Refer to your server's documentation. Note that some servers run as LocalUser, which cannot have DSNs assigned, so you must use a System DSN.) To define a System DSN, click on the "System DSN" button on the dialog box before you define the DSN.

However, you can bypass all DSN user associations by giving a complete ODBC connection specification in the DATABASE statement. This would include a driver and file type specification, file location path, and various options. Refer to the ODBC documentation for complete details, but here is an example of a connection string for an MS Access database contained in the file C:\httpfile\db\products.mdb:

    <!--DATATBASE DRIVER={Microsoft Access Driver (*.mdb)};
        DBQ=c:\httpfile\db\products.mdb; FIL=MS Access-->
Note that the "DRIVER={...}" string (which is inside curly braces) must be the exact text that is shown in the ODBC DSN definition window for available drivers. (This is because the ODBC Driver Manager uses this same table to look up the driver.)

Depending on the database that you are using, the DBQ specification may need to be a complete file path and file name, or it may just be a directory. Refer to the examples in the chart below. For example, the MS-Access DBQ gives the file name of the database, "c:\temp\sample.mdb", but dBASE puts each database on a separate directory, so the DBQ just indicates this directory, "c:\temp".

If you are using ODBC 3.0 (which is shipped with Office97), you may also need to use the DRIVERID keyword. In the chart below, if you are using ODBC 2.x do not use the DRIVERID keyword.

Example Connection Strings Without Using DSN

  Database                Keywords

  Microsoft Access        DRIVER={Microsoft Access Driver (*.mdb)};
                          DBQ=c:\temp\sample.mdb;
                          FIL=MS Access

  dBASE                   DRIVER={Microsoft dBASE Driver (*.dbf)};
                          DBQ=c:\temp;
                          DRIVERID=277;
                          FILE=DBASE2   (or DBASE3, DBASE4)

  Microsoft Excel 3/4     DRIVER={Microsoft Excel Driver (*.xls)};
                          DBQ=c:\temp;
                          DRIVERID=278;
                          FIL=EXCEL

  Microsoft Excel 5       DRIVER={Microsoft Excel Driver (*.xls)};
                          DBQ=c:\temp\sample.xls;
                          DRIVERID=22;
                          FIL=EXCEL

  Microsoft FoxPro        DRIVER={Microsoft FoxPro Driver (*.dbf)};
                          DBQ=c:\temp;
                          DRIVERID=536;
                          FIL=FOXPRO 2.0   (or FOXPRO 2.5, FOXPRO 2.6)

  Paradox                 DRIVER={Microsoft Paradox Driver (*.db );
                          DBQ=c:\temp;
                          DRIVERID=26;
                          FIL=PARADOX

  Text                    DRIVER={Microsoft Text Driver (*.txt;*.csv)};
                          DEFAULTDIR=c:\temp;
                          FIL=TEXT
For other databases, refer to your ODBC driver's documentation for keywords required or allowed with the ODBC "SQLDriverConnect" function call.

<!--DEFAULT variable=value [, variable=value, ...] -->

The DEFAULT statement allows you to set values for variables in case they are left empty on a user input form, or for database columns that might not have any values in a given row. If an "empty-valued" variable is used anywhere in the template file and there is a DEFAULT value defined, then the DEFAULT value will be inserted. (Otherwise, of course, the variable's actual value will be inserted.) NOTE: An "empty-valued" variable is one that is not defined by an INPUT field or a database column, or a defined variable that contains no data.

You can give a list of variable=value pairs in the DEFAULT statement. All values are treated as text strings. Double-quotes around values (e.g. variable="value") are not required unless the value contains a comma (which separates variable specifications in the statement), but you may use quotes if you like. If you don't use the double-quote marks around a value text string, no leading or trailing spaces for the value will be included. (For example, if the command were "DEFAULT var1 = value one , var2 = value 2 , ...", the actual text values used would be "value one" and "value 2".)

You can use multiple DEFAULT statements, or you can use a single DEFAULT statement that spans multiple lines (with the "-->" marker after the last variable on the last line).

You may define DEFAULT values for up to 100 different variables. You may also redefine the default value for a variable that was previously used in the template file. (The default is in effect from the point of the DEFAULT command until another DEFAULT is specified for the same variable.) And you may define a default value that is another variable (for example, "<!--DEFAULT var1 = $var2$, ... -->"). (Note that this variable substitution will be done when the defaulted variable is actually referenced, not when the DEFAULT value is set by this command. This allows the DEFAULT value to change as "var2" changes.)

<!--EACHROW--> ... <!--ENDROW-->

The EACHROW command marks the beginning of formatting that is to be applied to each result row after a SELECT query. The end of the formatting is marked by the ENDROW command. (The ENDROW is required if you use an EACHROW command.)

The EACHROW command does not need to be immediately after the SQL SELECT statement -- for example, you may output a table header before you begin formatting the results -- but EACHROW always refers to the last SQL SELECT statement that was executed.

As noted previously, there is no "fetch" command. A SQL statement that is a SELECT causes an immediate, automatic fetch of the first result row. Additional "fetches" are automatically performed at the bottom of the EACHROW processing, until there are no more rows. Therefore, if you are selecting a single row from a table, you do not need to use the EACHROW command.

You can use any sort of text or HTML commands in the EACHROW formatting, and any reference to a database variable (that is, a result column name prefixed and suffixed with $ signs) will be replaced by the value of that column in the current result row. However, you may not use any ODBiC commands inside of the EACHROW formatting except for the following: IF, IFNEW, ELSE, ENDIF, SET, INCLUDE, and EXEC.

Inside an EACHROW specification, you may use the ODBiC variable $row$ to reference the current row number. The $row$ variable is initialized after each SQL statement (see the SQL command) and it is incremented for each fetched result. You might use this variable to enumerate the results, or you might want to test for particular row numbers. For example, you could use a conditional statement <!--IF $row$ = 1 --> to do some special output, such as a table header, before any results are output. (But it is generally easier to put such "first row" formatting between the SQL statement and the EACHROW command: Any output after the SQL but before the EACHROW will be done for the first row only.) The $row$ variable is most useful when you want to limit the number of rows displayed.

Since the EACHROW command always loops through all of the result rows, you should not use EACHROW combined with any of the other result looping commands, TABLE, UPDATEFORM, or OPTIONLIST.

The formatting text between the EACHROW and the ENDROW can span multiple lines up to a maximum size of 12K bytes (which is about 150 full 80-character lines).

<!--EXEC dos_command [arguments] -->

The EXEC command allows you to run DOS programs and execute system commands. (To run programs, you must specify the complete path to the directory where the executable file is stored.) You may specify any necessary arguments (which, of course, may be ODBiC variables) to the system command or program.

One useful purpose for this command is to execute additional ODBiC processes. For example, in a template file that has made a change to a database, you might execute ODBiC to regenerate a "fixed" page. Using this technique, rather than always querying the database in "real time", can save on document access time.

If the system command or program writes any "console" output as a result of execution, this output will go directly back to the user's browser. (Note that the output does not go through ODBiC, so no ODBiC processing on the output is possible.)

For security reasons, the command string cannot contain a "$T" command separator (which, on a DOS command line, can be used to issue multiple commands on a single line).

<!--EXIT-->

The EXIT command causes ODBiC to stop processing the input template file. It is most useful inside an IF statement, such as after output of an error message. In such cases, an "early exit" can avoid some complicated and heavily nested IF/THEN/ELSE clauses that would be necessary to skip the rest of the file.

<!--FORMAT variable=mask [, variable=mask, ...] -->

The FORMAT command allows you to specify special formatting for variables, such as forcing a certain number of decimal places for numbers, adding commas to mark thousands, and adding a dollar sign or pounds sign in front of money amounts. For alphabetic variables, a formatting mask can be used to insert any special characters.

Note that the FORMAT command does not cause formatting at the point that it is issued; it defines a mask that will be used anytime that the variable is referenced. Therefore, the FORMAT command can appear anywhere in the template before the point that the variable will be referenced for output. (Specifically, the FORMAT command should not, and cannot, be used inside an EACHROW loop. Specify the FORMAT mask before the EACHROW.) Note, however, that there is a string function, $format( ), that does perform this same formatting function at the point that it is encountered.

The formatting mask uses the pound sign character (#) to indicate a position that can be filled by a character or digit from the variable. For numeric values, the zero character (0) also represents a position that can be filled by a digit from the variable, or a "0" if there is no digit at that position. Other characters (except as noted below) are copied to the formatted output.

For variables that have a numeric value (i.e., a variable containing only digits, plus or minus sign, or a decimal point), you may use the minus sign (-) as the first character of the mask to indicate that negative numbers should be formatted with a "-" sign in front, but positive numbers are to have no sign. A plus sign (+) as the first mask character causes both positive and negative numbers to be shown with a plus sign or a minus sign, respectively. If the mask does not use either the plus or minus signs as the first character, then negative numbers will be shown without a sign.

You may also use the dollar sign character ($) or pound sign character (£) as the first mask character (or as the second character if you have a plus or minus sign as the first character.) This will cause a dollar sign or pound sign to be added to the front of a numeric value.

For numeric variables, the explicit or implicit decimal points of the mask and the number are aligned. The result will have a decimal point only if the mask does. Working toward both the left and right of the decimal point, digits from the variable replace any "#" characters in the mask, but only if there is a digit at a given position. If there is no digit at that position, then the formatting process stops. That is, as long as there are digits remaining in the value, then "#" characters are replaced by digits and special characters such as commas are copied to the output, but when there are no digits left, then the formatting is finished and special characters past that point are ignored. A "0" character in the mask will be replaced by the digit from the variable at that corresponding position, if there is one, or the "0" will remain in the output if there is no digit.

Here are some examples:

    <!--FORMAT price="$#,###,##0.00" -->

    If price is:    the output will be:
     10.00                 $10.00
     1250.00               $1,250.00
     6.0000                $6.00
     .501                  $0.50
     -1                    $1.00

    <!--FORMAT price="-$#,###,##0.00" -->

    If price is:    the output will be:
      235000               $235,000.00
      -10.999              -$10.99

    <!--FORMAT value="+#####0.0###" -->

    If value is:    the output will be:
      1                    +1.0
      505.505              +505.505
      -23.123456           -23.1234
      .5                   +0.5
For variables that are not numbers, the formatting is less complicated. Working from left to right in the mask, each successive "#" character in the mask is replaced by the next successive character in the variable. Characters other than the "#" in the mask are simply copied to the output. When there are no characters remaining in the variable, then the formatting is finished, and any remaining characters in the mask are ignored.

NOTE: If your mask contains any commas, then you must enclose the mask in double-quotes (") in the FORMAT command. This is because commas separate the "variable=mask" pairs in the command. The quotes are optional if there are no commas in the mask.

You may define up to 50 format masks. You might use separate FORMAT commands for each variable or declare several in the same command, separated by commas. The list of "variable=mask" pairs can span multiple lines with the command-terminating "-->" mark after the last variable on the last line.

<!--IF [NOT] value1 condition value2 [AND | OR ...] --> ... <!--ELSE--> ... <!--ENDIF-->

The IF statement allows you to test the current value of variables or arithmetic expressions involving constants and variables, and to generate HTML output or execute ODBiC commands only if the specified conditions are true.

Every occurrence of an IF statement must have a matching ENDIF to mark the end of the conditional processing. You can "nest" IF statements (that is, you can have another IF statement in the conditional part of an IF or ELSE section).

"Value1" and "value2" can be any variable (referenced by the variable name prefixed and suffixed with "$" signs), a "literal" value (a number or a text string), an arithmetic expression using numeric-valued variables or literals, or a "string function" expression that produces a text string. Arithmetic expression may use "+" for addition, "-" for subtraction, "*" (asterisk) for multiplication, or "/" for division. Parentheses, "(" and ")", may be used to indicate the order of evaluation (i.e., operations inside parentheses are performed first). A "unary" minus sign is allowed to indicate that a variable, constant, or expression inside parentheses is to be negated (e.g., $x$ / -$y$ or -($x$ / $y$)). You may also use any of the math functions in an expression.

NOTE: Variables used in IF statements must be enclosed in "$" characters. That is, the program does not assume that any operands in an IF comparison are variables. Like output text, you must enclose the variable names in "$" characters to cause the variable's values to be substituted into the expression.

The "condition" specifies a test between the two values: "=" (equal), "<>" or "!=" (not equal), ">" (greater than), "<" (less than), ">=" (greater than or equal), or "<=" (less than or equal). If the specified relationship between the two values is true, then all text and statements following the IF, up to an ELSE or ENDIF statement, will be processed. The ELSE reverses the sense of the test, and any text and statements up to the ENDIF will be processed only if the test specified in the IF statement is false.

You may combine conditional tests using AND (i.e., conditions on both sides of the AND must be true) or OR (either side may be true), or use NOT in front of a condition expression to reverse its sense. You may use parentheses to indicate the order of the compounded tests. The default is that NOT is performed first, AND is performed next, and OR has the lowest precedence. For example, "NOT $a$=1 AND $b$=2 OR $c$=3 AND $d$=4" is the same as "((NOT $a$=1) AND $b$=2) OR ($c$=3 AND $d$=4)".

Actually, you can test the "condition" of a single variable. When only one value is given in a conditional expression (or a single value is compounded with NOT, AND, or OR), then the test produces a "true" result if the value is any non-empty string or any non-zero number. For example, you can say <!--IF NOT $name$ --> to test if the variable "name" has no value, or <!--IF $opt1$ AND $opt2$ --> to test for having values for both variables. Three of the math functions are intended to be used in this way to validate input data: isNumber ( ), isAlpha ( ), and isAlphaNum ( ). For example, you can say <!--IF NOT isNumber($price$) --> to check for an invalid number in the "price" variable.

An IF statement comparison is assumed to be a numeric comparison whenever both values are numeric values or arithmetic expressions. Otherwise, if either value is non-numeric, then a text string comparison will be used. You can use quote marks around or in a value expression to force the entire value to be treated as a text string, but the quotes are optional if the string expression contains any non-numeric characters. For these "implicit" text string comparisons, leading and trailing space on values are ignored. (For example, <!--IF $var$ = this value --> is the same as <!--IF $var$="this value" -->.) You can, however, include spaces inside quotes if you need to have them as part of the comparison, such as <!--IF $var$ = " " -->.

You may include another IF statement in the ELSE statement, such as:

    <!--IF $type$=A -->
        ...
    <!--ELSE IF $type$=B -->
        ...
    <!--ELSE IF $type$=C -->
        ...
    <!--ELSE-->
        ... (not A, B, or C)
    <!--ENDIF-->
The advantage of this form is that the IFs are not "nested" and you only need one <!--ENDIF--> to end the entire series.

Note that if you test a variable that has a TRANSLATE table defined for it, you must test for the translated value rather than the original value. In general, remember that the "value" expressions in an IF statement are processed like normal output before any arithmetic or the comparison itself is performed.

Example (indentation helps to pair IFs with ELSEs and ENDIFs):

    <!--IF $Discontinued$ = Yes -->
        This is a discontinued item.
    <!--ELSE-->
        <!--IF $UnitsOnHand$ -->
            We have $UnitsOnHand$ units in stock,
            <!--IF $UnitsOnHand$ < $UnitsOrdered$ -->
                which is insufficient to fill this order.
            <!--ELSE IF $UnitsOnHand$ - $UnitsOrdered$ < $ReorderLevel$ -->
                so we can fill this order, but it is time to reorder.
            <!--ELSE-->
                so we can fill this order.
            <!--ENDIF-->
        <!--ELSE-->
            We have no units in stock. Time to reorder.
        <!--ENDIF-->
    <!--ENDIF-->

The condition specified in an IF or ELSE IF statement can span multiple lines, but the "-->" must mark the end of the condition.

<!--IFNEW variable -->

The IFNEW is a special test that can be used to determine if a variable has changed value since the last time it was tested with an IFNEW statement. This statement is primarily intended to be used to test a database column inside an EACHROW formatting specification: If the result rows have been sorted by some "grouping" column value, then this test can be used to do special "master/detail" or "category" formatting whenever that grouping column changes value. (To sort or group the result rows by the desired column or columns, you should include an ORDER BY clause in the SQL SELECT statement.)

For example, the following could be used to list items grouped by category with a category header before each group:

    <!--SQL SELECT category, item_number, description FROM item ORDER BY category -->
    <!--EACHROW-->
    <!--IFNEW category -->
      <H1> $category$ </H1>
    <!--ENDIF-->
    <P> $item_number$ $description$ 
    <!--ENDROW-->
An example of "master/detail" reporting might be the case where you have a table that has one row for each of your customers and another table with many order rows for each customer. The master customer table must have some unique ID that can be used to identify each customer's orders in the detail order table. You need to "join" your master table to the detail table using this ID. The general form would be:
    <!--SQL SELECT * FROM master, detail WHERE master.id = detail.id 
            ORDER BY master.id, detail.order_date -->
    <!--EACHROW-->
    <!--IFNEW id -->
      (... format any data from the master table)
    <!--ENDIF-->
    (... format the data from a single detail row)
    <!--ENDROW-->
The "join" will produce one result row for each detail row. Every result row for a given customer will actually include all the master table data for that customer. But the IFNEW structure above will allow you to display the master data only once (i.e., whenever a new master ID is encountered in the result set).

Like the IF statement, you can have an ELSE section, and you must have an ENDIF to mark the end of the conditional processing. You may also "nest" IFNEWs and IFs.

You may use multiple IFNEWs if you have several levels of grouping. However, remember that you must include each tested column in the ORDER BY clause, with the "major order" (highest level of grouping) first, and you should test them in that same order. If you use more than one IFNEW test in an EACHROW loop, ODBiC assumes that you are using multi-level grouping and resets all "lower" level variables whenever any "higher" level produces a "new" result. (That is, they will also return a "new" result the next time they are tested, without actually testing the old values. This is to force a "new detail" break when the "master" changes, even if the actual value of the "detail" column happens to be the same as the previous "master".)

Note that the only argument in the IFNEW statement is a single variable. Since this argument must be a variable, you can use just the variable name without the "$" signs around it. (However, any "$" signs will be ignored.)

<!--INCLUDE filename -->

The INCLUDE command will read and process the specified file. The INCLUDE file can contain any HTML and ODBiC commands, and it is processed as if the text from that file were "pasted" into the template file at the point of the INCLUDE command. This command allows you to reuse standardized text and formatting in multiple files, and it is most useful for allowing that text to be changed easily without editing multiple files. INCLUDED files may also INCLUDE additional files.

NOTE: The referenced filename must have the full directory path specification, such as would be used to open the file with a text editor, and no Web-server directory mapping will be applied.

<!--OPTIONLIST [size] column FROM table [WHERE ...] -->

The OPTIONLIST command may be used to generate an HTML form "select option" input field by querying the acceptable values from a database table. Selecting the values from a database table informs the user of the available choices and prevents entering values that are not in the table.

This command should only be used when outputting an HTML form, and it should appear inside the <FORM> declaration.

The HTML commands <SELECT> and <OPTION> are used together to define a data entry field on a form with the acceptable values listed. The user may click on an entry to highlight and select it. The field on the form will either be a single-line box with a "pull-down" menu arrow, or it will be a scrolling window, depending on the optional "size" specification. (Note: Some browsers do not support the "size" option.) The default for "size" is one (1), which produces a "pull-down" menu box, and any number greater than one will create a window that number of lines high. (If the browser supports the "size" specification, the window will show "size" lines, at most, and the window will have a scroll bar if the actual number of available selections exceeds the number of lines displayed.)

The options in the list will be generated by an automatic SQL query, which will be "SELECT DISTINCT column FROM table [WHERE ...] ORDER BY column". All column values from this query will be inserted as <OPTION> values on the form being created.

The generated HTML <SELECT> form field acts like an INPUT variable to the form's ACTION function. In the case of the OPTIONLIST command, the name used for this input variable will be the same as the column name in the OPTIONLIST specification. The value will be the user's highlighted selection. To the ACTION function (e.g, ODBiC processing a second template file), there will simply be an INPUT variable with the same name as the column, just as if the user had typed the value into a standard INPUT field with that name.

Examples:

    <FORM METHOD="post" ACTION="\scripts\odbic.exe\your_dir\template2.htm" >
    Select category: <!--OPTIONLIST 10 Category from Products --> <BR>
    <INPUT TYPE="submit" VALUE="Get Products">
    </FORM>
In the command above, the optional "size" specification is given, which produces a scrolling window 10 lines high. In "template2.htm" (which is the designated target for the ODBiC ACTION function above), the user's selection will be a variable named "Category". In that template, you might use the following form to give the user another choice list for the products in the selected category:
    <FORM METHOD="post" ACTION="\scripts\odbic.exe\your_dir\template3.htm" >
    Select product: <!--OPTIONLIST 25 Product from Products WHERE Category = '$category$' --> <BR>
    <INPUT TYPE="submit" VALUE="Get Product Description">
    </FORM>

<!--OUTPUT filename -->

The OUTPUT command specifies that the processed output is to be written into a file rather than writing the output back to the Web browser. The "filename" given in this command must specify the complete file system directory path. The file will be created if it does not exist, or it will be over-written if it already exists. (Note that a temporary file is actually used for writing. The original file, if any, will be deleted only when the program terminates, and the temporary file will be renamed. This helps to avoid contention for an HTML file that a browser may be reading.)

The OUTPUT file will be created whether ODBiC is run as a CGI program or as a command line program. If ODBiC is being run as a CGI program and an output file has been specified (either with the OUTPUT command or the "output" variable), then the Web page returned to the user's browser will simple say "File created: filename".

Note that the OUTPUT command is executed at the point that it is encountered in the template file. Therefore, if you want all output to go into the file, you must make the OUTPUT command the first command in the file.

An OUTPUT command without any file name (i.e., <!--OUTPUT-->) causes output to revert back to the browser. Thus, you can embed an OUTPUT command in the file after writing some browser output, write some data into the file, and use <!--OUTPUT--> to revert back to normal browser output.

OUTPUT commands are not "nested". That is, each occurrence of an OUTPUT command causes any previous output file to be closed, and you may not resume writing to that closed file.

<!--QBE TABLE=database_table, numeric_field | 'text_field' [, ...] -->

The QBE command automatically generates and executes a "Query By Example" SQL SELECT statement by examining the specified input fields. This command allows a wide variety of different queries from a single input form. The QBE-generated query statement has two major advantages over direct SELECT statements that you might use in a template file. The first is that the user controls which columns are included in the selection criteria. That is, the input form can have entry fields for all of the database columns for which the user might want to specify query criteria, but the user does not have to specify all of them in a given query. Instead, the user may enter values in any one or in several fields, and only those fields will actually be used in the query.

The second advantage is that the values entered do not need to be tests for an exact match in the database (i.e., "column = value"). Rather, the user can specify a comparison for "not equal", "less than", "greater than", "less than or equal", or "greater than or equal" the given value. The user can also use the flexible SQL comparisons of LIKE or NOT LIKE (i.e., pattern matching), BETWEEN or NOT BETWEEN (given limits), and IN or NOT IN ( i.e., contained in a specified list of values).

The generated SQL statement will be "SELECT * FROM" the specified database table. ("SELECT *" causes all defined columns to be returned). The WHERE clause will depend on which of the input form fields contain any values. That is, input fields with no user-entered values (and no DEFAULT values) will not be included in the WHERE clause.

Form input fields that do contain values will be checked to see if they begin with any of the following characters: "=" (equal), ">" (greater than), "<" (less than), ">=" (greater than or equal), "<=" (less than or equal), "<>" or "!=" (not equal). If any of these characters are found at the beginning of the field, then the generated WHERE clause will use the specified comparison operator (instead of "="), between the database column and the input value.

Next, fields are scanned for the presence of a percent character, "%", anywhere in the field. The "%" character is the SQL "wild card" character used in a LIKE comparison: Any occurrence of a "%" character matches zero or more occurrences of any character in the database column. For example, the SQL clause, "WHERE last_name LIKE 'harr%' " might select HARRIS, HARRINGTON, and any other names that begins with "harr". A pattern of "%ton" would select any name ending in with "ton". A pattern of "%ing%" would select any name with "ing" anywhere within the name (including the beginning and the end). If a percent character is found in the input form value, ODBiC will automatically use a LIKE comparison in the WHERE clause. (Note: If you need to select on a value that contains an actual "%" in the database, then you can use the "=" at the beginning of the input value to override the automatic LIKE comparison.)

Next, the entered fields are checked to see if they begin with any of the special SQL comparison operators: LIKE or NOT LIKE (followed by a pattern containing any number of "%" characters; note that the LIKE is not really required if the field contains any "%" character); BETWEEN or NOT BETWEEN (followed by a lower limit, the keyword AND, and an upper limit); or IN or NOT IN (followed by a list of comma-separated values enclosed inside a set of parentheses). (The IN or NOT IN list of values can also be the single-column result rows of a "subquery" SELECT statement.) If any of these operators is found, then it is directly inserted into the WHERE clause instead of an "=" sign. NOTE: When any character-data value (as opposed to a numeric value) is used in any of these special operators, the user must enclose the data inside of single-quote (apostrophe) characters. (This is because the comparison is inserted "as is" into the WHERE clause.)

If none of these special operators is found in the input value, then the SQL WHERE clause will just be "column = value" for that input.

In the QBE command, the "TABLE=" specification is required. The generated SQL SELECT statement will select all columns from the specified table.

Following the "TABLE=" part of the QBE command, you can specify one or more column names which may be included in the WHERE clause of the SQL SELECT statement. These should match the input variables that you have provided in your query form. As noted above, fields that do not have any current value will not be included in the WHERE clause.

NOTE: There are several special considerations for the column names given in the QBE command:

After the QBE command is executed, all the database column values from the specified table will be selected, and you can use the TABLE, EACHROW, or UPDATEFORM commands, just as you would after any SELECT statement.

Example:

    <!--QBE TABLE=Employees, EmployeeID, 'LastName', 'FirstName', 'Title',
       'BirthDate', 'HireDate', 'Address', 'City', 'Region', ReportsTo -->
The TABLE to be SELECTed FROM is "Employees". "EmployeeID" and "ReportsTo" are numeric data columns, and all of the rest are character data (as indicated by enclosing the column names in apostrophes).

<!--REDIRECT url -->

The REDIRECT command may be used to "transfer" the client browser to a different URL. The specified URL is the same as might be used in an HTML <A HREF="url"> link tag. The specified URL may be a variable or it may have variables embedded in it (e.g., the file name).

NOTE: This command can only "redirect" the client browser if no output has been produced by the current template file. That is, the only things that can appear before the REDIRECT command in the template file are ODBiC commands that do not produce output. For example, you might have an SQL statement to select the URL from a database table, or you might use an IF statement to conditionally execute the REDIRECT command. NOTE: Any spaces before the '<!--" at the beginning of an ODBiC command and any spaces after the "-->" at the end of a command do cause output, since ODBiC cannot determine if these spaces are significant. Therefore, if you use the REDIRECT command, make sure that all preceding ODBiC commands begin in the first column of each line, and that there is a RETURN immediately after the "-->" marker at the end of the command.

If any output has already been produced by the template file before the REDIRECT command is encountered, then ODBiC cannot automatically redirect the user's browser. In such a case, ODBiC will insert an HTML text link to the specified URL instead. This link line will say "Please click here to continue".

When a REDIRECT command is encountered, the remainder of the HTML template file is not processed.

<!--SET variable = value [, variable = value, ...] -->

The SET command explicitly creates and assigns a value to a variable. Unlike the DEFAULT command, a SET variable will override any other definition for the variable. Also, you may use other variables and arithmetic expressions in SET commands, and they are evaluated at the point that the SET command is used.

Arithmetic expressions may use "+" for addition, "-" for subtraction, "*" (asterisk) for multiplication, or "/" for division. Parentheses, "(" and ")", may be used to indicate the order of evaluation (i.e., operations inside parentheses are performed first). A "unary" minus sign is allowed to indicate that a variable, constant, or expression inside parentheses is to be negated. You may also use any of the math functions and the string functions in the expression. You can use logical expressions in a SET command: A "true" value will be represented by a "1" and a "false" value will be represented by a "0". You may use these "1" and "0" logic values in arithmetic expressions, such as <!--SET $count$ = $count$ + ($type$ = A)-->. (A "1" will be added to $count$ only if the $type$ is "A", which saves using an IF/ENDIF statement around the SET.)

NOTE: If you use any variables in the "value" expression of a SET command, you must enclose the variable names in "$" characters. That is, the program does not assume that any part of the "value" is a variable.

If the string value contains any arithmetic operation characters that you don't want evaluated as arithmetic, then you must put the value inside double-quote (") marks. You must also use quotes if the value contains any commas, since commas are used to separate multiple variable specifications in the SET command. (The exception to this rule is that commas inside parentheses, e.g. commas separating function arguments, are recognized as being part of the expression for one variable.) Otherwise, quotes are not required, and any leading or trailing space characters will be ignored.

You can cause "string concatenation" by giving multiple variables in the "value", such as "var = $a$$b$" or "var = $a$ plus $b$". You may use quotes around any part of such a concatenated expression or around the entire expression. Variable references and arithmetic that are inside quotes, such as "$val$ + 1", will not be evaluated when the SET command sets the value. When the variable is actually used for output, however, any variables embedded in the SET expression will be replaced by their current value.

Since the target of a SET assignment is necessarily a variable, you do not need to enclose that variable name in "$" characters. (However, they will be ignored if you do.)

Examples:

    <!--SET count = $count$ + 1, done = Yes,
       value = ($number1$ + $number2$) * $price$, tax = $price$ * $rate$ -->

    <!--SET hypotenuse = sqrt($x$*$x$ + $y$*$y$), prefix = $left($string$,3) -->

    <!--SET total = "$eval($UnitPrice$ * $Quantity$)" -->
The last example above shows one way to use the $eval( ) string function. Because the expression is in quotes, it is not evaluated when the "total" variable is set. However, the quotes are not set as part of the value, so anywhere $total$ is used subsequently in the template, (for example, in a table produced by an EACHROW loop), the $eval( ) function will cause the expression to be evaluated, using the current values for $UnitPrice$ and $Quantity$, and the result will be inserted into the output.

<!--SQL sql_statement -->

In this command, you can use any SQL statements acceptable to your ODBC driver. The SQL statement is issued immediately at the point that it is encountered in the HTML template file.

For SELECT statements, after the statement is executed, each result column will be defined as a variable. That is, any of the result column database values may be inserted into the output by referencing a column name enclosed in a pair of "$" characters. For example, if you use this SQL statement:

    <!--SQL SELECT item_number, description FROM items -->
After this SQL statement is executed, the variable reference $item_number$ can be used to insert the first result for the column named "item_number" anywhere into the output, and variable $description$ would refer to the value of the column named "description" in the same result row. (See the
EACHROW command for formatting multiple result rows.)

ODBiC supports the keyword "AS" (upper or lowercase) which may be used to "rename" a result column. For example:

    <!--SQL SELECT item_nbr AS item, qty AS quantity FROM ... -->
After the above statement, the variables $item$ and $quantity$ would be used to reference the results instead of $item_nbr$ and $qty$. (Note that this feature is supported within ODBiC, so you may use AS even if your ODBC driver does not support it.) This feature is most useful (perhaps necessary) when an SQL calculated field is used, such as:
    <!--SQL SELECT (quantity * unit_price) AS total_price ... -->
In ODBiC, this column renaming is also useful when the TABLE command is used. That command uses the result column names as the HTML table headers, and you may wish to make the table headers less cryptic than the column names used in the database. Using the AS modifier for the SQL SELECT column names, you can specify the table headers that will be displayed in the HTML output. Renaming columns might also be useful or necessary to avoid conflict with other variables of the same name.

One non-obvious caution about column names used in SQL statements: Some databases (such as MS Access) allow spaces in column names. (This is why ODBiC allows spaces in variable names, even though this author discourages the practice.) Remember to enclose such column names inside double-quote marks (") when you use them in SQL statements. (ODBiC-generated SQL statements, such as the QBE query and UPDATEFORM, will also have double-quotes around any column names that contain spaces.)

Variables can be used anywhere within SQL statements. The most common usage would be as column values, such as in the WHERE clause of a SELECT statement or the SET clause of an UPDATE statement. (Remember, however, to enclose variable references inside apostrophes for any character-data values, such as "... WHERE name = '$name$' ...".) But you might also use a variable for a table name or column name. In fact, the entire SQL statement can be referenced as a variable, and that variable may also contain variable references. This is useful when you want to pass SQL statements in from forms.

For example, ODBiC can be used without an HTML template file. To do so, it is necessary to pass in a CGI variable named "sql" containing an SQL statement to execute. If there is no template file, ODBiC automatically executes the equivalent of a command: <!--SQL $sql$ -->. However, in a template file, you can specify any variable for the SQL command, such as <!--SQL $user_statement$ -->.

After each SQL statement, ODBiC sets several internally maintained variables that you may access. One of these is $row$, which is set to 0 if there are no rows returned by the SQL statement, or is set to 1 if at least one result row has been "fetched". Therefore, you can test the $row$ variable after a SELECT to see if any results were returned. For example:

    <!--SQL SELECT item, description FROM items -->
    <!--IF $row$ = 0 -->
      $sql_error$
    <!--ELSE-->
      . . . (format results, e.g., with an <!--EACHROW--> command)
    <!--ENDIF-->
The $sql_error$ variable used in this example is another ODBiC-defined variable which is set for each SQL statement. After a SELECT, $sql_error$ may say "No rows selected" if the statement was valid but no data met the selection criteria. If the ODBC driver has any problem executing the SQL statement, then variable $sql_error$ will contain the error message returned by the driver (e.g. the connection failed, the SQL syntax is incorrect, etc.) The IF statement above would cause the $sql_error$ message to be output whenever there were no rows returned, whatever the reason, and the lines following the ELSE would be used to format any normal result rows.

Another ODBiC variable set after an SQL statement is $rows_affected$, but it takes on a meaningful value only for UPDATE, INSERT, and DELETE statements. Again, for these statements, $sql_error$ is set if there is an error, but $sql_error$ is also set to "### rows affected" for successful statements, where the ### will be equal to $rows_affected$. (This means that, unless you want to do some special error handling, you might always just print out $sql_error$ after an UPDATE, INSERT, or DELETE statement, without testing $rows_affected$ for being 0. Remember that for UPDATE and DELETE, $rows_affected$ might be 0 even if the statement was valid, because no rows met the WHERE clause criteria.)

There is a status variable that can be used to determine directly the success of the SQL operation, but its interpretation depends on the type of statement. The variable is $sql_status$, and its possible values are:

For example, immediately after a SELECT, a "0" status will mean that at least one row has been selected, whereas a "-2" means that there were no rows that met the WHERE clause selection criteria. However, after any of the result-looping commands (TABLE, EACHROW, UPDATEFORM, and OPTIONLIST), the status will always be "-2". A status of "1" is the normal return for a successful INSERT, UPDATE, or DELETE, and a "-2" status would indicate that no rows met the WHERE clause selection criteria. A "-1" status always means that there was some error encountered by the ODBC driver in executing the SQL statement.

The SQL statement, which must be terminated with the "-->" marker, can span multiple lines up to a maximum size of 4K bytes (which is about 50 full 80-character lines).

<!--TABLE [html_table_opts] -->

The TABLE command automatically formats all columns and all rows from the previous query into an HTML table. (This formatting uses the HTML <TABLE>, <TR>, and <TD> commands. The database column names (or the "AS" renamed columns; see the example in the SQL command) are used as the column headers. (The table headers are formatted with HTML <TH> commands.) For improved appearance and readability, ODBiC capitalizes the first letter of the column headers, converts any underscore characters to spaces, and capitalizes any letter following an underscore. Thus, the database column "customer_name" would have a table header of "Customer Name".

The html_table_opts specifications are the same as the HTML <TABLE> optional elements. That is, whatever you put for html_table_opts will simply be included in the generated HTML <TABLE> command. For most HTML 2.0 browsers, these options can include BORDER, CELLSPACING, and CELLPADDING. Some browsers allow the BGCOLOR command.

Since the TABLE command always loops through all of the result rows, you should not use TABLE combined with any of the other result looping commands, EACHROW, UPDATEFORM, and OPTIONLIST.

<!--TRANSLATE variable value=newvalue [, value=newvalue, ...] -->

The TRANSLATE command allows you substitute one variable value with another, such as translating "code" values into meaningful text. Whenever the referenced variable is used in the HTML input file, the TRANSLATE table of values will be scanned to determine if the current value of the variable has a "newvalue" specified. If so, the "newvalue" will be inserted into the output.

Note that the TRANSLATE command does not cause variable substitution at the point that it is executed; it defines a substitution table that will be used anytime the variable is referenced for output. Therefore, the TRANSLATE command can be used anywhere in the template file before the variable is output. (Specifically, the TRANSLATE command should not, and cannot, be used inside an EACHROW loop specification. Specify the TRANSLATE table before the EACHROW.)

You don't necessarily need to define a translation for all possible values of a variable. If there is a translation table for a particular variable but a given value is not found to have a translation, then the original value will be used. One handy use for a partial translation table is to define a translation "newvalue" just for zero values, such as 0=none or even 0="" (empty string).

Each TRANSLATE command defines the translations for a single variable, and all translation values for that variable must be in the same TRANSLATE command. Statements can span multiple lines. The "-->" marker must be used to terminate the list of translation values in each statement.

Double-quotes around values (e.g., value="newvalue" or "value"="newvalue") are not required unless either value contains a comma (which separates pairs in the statement), but you may use them if you like. If you don't use the double-quote marks around a value text string, no leading or trailing spaces for the value will be included. (For example, if the command were "TRANSLATE var 1 = value one , 2 = value 2 , ...", the actual text values used would be "1"="value one" and "2"="value 2".)

You may define up to 32 different translation tables (i.e., tables for 32 different variables), and each table may have up to 100 translation value pairs. You may also redefine a translation table for a variable that was previously used in the template file. (The translation is in effect from the point of the TRANSLATE command until another TRANSLATE is given for the same variable.) And you may define a translation "newvalue" that is another variable (for example, "<!--TRANSLATE var1 value1=$var2$, ... -->").

<!--UPDATEFORM [FILE=html_template,] TABLE=database_table, KEY=key_field, [...,] numeric_field[:size] | 'text_field[:size]', ... -->

The UPDATEFORM command automatically writes an HTML form back to the user's browser. The generated HTML <FORM ACTION=...> specification contains a URL back to the ODBiC CGI program. The form includes HTML <INPUT> fields for all specified variables (see below). These field will contain their current values (usually, values previously selected from the database) so that the user can modify the current data. An SQL UPDATE statement will also be generated as a "hidden" form field. When the form is submitted, this statement will be used to apply the user's changes to the database.

If given, the optional "FILE=..." specification will be included on the form as a "hidden" field to tell ODBiC what HTML template file to use when the form is submitted. (However, a template file is not necessarily required; see "Using ODBiC Without a Template File .) The form also includes a "hidden" HTML field to specify the database connection to use for the update; this will be the same as the database in effect when the UPDATEFORM command is used. (If necessary, use a DATABASE command immediately before the UPDATEFORM command, but if you have just selected data from a database, then that same database will be used for the update form.) If you do use the "FILE" keyword to define an HTML template file to process the UPDATE statement, then that template will need to reference two of the predefined variables: The database string will be passed in with the name "database" and the generated SQL UPDATE statement will be passed in as "sql". Therefore, the update can be performed with these statements:

    <!--DATABASE $database$ -->
    <!--SQL $sql$ -->
(Anytime that you do not specify a template file, ODBiC will expect the variables "database" and "sql" to be passed in, and it will effectively execute the above code. This is why you do not necessarily need to have a template file to execute the UPDATEFORM output.)

The "TABLE=..." specification for this command is required. It specifies the database table that the generated SQL statement will update. One or more "KEY=..." specifications are also required. They will be included on the generated form, but they will be shown simply as text, not as modifiable fields. They will also be used in the WHERE clause of the generated SQL (i.e., "UPDATE database_table SET ... WHERE key_field=(current value), ..."). NOTE: You should specify KEY fields that will uniquely identify the record; otherwise all rows that satisfy the WHERE clause will be updated!

Following the KEY field or fields, one or more modifiable data fields may be specified. These are included on the form with their current values filled in, and the value may be changed by the user. The field names given in the UPDATEFORM list will be used as the HTML names for the generated <INPUT> fields, and they must be the same as the database column names (see below). Moreover, they should be currently-defined variable names in ODBiC, or they will not have any "current value" on the update form. Each of these fields will be included as SET column specifications in the generated SQL statement. The complete SQL statement would therefore be: "UPDATE database_table SET field=$field$, ... WHERE key_field=(current value), ...". When the user has made changes to any fields and submits the form, ODBiC will insert the new values from the update form into this SQL statement and then execute it. (This is the reason that the database column name, the ODBiC variable name, and form variable name must all be the same for any given field.)

NOTE: There are several considerations for specifying the key fields and update fields that are unique for this command:

You can control the size of each update <INPUT> field by using the optional ":size" specification after the field name in the UPDATEFORM list. If no size is specified, ODBiC uses a default size of 50 for text fields and 12 for numeric fields. If you give a field size larger than 99, then ODBiC automatically uses an HTML <TEXTAREA> input, which is a multiple-line scrolling window. This window will be at most 64 characters wide and as many lines as it takes to hold your specified field size. (For example, a specified size of 250 would produce a 50-character, 5-line textarea window.) However, you can directly specify the size of a <TEXTAREA> by giving the "size" specification as two numbers separated by an "x" (for example, 'Description:64x4'), where the two numbers are to be the number of columns and the number of rows. (The numbers can be given in either order; the larger number will always be used as the field width and the smaller number will be the number of lines.)

NOTE: If you use an UPDATEFORM command after a SELECT statement that returns several result rows, you will automatically get a separate update form for each result row. Each of these forms will have its own SQL UPDATE statement and "submit" button, but the user will only be able to update one row at a time. (The user could, however, use the browser "Back" button to go back and update another row.)

Since the UPDATEFORM command always loops through all of the result rows, you should not use UPDATEFORM combined with any of the other result looping commands, EACHROW, TABLE, and OPTIONLIST.

Example:

    <!--UPDATEFORM FILE=/htmlroot/your_dir/upd_empl.html, TABLE=Employees, 
       KEY=EmployeeID, 'LastName:20', 'FirstName:10', 'Title:30', 'BirthDate:9',
       'HireDate:9', 'Address:60', 'City:15', 'Region:15', ReportsTo:8 -->
The "FILE=" specifies the template file for ODBiC to use when the form is submitted. The "TABLE=" declares that the database table to be updated is "Employees". The "KEY=" specifies that "EmployeeID" is the record unique key field, which is a numeric field. (The KEY fields may not be updated on the form.) All of the following fields can be updated. Except for "ReportsTo", all of these fields are character data rather than numeric (as indicated by enclosing the column names in apostrophes). The update form INPUT field width for each is shown after the semi-colon.


String Functions

The following string functions can be used anywhere that you can use a variable: in the output text; in HTML commands; and in ODBiC commands and expressions.

All string function names begin with a $ sign. Like variables, the names are not case-sensitive. Each function has one or more "arguments" enclosed within a set of parentheses. You can put spaces between the function name and the left "(" of the arguments if you like.

Each of the arguments to these functions are evaluated like SET expressions, so you can use any arithmetic or logic expressions as arguments. For each of these string functions, the result of evaluating the first argument will be treated as a character string, even if it is an arithmetic expression. Like SET and IF expressions, character strings do not need to be enclosed in quotes unless you need to prevent inadvertent interpretation (e.g, if the string contains math operation symbols or commas), but you may use quotes if you like. (Note, however, that variable references within quotes will not have their values substituted.) Character strings may consist of several "concatenated" quoted or unquoted strings or variables in a row, such as ("Variable one is" $var1$ "and variable two is" $var2$), which will be treated as a single string argument.

The math functions len ( ), pos ( ), and char ( ) are designed to be used with the string functions to get the length of a string, find the position of a substring within a string, or to find the first occurrence of any one of a set of characters within a string, respectively. The functions isNumber ( ), isAlpha ( ), and isAlphaNum ( ) are intended to be used in IF statements to test string contents for being all numeric digits, all alphabetic characters, or all alphanumeric characters, respectively.

$asc (number)

The $asc( ) function produces a single character, which is the ASCII character for the given number (or expression). This function may be used to insert special characters into the output.

$eval (expression)

The $eval( ) function produces the result of evaluating the given string as an arithmetic or logic or expression. The primary use for this function is to insert a calculated result into the output without having to SET a variable to that result. For example, you might use $eval($Quantity$ * $Price$) as a table entry to compute a result using the values in other columns of the same row.

$format (mask, expression)

This function will format the given expression or character string using the specified "mask". See the FORMAT command for details on using masks. The distinction between the FORMAT command and the $format( ) string function is that the FORMAT command is used before referencing a variable to define a mask that will be applied each time the variable is referenced. The $format( ) string function, on the other hand, formats and outputs the result directly at the point where the function is used. Also, the "expression" to be formatted may be a computed result, so this function may be used to insert a formatted calculation into the output, such as $format("$#,###,##0,00", $Quantity$ * $Price$).

$hex (string)

The $hex( ) string function converts the given string to hexadecimal characters, two per input character.

$left (string, count)

This function produces the leftmost "count" characters of the given string. For example, $left(ABCDEFG, 4) produces "ABCD" in the output. If "count" is less than or equal to zero, the result will be a null string. If "count" is greater than the length of the string, the result will be the full input string.

$mid (string, start [,count])

The $mid( ) string function extracts a substring from anywhere within the given string. "Start" is the first character position to begin the extraction (counting the first character as 1). If only the "start" argument is given, then all character following the "start" position are included in the result. For example, $mid(ABCDEFG, 3) produces "CDEFG" in the output. If the "count" argument is given, then it specifies the number of characters to extract. For example, $mid(ABCDEFG, 3, 4) produces "CDEF" in the output. If "start" is less than or equal to zero or is greater than the length of the string, or if "count" is less than or equal to zero, the result will be a null string. If "start" plus "count" is greater than the length of the string, the result will be the full input string following the "start" position.

$right (string, count)

This function produces the rightmost "count" characters of the given string. For example, $right(ABCDEFG, 4) produces "DEFG" in the output. If "count" is less than or equal to zero, the result will be a null string. If "count" is greater than the length of the string, the result will be the full input string.

$url (string)

The $url( ) function encodes the given string in "URL format". This format codes spaces as "+" signs and special characters as "%xx" where "xx" is the hexadecimal number of the ASCII character. This function allows passing variables to a CGI program as the "query string" in a URL link. The "query string" is anything following a "?" (question mark) in the URL. CGI variables may be included in the query string by "name=value" pairs, with multiple variables separated by the "&" (ampersand) character. For example:
<A HREF="http://your.com/scripts/odbic.exe/template.htm?category=$url($category$)&uid=$url($uid$)">
The CGI program will get these named variables just like <INPUT> variables in a <FORM>.


Math Functions

Following are the mathematical functions that you may use in
SET or IF statement arithmetic expressions, on in string function arguments.

abs (number)

Returns the absolute value (positive number) of the given number.

char (string, characters)

Returns the character position in "string" (counting the first character as 1) of the first occurrence of any one of the characters in the "characters" argument. Returns 0 if there are no such characters in the string.

cos (angle)

Returns the trigonometric cosine of the given angle (measured in radians; radians = (degrees/180) * 3.1416).

exp (number)

Returns the exponential value of the given number (i.e., e raised to the power of the input number).

isAlpha (string)

Returns 1 (or "true") if all of the characters in the given string are either alphabetic characters or spaces. Returns 0 (or "false") if there are any non-alphabetic characters in the string. (Function names are not case sensitive, but the capitalization shown is easier to read.)

isAlphaNum (string)

Returns 1 (or "true") if all of the characters in the given string are either alphabetic characters or digits. Returns 0 (or "false") if there are any non-alphanumeric characters in the string. (Function names are not case sensitive, but the capitalization shown is easier to read.)

isNumber (string)

Returns "1" (or "true") if all of the characters in the given string are either digit characters 0 through 9 or a decimal point ".", or (for the first character only) a plus or minus sign. Returns 0 (or "false") if there are any non-numeric characters in the string. (Function names are not case sensitive, but the capitalization shown is easier to read.)

len (string)

Returns the number of characters in the given string value.

log (number)

Returns the "natural" (base-e) logarithm of the given number.

log10 (number)

Returns the base-10 logarithm of the given number.

max (number1, number2)

Returns the larger value of number1 or number2.

min (number1, number2)

Returns the smaller value of number1 or number2.

mod (number, mod)

Returns the modulus of the given number (remainder after division by the given "mod" value).

pos (string1, string2)

Returns the character position in string1 (counting the first character as 1) of the first occurrence of string2. Returns 0 if string2 is not contained within string1.

rand (mod)

Returns a pseudo-random number. Random numbers are in the range of 0 to 65535. The "mod" parameter is optional; if given, the random number will be divided by this number and the remainder will be returned. Therefore, to get a random number in the range of 0 to 9999, use rand(10000). (To get a random number in the range of 1 to 10000, use rand(10000)+1). You can get random number larger than 65535 by multiplying rand( ) * rand( ) or by using the rand( ) function multiple times in a string function, such as $right("000000000"rand( )rand( )rand( ), 12) to produce a 12-digit zero-filled random number.

sin (angle)

Returns the trigonometric sine of the given angle (measured in radians; radians = (degrees/180) * 3.1416).

tan (angle)

Returns the trigonometric tangent of the given angle (measured in radians; radians = (degrees/180) * 3.1416).


Running ODBiC as a CGI Program

To run ODBiC as a CGI program, the executable file (odbic.exe) must be installed on a "CGI directory". CGI directories are defined in your Web server's configuration file. CGI directories are generally created as subdirectories of the primary HTML directory (that is, the same root directory as your Web pages), and they are commonly named something like "scripts", "cgi", or perhaps "cgi-bin". If you already have such a directory defined, then simply copy odbic.exe there. If you do not already have such a directory, you will need to check your Web server's documentation for configuration details.

With a properly defined CGI directory, your Web server will automatically recognize CGI programs when this directory is specified in a URL. Like the URL for a Web page, a CGI URL should omit the primary HTML directory. For example, if you have a Web page named "pagex.html" and your primary HTML directory is defined in your server's configuration file to be "httpfile", then the directory path to the file would be "\httpfile\pages.html". However, the URL would be something like "http://www.yourdomain.com/pagex.html" because your server expects that all HTML files will be on the "httpfile" directory. Similarly, if your CGI directory is "\httpfile\scripts" and ODBiC has been installed there, then the URL would be "http://www.yourdomain.com/scripts/odbic.exe".

Note that some Web servers will allow you to omit the file extension (in this case, ".exe") for CGI programs. Refer to your server's documentation for details.

There are two ways that CGI programs may be referenced from an HTML document. Perhaps the most common is as the ACTION function of a FORM declaration, such as:

    <FORM METHOD="post" ACTION="http://www.yourdomain.com/scripts/odbic.exe">
(Note that ODBiC will also work with METHOD="get", but the "get" method has limitations on the number of bytes of data that may be passed to the program.)

All of the INPUT fields in the FORM declaration will be passed in to ODBiC as named variables; see the ODBiC Variables section.

The second method of invoking a CGI program from an HTML document is as an ordinary URL in an "anchor" link (that is, the HTML "A" command). In this case, HTML allows variables to be included in the link by placing a question mark (?) immediately at the end of the URL and adding a "variable=value" specification. Additional "variable=value" pairs may be added to this by separating them with an ampersand (&) character. (Note, however, that certain "special" characters are not allowed in URLs and must be represented by codes. Spaces are not allowed, and the convention is to use the plus sign (+) as the code for a space. Other special characters are encoding by using a percent sign (%) followed by the two-digit ASCII hex code for the character.) In ODBiC, variables that are passed in with the URL are decoded for special characters, but after that they are treated the same as FORM INPUT variables.

If you are creating an anchor link in ODBiC template file, then you can use the $url ( ) string function to encode a variable so that it may be passed in a URL.


Running ODBiC from the Command Prompt

You can run ODBiC from the DOS command line prompt and write the output to an HTML file on disk. If you do not need "real time" access to your database (for example, if the data does not change often), then using this method will avoid CGI and database overhead for every page access. Or, if your Web pages are on your Internet Service Provider's host machine and you cannot install CGI programs and databases on that host, then you can generate your pages from a database on your PC and upload the generated HTML. Also, you can use the Windows NT Schedule server (which you will find in the Servers window) to run ODBiC on at regular timed intervals.

To use this mode, the odbic.exe program file can be on any directory. Run ODBiC as you would any DOS program -- from the MS-DOS prompt or from the Windows "Run..." box. Following the program name (odbic) in the run command, you must specify an input file (the template) with a "-i" prefix and an output file (the generated HTML) with a "-o" prefix. (The file name may be placed immediately after the "-i" or "-o", with no spaces, or you may place a space between "-i" or "-o" and the filename.) Unless these files are on the current working directory, you will also need to specify directory paths for ODBiC and the files, such as:

    \httpfile\scripts\odbic -i \httpfile\template.html -o \httpfile\pagex.html 
You can also pass variables into ODBiC on the command line. Following the input and output file specifications, you can specify any necessary "variable=value" pairs. For example, if the SQL statement in the template file is something like, "SELECT * FROM items WHERE category = $cat$", then you can say "cat=widgets" in the ODBiC run command to give the $cat$ variable a value. Important Note: If there are any spaces in either the variable name or the value, then you must enclose the entire "variable=value" specification inside of double-quote marks, such as "name=Joe Smith". (Otherwise, DOS will not interpret the variable declaration as a single argument.) If neither the variable nor its value contain any spaces, you can omit the double-quotes. If you need to specify several "variable=value" pairs, separate them from each other in the run command by spaces.

If an output file is specified, then the file will be created if it does not already exist; otherwise, the existing file will be over-written. If your input template contains an OUTPUT command, then that command will override any output file specified with the -o option. If no output file is specified when ODBiC is run from the command prompt (either with the "-o" option or an OUTPUT command in your template), then the output will be written to your screen.


Predefined Variables

Following is a list of predefined variables in ODBiC. The first table lists variables that are set by ODBiC and may be used like any other variable. The second table lists variables that may be input to ODBiC to cause special processing. (For example, see the section
Using ODBiC Without a Template File.)

Variables Set by ODBiC

rowCurrent result row number after a SELECT statement
rows_affectedNumber of rows affected by an INSERT, UPDATE or DELETE SQL statement
sql_statusThe status of the SQL operation (interpretation depends on operation): -2 = no rows selected/affected; -1 = SQL execution error; 0 = SELECT or DDL succeeded; 1 = one or more rows affected by INSERT, UPDATE, or DELETE.
sql_statementThe last executed SQL statement, with all variables expanded
sql_errorError message returned by ODBC driver after SQL execution (or may say "No rows selected" after a valid SELECT, or "### rows affected" after a valid INSERT, UPDATE or DELETE)
todayCurrent date in the format "Month DD, YYYY", where "Month" is the full name of the current month, "DD" is the one- or two-digit day of the month, and "YYYY" is the four-digit year
date_shortCurrent date in the format MM-DD-YYYY, where "MM" is the number of the current month, "DD" is the number of the day, and "YYYY" is the four-digit year
date_ymdCurrent date in the format YYYYMMDD, where "YYYY" is the four-digit year, "MM" is the number of the current month, and "DD" is the number of the day
yearCurrent year, four digits
monthCurrent month, one or two digits
dayDay number in current month, one or two digits
monthnameFull name of current month (e.g., "September")
weekdayFull name of current day of week (e.g., "Monday")
timeCurrent 12-hour clock time in the format HH:MMam or HH:MMpm, where "HH" is the hour and "MM" is the minute
time24Current 24-hour clock time in the format HH:MM, where "HH" is the hour and "MM" is the minute
path_infoAny "extra path" directory information after the "odbic.exe" in the URL that invoked ODBiC. This should be the template file. (Example: if the URL was "http://www.yourdomain.com/scripts/odbic.exe/your_dir/template1.html" then "path_info" contains "/templates/template1.html" and the input template file is expected to be "template1.html" on subdirectory "templates".) If the invoking URL does not specify this "path_info", then a variable named "input" must be passed in to ODBiC to name the template file
path_translatedIf any directory information is provided after the odbic.exe URL (i.e., any "path_info"), then this is the full file system directory path after it has been "mapped" by the Web server
script_nameThe path to the odbic.exe CGI program (e.g., "/scripts/odbic.exe") from the invoking URL. (Useful for creating forms in the template file that will invoke ODBiC, rather than "hard-coding" the URL.)
http_refererThe URL of the document that was used to invoke ODBiC
server_nameInternet node name of the host system (i.e., the system that ODBiC is running on)
remote_hostHost that the user is running on (may be node name, but commonly is numeric Internet address)
remote_addrInternet numeric address (nnn.nnn.nnn.nnn) that the user is running on

Optional Variables Input to ODBiC

inputTemplate file to process
outputOutput file to write (i.e., output is sent to this file instead of back to the user's browser)
databaseODBC connection string (may be used instead of DATABASE command; required when no template file)
sqlSQL statement to execute (required when no template file)
eachrowFormatting to use for each result row (optional when no template file)
sql_titleText to use in the HTML TITLE command (optional when no template file)
sql_headerText to be output before executing the "sql" statement (optional when no template file)
sql_footerText to output following the "sql" statement execution and "eachrow" result formatting (optional when no template file)
defaultSpecifies variable default values (like the DEFAULT command) in the format "variable=value [, variable=value, ...]"
translateSpecifies a translation table for a variable (like the TRANSLATE command) in the format "variable_name value=newvalue [, value=newvalue, ...]"
formatSpecifies variable formatting masks (like the FORMAT command) in the format "variable=mask [, variable=mask, ...]"
path_infoAny "extra path" data following "odbic.exe" in the URL used to invoke ODBiC (normally set by CGI interface but provided as an input in case your server does not set properly). This should be the template file
path_translatedFull file system directory path after "path_info" has been "mapped" by your Web server (normally set by CGI interface but provided as an input in case your server does not set properly)
script_nameCGI path program name, (e.g., "/scripts/odbic.exe") (normally set by CGI interface but provided as an input in case your server does not set properly)


Using ODBiC Without a Template File

You can get ODBiC to execute an SQL statement and do some simple formatting without a template file. To do this, you will need to specify some required input variables, and you may optionally use some others. (Refer to the section Predefined Variables, in the "Optional Variables Input" table.)

The minimum required variables are "database" (which defines the ODBC connection) and "sql" (which defines an SQL statement to execute). If you use only these variables, then ODBiC will execute the SQL and format the results using some defaults. The default formatting will include a page "header" that shows the variable-expanded SQL statement that was executed. If the SQL statement is a SELECT, then all the results will be displayed using a default TABLE command. For INSERT, UPDATE, and DELETE statements, the number of rows affected will be displayed. If there was an SQL execution error, then the ODBC error message will be displayed.

You may optionally define the variable "sql_title" and it will be used as the Web page title (that is, in an HTML TITLE command, to be shown at the top of the browser window).

You may optionally define the variable "sql_header" and it will be inserted into the output before executing the SQL command. (Like all variables, $sql_header$ may include other variable references, such as $sql_statement$, $sql_title$, or other input variables from the form.)

You may optionally define the variable "eachrow" which will be used like the text in an EACHROW command to format each of the result rows from a SELECT statement. (For security reasons, you may not use the EXEC command in the "eachrow" variable.)

You may optionally define the variable "sql_footer" which will be inserted into the output following the SQL execution and the result formatting.

You may also define any of the other variables shown in the "Optional Variables Input" table.


Registering ODBiC

As you will notice, your unregistered copy of ODBiC will insert a small "ODBiC" link at the bottom of generated pages. This is a reminder to register your software. When you register, you may elect to have the registered version of the software e-mailed to you or to receive a URL and instructions for downloading the registered software with your Web browser.

There are two versions of the license available: The Individual License is $39 and it allows you to run one copy of ODBiC on one computer. The Corporate License is $79 and it allows you to run as many copies of ODBiC as you need on computers owned by the same company or organization.

Registration entitles you to recieve free upgrades for six months, and to purchase upgraded versions at a reduced rate after that ($15 for Individual, $20 for Corporate). For any version, "bug fix" releases are always free.

You may register online and pay by credit card using a secure server. With this server, your ordering information and credit card number are encrypted during transit through the Internet. Visa, Master Card, and American Express cards are accepted. You may link to the online ordering form from the ODBiC Home Page, or you may go directly to the ordering form at this link.

If you prefer, you my register by mail with a US bank check or money order. There is a text file in the download Zip file named "register.txt". Please print out that form, fill in the information, and mail it along with your registration fee to the address shown on the form. Thank you!


Copyright ©1997-1998, Roger Harris. All rights reserved.