Towards IRTCL 1.4.2
[ir-tcl-moved-to-github.git] / doc / ir-tcl.sgml
index c4738e5..40ce2b4 100644 (file)
@@ -1,17 +1,17 @@
 <!doctype linuxdoc system>
 
 <!--
 <!doctype linuxdoc system>
 
 <!--
-  $Id: ir-tcl.sgml,v 1.21 1996-08-08 14:41:57 adam Exp $
+  $Id: ir-tcl.sgml,v 1.34 2004-04-26 09:09:06 adam Exp $
 -->
 
 <article>
 <title>IrTcl User's Guide and Reference 
 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">,
 -->
 
 <article>
 <title>IrTcl User's Guide and Reference 
 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">,
-<tt><htmlurl url="mailto:info@index.ping.dk" name="info@index.ping.dk"></tt>
-<date>$Revision: 1.21 $
+<tt><htmlurl url="mailto:info@indexdata.dk" name="info@indexdata.dk"></tt>
+<date>$Date: 2004-04-26 09:09:06 $
 <abstract>
 <abstract>
-This document describes IrTcl -- an information retrieval toolkit for
-Tcl and Tk that provides access to the Z39.50/SR protocol.
+IrTcl version 1.4.2 -- a Tcl extension that allows you to build
+Z39.50 clients.
 </abstract>
 
 <toc>
 </abstract>
 
 <toc>
@@ -20,51 +20,35 @@ Tcl and Tk that provides access to the Z39.50/SR protocol.
 
 <p>
 This document describes the <sf/IrTcl/ information retrieval toolkit,
 
 <p>
 This document describes the <sf/IrTcl/ information retrieval toolkit,
-which offers a high-level, client interface to the Z39.50 and SR protocols.
-The toolkit is based on the Tcl/Tk toolkit developed by Prof. John
+which offers a high-level interface for the development of Z39.50
+clients. The toolkit is based on the Tcl/Tk toolkit developed by Prof. John
 K. Ousterhout at the University of California &lsqb;ref 1&rsqb;. 
 K. Ousterhout at the University of California &lsqb;ref 1&rsqb;. 
-Tcl is a simple, somewhat shell-like, interpreted language. What
-makes Tcl attractive is that it also offers a C API, which makes
-extensions to the language possible. The most important Tcl extension is
-probably Tk -- A Motif look-and-feel interface to the X window
-system.
+The core of Tcl is rather small but it offers a flexible C API
+for easy development of Tcl extensions. The most important Tcl
+extension is probably Tk -- A portale GUI for X/WIN32/MAC.
 
 
-To interface the Z39.50/SR protocol <sf/IrTcl/ uses <bf/YAZ/.
-<bf/YAZ/ offers two transport types: RFC1729/BER on TCP/IP and the mOSI
-protocol stack.
-However, the mOSI transport is only an option, and hence it is not
-needed unless you wish to communicate within an OSI environment.
-See &lsqb;ref 2&rsqb; for more information about the XTI/mOSI implementation.
+To interface the Z39.50 protocol <sf/IrTcl/ uses the <bf/YAZ/ toolkit.
 
 
-<sf/IrTcl/ provides two system environments:
-
-<itemize>
-<item> A simple command line shell -- useful for
-testing purposes.
-<item> A simple command line shell which operates within the Tk
- environment -- makes it very easy to implement GUI clients.
-</itemize>
+<sf/IrTcl/ is usually build as a <it/dynamic/ library (WIN32)
+or a shared object (Unix) which is dynamically loaded by using the Tcl's
+<tt/load/ command. However, <sf/IrTcl/ can also be compiled as a
+traditional <it/static/ library.
 
 <sect>Compilation and installation
 
 <p>
 
 <sect>Compilation and installation
 
 <p>
-In order to compile you need:
+<sect1>UNIX
+<p>
+In order to compile the software on UNIX you need:
 <itemize>
 <item> An ANSI C compiler such as GNU C.
 <itemize>
 <item> An ANSI C compiler such as GNU C.
-<item> <htmlurl url="http://www.sunlabs.com/research/tcl/" name="Tcl">.
- Version 7.3, 7.4 and 7.5 has been tested.
-<item> <htmlurl url="http://www.indexdata.dk/yaz.html" name="YAZ">
- version 1.2 or higher.
-</itemize>
-
-As an option you may want:
-<itemize>
-<item> <htmlurl url="http://www.sunlabs.com/research/tcl/" name="Tk">.
-Version 3.6, 4.0 and 4.1 has been tested.
-<item> XTI/mOSI
+<item> <htmlurl url="http://www.scriptics.com" name="Tcl">.
+ Version 8.0 and 8.3 has been tested.
+<item> <htmlurl url="http://www.indexdata.dk/yaz/" name="YAZ">
+ version 1.6 or higher.
 </itemize>
 
 </itemize>
 
-Unpack the <sf/IrTcl/ package at the same directory level as <bf/YAZ/. 
+Unpack the <sf/IrTcl/ package at the same directory level as <bf/YAZ/.
 
 Type:
 <tscreen><verb>
 
 Type:
 <tscreen><verb>
@@ -74,22 +58,35 @@ $ ./configure
 This command tries to configure <sf/IrTcl/ for your system and creates
 a <tt>Makefile</tt>.
 
 This command tries to configure <sf/IrTcl/ for your system and creates
 a <tt>Makefile</tt>.
 
-If the <tt>configure</tt> command cannot locate Tcl and Tk in your standard
-locations for libraries searched by your C compiler it will guess 
-that the libraries are located in <tt>/usr/local/lib</tt> and that 
-the header files are located in <tt>/usr/local/include</tt>. 
-If this is incorrect you will have to modify the <tt>Makefile</tt> yourself.
+The <tt>configure</tt> script tries to locate the file <tt/tclConfig.sh/
+which should be generated by Tcl's installation script. Configure
+looks for ther Tcl shell on your system in order to locate this file.
+For example if <tt/tclsh/ is located in <tt>/home/joe/bin</tt>, configure will
+assume that <tt>tclConfig.sh</tt> is installed in <tt>/home/joe/lib</tt>, 
+in which case the prefix is <tt>/home/joe</tt>. If you have
+more than one Tcl version installed on your system, or if configure
+cannot find the <tt/tclConfig.sh/, you can specify in which directory
+it is, by supplying option <tt>--with-tclconfig</tt> - for example:
+<tscreen><verb>
+$ ./configure --with-tclconfig=/home/joe/lib
+</verb></tscreen>
+
+The <sf/IrTcl/ executables are installed in prefix/bin and libraries
+and support files are installed in prefix/irtcl.
 
 Compile <sf/IrTcl/ by typing:
 <tscreen><verb>
 $ make
 </verb></tscreen>
 
 
 Compile <sf/IrTcl/ by typing:
 <tscreen><verb>
 $ make
 </verb></tscreen>
 
-If you don't have Tk you will only be able to create the <tt>ir-tcl</tt>
-program and you must type <tt>make ir-tcl</tt> instead.
+For Tcl versions that support dynamic libraries the command above
+will create the shared library, <tt/irtcl.so/, as well as the
+normal static library, <tt/libirtcl.a/.
 
 
-If successful, this will make <tt>ir-tcl</tt>, <tt>ir-tk</tt> (if
-Tk is present) and a library called <tt>libirtcl.a</tt>.
+For Tcl versions that doesn't support dynamic libraries the
+make command will create two shells will build-in <sf/IrTcl/ support --
+a Tcl shell called <tt/ir-tcl/. The traditional static
+library, <tt/libirtcl.a/, is build as well.
 
 To install the programs and support files type:
 <tscreen><verb>
 
 To install the programs and support files type:
 <tscreen><verb>
@@ -104,77 +101,120 @@ $ make install.man
 Summary of files installed (the names refer to the Makefile variables):
 
 <descrip>
 Summary of files installed (the names refer to the Makefile variables):
 
 <descrip>
-<tag><tt>ir-tk</tt></tag> The <sf/IrTcl/ shell for Tk.
- Installed in <tt>BINDIR</tt> -- defaults to
- <tt>/usr/local/bin</tt>. <tt>ir-tk</tt> works like
- <tt>wish</tt> &mdash without arguments it reads commands from stdin.
- A source file may be specified by option <tt>-f</tt>. <tt>ir-tk</tt>
- accept the same set of options as <tt>wish</tt>.
-<tag><tt>ir-tcl</tt></tag> The <sf/IrTcl/ shell for Tcl. Installed in
- <tt>BINDIR</tt> -- defaults to <tt>/usr/local/bin</tt>.
-<tag><tt>client.tcl</tt></tag> A graphical client for <tt>ir-tk</tt>.
+<tag><tt>irtcl.so</tt></tag> The <sf/IrTcl/ shared dynamic library. 
+The actual name of this library vary. Installed in <tt>IRTCLDIR</tt>.
+This file is only generated when using newer versions of Tcl/Tk.
+
+<tag><tt>ir-tcl</tt></tag> The <sf/IrTcl/ shell for Tcl. This program
+ is not needed when using a Tcl that supports shared libraries. Installed
+ in <tt>BINDIR</tt> -- defaults to <tt>/usr/local/bin</tt>.
+
+<tag><tt>client.tcl</tt></tag> A graphical client for Tk.
  The client is installed as an executable script called <tt>irclient</tt> in
  <tt>BINDIR</tt>. This client needs a number of files, bitmaps, etc.
  The client looks for the files in the current directory &mdash if
  this fails it tries to look in the directory <tt>IRTCLDIR</tt>
  -- defaults to <tt>/usr/local/lib/irtcl</tt>.
  The client is installed as an executable script called <tt>irclient</tt> in
  <tt>BINDIR</tt>. This client needs a number of files, bitmaps, etc.
  The client looks for the files in the current directory &mdash if
  this fails it tries to look in the directory <tt>IRTCLDIR</tt>
  -- defaults to <tt>/usr/local/lib/irtcl</tt>.
+
 <tag><tt>libirtcl.a</tt></tag> The <sf/IrTcl/ library. 
  Installed in <tt>LIBDIR</tt> -- defaults to <tt>/usr/local/lib</tt>.
 <tag><tt>libirtcl.a</tt></tag> The <sf/IrTcl/ library. 
  Installed in <tt>LIBDIR</tt> -- defaults to <tt>/usr/local/lib</tt>.
+
 <tag><tt>ir-tcl.h</tt></tag> The <sf/IrTcl/ header file.
  Installed in <tt>INCDIR</tt> -- defaults to <tt>/usr/local/include</tt>.
 <tag><tt>ir-tcl.h</tt></tag> The <sf/IrTcl/ header file.
  Installed in <tt>INCDIR</tt> -- defaults to <tt>/usr/local/include</tt>.
-<tag><tt>clientrc.tcl</tt></tag> A setup file with definitions
+
+<tag><tt>irtdb.tcl</tt></tag> A setup file with definitions
  of target and queries. Read and updated by <tt>client.tcl</tt>. Installed
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
  of target and queries. Read and updated by <tt>client.tcl</tt>. Installed
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
+
 <tag><tt>formats/*</tt></tag> Display format files written
  in Tk. Read by <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
 <tag><tt>formats/*</tt></tag> Display format files written
  in Tk. Read by <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
+
 <tag><tt>bitmaps/*</tt></tag> Various bitmap files. Read by
  <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
 <tag><tt>bitmaps/*</tt></tag> Various bitmap files. Read by
  <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
+
 <tag><tt>LICENSE</tt></tag> LICENSE file. Read by
  <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
 </descrip>
 
 <tag><tt>LICENSE</tt></tag> LICENSE file. Read by
  <tt>client.tcl</tt>. Installed 
  in <tt>IRTCLDIR</tt> -- defaults to <tt>/usr/local/lib/irtcl</tt>.
 </descrip>
 
-<sect1>ir-tcl
+<p>
+<sf/IrTcl/ can be used either from the Tcl interpreter
+<tt/tclsh/ or the statically linked program <tt/ir-tcl/.
+Using <tt/tclsh/ is the preferred method. You must load
+the <sf/IrTcl/ library by using the <tt/load/ command.
 
 
+A static, non-dynamic, version goes like this:
+<tscreen><verb>
+   $ ir-tcl
+   % 
+</verb></tscreen>
+and the dynamic version (preferred) goes like:
+<tscreen><verb>
+   $ tclsh
+   % load ./irtcl.tcl
+   %
+</verb></tscreen>
+  
+<sect1>WIN32
 <p>
 <p>
-The <tt>ir-tcl</tt> program is a shell like <tt>tclsh</tt> except that
-<tt>ir-tcl</tt> features the new set of information retrieval commands. 
-Normally <tt>ir-tcl</tt> waits on <tt/stdin/ (for you to type commands) and
-on sockets events (connected to Z39.50/SR targets).
-You simply type the Tcl commands line by line. A filename may be specified as 
-argument to <tt>ir-tcl</tt> in which case the file specified is evaluated 
-as a script.
 
 
-<sect1>ir-tk
+<sf/IrTcl/ is shipped with a "makefile" for the NMAKE tool part of
+with Microsoft Visual C++.
+
+Start an MS-DOS prompt and switch the sub directory <tt>WIN</tt> where
+the file <tt>makefile</tt> is located. Customize the installation
+by editing the <tt>makefile</tt> file (for example by using wordpad).
+
+The following summarises the most important settings in that
+file.
+
+<descrip>
+<tag><tt>YAZDIR</tt></tag> Specifies where YAZ is located.
+<tag><tt>DEBUG</tt></tag> If set to 1, the software is
+compiled with debugging libraries. If set to 0, the software
+is compiled with release (non-debugging) libraries.
+</descrip>
+
+When satisfied with the settings in the makefile type
+<tscreen><verb>
+nmake
+</verb></tscreen>
+
+If compilation was successful the executables <tt>irtcl.dll</tt>
+is put in directory <tt>BIN</tt>. 
+
+To start the test client that comes with <sf/IrTcl/ make sure
+both <tt/YAZ.DLL/ and <tt/IRTCL.DLL/ are in current directory
+or in your PATH. Go to the top-level directory of <sf/IrTcl/
+and type "wish -f client.tcl". You might want to make a
+short-cut to start this.
+
+<sect1>Using Tk
 
 <p>
 
 <p>
-<tt>ir-tk</tt> is a program that works like <tt>wish</tt> except that
-<tt>ir-tk</tt> include the new set of commands. All options accepted
-by <tt>wish</tt> are also accepted by <tt>ir-tk</tt>. 
+If your Tcl/Tk supports dynamic libraries you can use the
+<tt/load/ command from within <tt/wish/ as described in the previous
+section.
 
 
-The enclosed script <tt>client.tcl</tt> for <tt>ir-tk</tt> is a graphical 
-client which demonstates an example of a user interface for the Z39.50/SR 
-protocols. 
+The enclosed script <tt>client.tcl</tt> is a graphical client
+which demonstates an example of a user interface for the Z39.50 protocol. 
 At first the script was relatively small but it has grown since the 
 beginning. At present it is about 3000 lines. 
 
 At first the script was relatively small but it has grown since the 
 beginning. At present it is about 3000 lines. 
 
-The client can be started directly from the top level directory 
-of <sf/IrTcl/ by typing:
+To start the client with dynamic library support use:
 <tscreen><verb>
 <tscreen><verb>
-$ ir-tk -f client.tcl
+$ wish -f client.tcl
 </verb></tscreen>
 
 </verb></tscreen>
 
-Or, if you have installed <sf/IrTcl/ you may also type:
-<tscreen><verb>
-$ irclient
-</verb></tscreen>
+Note: Substitute the real name for the wish interpreter above, for
+version 8.0 it is probably called <tt/wish8.0/.
 
 The client lets up define targets and query types within the interface.
 
 The client lets up define targets and query types within the interface.
-Hence, you will not need to modify configation files. 
+Hence, you will not need to modify configuration files. 
 
 
-Stuff concerning targets can be found in the pull down menu 'Target'
+Stuff regarding targets can be found in the pull down menu 'Target'
 with the following options:
 <descrip>
 <tag>Connect</tag> Establishes connection to a target.
 with the following options:
 <descrip>
 <tag>Connect</tag> Establishes connection to a target.
@@ -266,7 +306,7 @@ is called. Callback routines are represented in Tcl as
 a list, which is re-interpreted prior to invocation.
 The method is similar to the one used in Tk to capture X events.
 
 a list, which is re-interpreted prior to invocation.
 The method is similar to the one used in Tk to capture X events.
 
-For each SR/Z39.50 request there is a corresponding object action. The most
+For each Z39.50 request there is a corresponding object action. The most
 important actions are:
 <descrip>
 <tag/connect/ Establishes connection with a target
 important actions are:
 <descrip>
 <tag/connect/ Establishes connection with a target
@@ -365,9 +405,10 @@ immediately followed by a hostname. A number of settings affect the
 
 <descrip>
 <tag><tt>comstack </tt><tt>mosi|tcpip</tt></tag>
 
 <descrip>
 <tag><tt>comstack </tt><tt>mosi|tcpip</tt></tag>
- Comstack type.
+ Comstack type. Note that <tt/mosi/ is no longer supported by <bf/YAZ/.
 <tag><tt>protocol </tt><tt>Z39|SR</tt></tag>
 <tag><tt>protocol </tt><tt>Z39|SR</tt></tag>
- Protocol type - ANSI/NISO Z39.50 or ISO SR.
+ Protocol type - ANSI/NISO Z39.50 or ISO SR. Note, that SR
+ is no longer supported by <bf/YAZ/.
 <tag><tt>callback </tt><em>list</em></tag>
  Tcl script called when the connection is established.
 <tag><tt>failback </tt><em>list</em></tag>
 <tag><tt>callback </tt><em>list</em></tag>
  Tcl script called when the connection is established.
 <tag><tt>failback </tt><em>list</em></tag>
@@ -484,10 +525,10 @@ Each item in the list describes the target parameters with
 the following four components: association-name, comstack-type,
 protocol-type and a hostname.
 
 the following four components: association-name, comstack-type,
 protocol-type and a hostname.
 
-The list for the two targets: ISO/SR target DANBIB and TCP/Z39.50 
+The list for the two targets: Library of Congress and Z39.50 
 target Data Research, will be defined as:
 <tscreen><verb>
 target Data Research, will be defined as:
 <tscreen><verb>
-set targetList { {danbib mosi SR 0103/find2.denet.dk:4500}
+set targetList { {loc tcpip Z39 z3950.loc.gov:7090}
                  {drs tcpip Z39 dranet.dra.com} }
 </verb></tscreen>
 
                  {drs tcpip Z39 dranet.dra.com} }
 </verb></tscreen>
 
@@ -596,6 +637,9 @@ operators. They are:
  Proximity operation on op1 and op2. Not implemented yet.
 <tag><tt>@set </tt><em>name</em></tag>
  Result set reference
  Proximity operation on op1 and op2. Not implemented yet.
 <tag><tt>@set </tt><em>name</em></tag>
  Result set reference
+<tag><tt>@attrset </tt><em>set</em></tag>
+ Whole query uses the specified attribute <em>set</em>. If this operator is
+ used it must be defined at the beginning of the query.
 </descrip>
 
 It is simple to build RPN queries in <sf/IrTcl/. Search terms
 </descrip>
 
 It is simple to build RPN queries in <sf/IrTcl/. Search terms
@@ -627,6 +671,12 @@ term is right truncated:
    @attr 1=4 @and @attr 5=1 tech beta
 </verb></tscreen>
 
    @attr 1=4 @and @attr 5=1 tech beta
 </verb></tscreen>
 
+To search for the DatabaseInfo records from an Explain server, we 
+could use
+<tscreen><verb>
+   @attrset exp1 @attr 1=1 DatabaseInfo
+</verb></tscreen>
+
 <sect1>Search
 
 <p>
 <sect1>Search
 
 <p>
@@ -638,13 +688,13 @@ The settings that affect the search are listed below:
 <tag><tt>smallSetUpperBound </tt><em>integer</em></tag>
  Small set upper bound. Default 0.
 <tag><tt>largeSetLowerBound </tt><em>integer</em></tag>
 <tag><tt>smallSetUpperBound </tt><em>integer</em></tag>
  Small set upper bound. Default 0.
 <tag><tt>largeSetLowerBound </tt><em>integer</em></tag>
- Large set lower bound. Default 2.
+ Large set lower bound. Default 1.
 <tag><tt>mediumSetPresentNumber </tt><em>integer</em></tag>
  Medium set present number. Default 0.
 <tag><tt>replaceIndicator </tt><em>boolean</em></tag>
  Replace-indicator. Default true (1).
 <tag><tt>setName </tt><em>string</em></tag>
 <tag><tt>mediumSetPresentNumber </tt><em>integer</em></tag>
  Medium set present number. Default 0.
 <tag><tt>replaceIndicator </tt><em>boolean</em></tag>
  Replace-indicator. Default true (1).
 <tag><tt>setName </tt><em>string</em></tag>
- Name of result set.
+ Name of result set. Default name of set is <tt/default/.
 <tag><tt>queryType rpn|ccl</tt></tag>
  Query type-1 or query type-2. Default rpn (type-1).
 <tag><tt>preferredRecordSyntax </tt><em>string</em></tag>
 <tag><tt>queryType rpn|ccl</tt></tag>
  Query type-1 or query type-2. Default rpn (type-1).
 <tag><tt>preferredRecordSyntax </tt><em>string</em></tag>
@@ -1055,6 +1105,224 @@ record.
 In <sf/IrTcl/ a SUTRS record is treated as one single string. To retrieve
 a SUTRS record use the <tt>getSutrs</tt> followed by an index.
 
 In <sf/IrTcl/ a SUTRS record is treated as one single string. To retrieve
 a SUTRS record use the <tt>getSutrs</tt> followed by an index.
 
+<sect1>XML
+
+<p>
+In <sf/IrTcl/ an XML record is treated as one single string. To retrieve
+a XML record use the <tt>getXml</tt> followed by an index.
+
+<sect1>GRS-1
+<p>
+A GRS-1 record in <sf/IrTcl/ is represented as a list of elements. 
+Each element specifies a tag as well as data. The data may
+be a subtree, which is represented as a list, and so on.
+
+The method <tt/getGrs/ is followed by a record index and
+optional specifiers that selects a specific sub-tree. Each element
+consists of 5 elements:
+
+<descrip>
+<tag>tag-set</tag> Tag set number.
+
+<tag>value-type</tag> Type of tag value. May be either
+<tt/numeric/ of <tt/string/.
+
+<tag>value</tag> The value it self.
+
+<tag>data-type</tag> May be either <tt/octets/, <tt/numeric/,
+<tt/ext/, <tt/string/, <tt/bool/, <tt/intUnit/, <tt/empty/,
+<tt/notRequested/, <tt/diagnostic/ or <tt/subtree/.
+
+<tag>data</tag>The data associated with element of given type as
+ indicated before. If data-type is <tt/numeric/ or <tt/string/
+ then data is encoded as a single Tcl token. The data-type <tt/bool/
+ is encoded as 0 or 1 for false and  true respectively. If the
+ data-type is <tt/subtree/ the data is a sub-list.
+ In all other cases, the data is the empty string.
+</descrip>
+
+<bf/Example/
+
+Consider the GRS-1 record below as shown by the <bf/YAZ/ client program:
+
+<tscreen><verb>
+(1,1) OID: GILS-schema
+(1,14) 2
+(2,1)  UTAH EARTHQUAKE EPICENTERS
+    class=4,type=1,value=us
+(4,52) UTAH GEOLOGICAL AND MINERAL SURVEY
+(3,Local-Subject-Index) APPALACHIAN VALLEY; EARTHQUAKE; EPICENTER
+(2,6)
+    (1,19) Five files of epicenter data arranged by ...
+    (3,Format) DIGITAL DATA SETS
+    (3,Data-Category) TERRESTRIAL
+    (3,Comments) Data are supplied by the University of Utah ...
+(4,70)
+    (4,90)
+        (2,10) UTAH GEOLOGICAL AND MINERAL SURVEY
+        (4,2) 606 BLACK HAWK WAY
+        (4,3) SALT LAKE CITY
+        (3,State) UT
+        (3,Zip-Code) 84108
+        (2,16) USA
+        (2,14) (801) 581-6831
+    (4,7) UTAH EARTHQUAKE EPICENTERS
+(4,1) ESDD0006
+(1,16) 198903
+</verb></tscreen>
+
+The record may be fetched from the result set, <tt/z.1/, at position 1
+by using:
+<tscreen><verb>
+z.1 getGrs 1 
+</verb></tscreen>
+which will return:
+<tscreen><verb>
+{ 1 numeric 1 oid 1.2.840.10003.13.2 }
+{ 1 numeric 14 string 2 }
+{ 2 numeric 1 string
+   { UTAH EARTHQUAKE EPICENTERS} }
+{ 4 numeric 52 string {UTAH GEOLOGICAL AND MINERAL SURVEY} }
+{ 3 string Local-Subject-Index string
+   {APPALACHIAN VALLEY; EARTHQUAKE; EPICENTER} }
+{ 2 numeric 6 subtree
+   { { 1 numeric 19 string
+      {Five files of epicenter data arranged by ...} }
+   { 3 string Format string {DIGITAL DATA SETS} }
+   { 3 string Data-Category string TERRESTRIAL }
+   { 3 string Comments string  
+      {Data are supplied by the University of Utah ...} } } }
+{ 4 numeric 70 subtree
+   { { 4 numeric 90 subtree
+      { { 2 numeric 10 string
+         {UTAH GEOLOGICAL AND MINERAL SURVEY} }
+      { 4 numeric 2 string {606 BLACK HAWK WAY} }
+      { 4 numeric 3 string {SALT LAKE CITY} }
+      { 3 string State string UT }
+      { 3 string Zip-Code string 84108 }
+      { 2 numeric 16 string USA }
+      { 2 numeric 14 string {(801) 581-6831} } } }
+      { 4 numeric 7 string {UTAH EARTHQUAKE EPICENTERS} } } }
+{ 4 numeric 1 string ESDD0006 }
+{ 1 numeric 16 string 198903 } 
+</verb></tscreen>
+
+We can choose only to get the path (2,6) by using:
+
+<tscreen><verb>
+z.1 getGrs 1 (2,6)
+</verb></tscreen>
+and we'll get:
+<tscreen><verb>
+{ 2 numeric 6 subtree { { 1 numeric 19 string
+   {Five files of epicenter data arranged by ...} }
+   { 3 string Format string {DIGITAL DATA SETS} }
+   { 3 string Data-Category string TERRESTRIAL }
+   { 3 string Comments
+      string {Data are supplied by the University of Utah ...} } } }
+</verb></tscreen>
+
+To get the well known (1,19) within the subject (2,6) we use
+<tscreen><verb>
+z.1 getGrs 1 (2,6) (1,19)
+</verb></tscreen>
+and get:
+<tscreen><verb>
+{ 2 numeric 6 subtree
+   { { 1 numeric 19 string
+      {Five files of epicenter data arranged by ...} } } }
+</verb></tscreen>
+<bf/End of example/
+
+<sect1>Explain
+<p>
+Explain records are retrieved like other records. The method,
+<tt>getExplain</tt> is followed by an index and and an optional
+Explain record pattern.
+
+The returned record is a canonical representation of the Explain record.
+An ASN.1 sequence is represented as a list. Each item in the list
+consists of the name of the element, followed by its value if the value
+is supplied.
+
+The optional pattern that follows the index after <tt>getExplain</tt>
+consists of one or more elements, that is matched against the elements
+of the actual record.
+
+<bf/Example/
+
+One of the few targets that support explain is the ATT research server
+at <tt>z3950.research.att.com</tt>.
+
+The targetInfo record was returned by the target and it's stored in
+position 1 in the result set, <tt>z.1</tt>. To retrieve the whole
+record we must use
+<tscreen><verb>
+z.1 getExplain 1
+</verb></tscreen>
+
+and we get in return
+
+<tscreen><verb>
+{targetInfo commonInfo {name {Lucent Technologies Research Server}}
+recentNews icon {namedResultSets 1} {multipleDBsearch 0}
+{maxResultSets 100} {maxResultSize 600000} maxTerms timeoutInterval
+{welcomeMessage {strings { {language eng}
+{text
+{Salutations - this is Lucent Technologies experimental Z39.50 server.
+No guarentees, but free and unlimited access!}} } } }
+{contactInfo {name {Robert Waldstein}} {description {strings
+{ {language eng}
+{text {Librarian system designer - no legal anythings}} } } }
+{address {strings { {language eng} {text {Room 3D-591
+600 Mountain Ave
+Murray Hill
+N.J. USA 07974}} } } } {email wald@lucent.com} {phone {908 582-6171}} }
+description nicknames {usageRest {strings { {language eng}
+{text {None - as long as nonProfit research}} } } } paymentAddr
+{hours {strings { {language eng} {text {Should never be down}} } } }
+dbCombinations addresses commonAccessInfo } 
+</verb></tscreen>
+
+The <tt>targetInfo</tt> above indicates the the record is really a
+<tt>targetInfo</tt> record. The <tt>commonInfo</tt>, which is optional, is
+not supplied by this server. The <tt>name</tt>, however is supplied,
+with the value <tt>Lucent Technologies Research Server</tt>.
+
+To retrieve the <tt>contactInfo</tt> from the record above we can
+extract the element from the record by using Tcl's list manipulation
+facilities, for example by doing
+<tscreen><verb>
+set ti [z.1 getExplain 1]
+lindex [lindex $ti 0] 12 
+</verb></tscreen>
+which will return
+<tscreen><verb>
+contactInfo {name {Robert Waldstein}} {description {strings
+{ {language eng}
+{text {Librarian system designer - no legal anythings}} }
+} } {address {strings { {language eng} {text {Room 3D-591
+600 Mountain Ave
+Murray Hill
+N.J. USA 07974}} } } } {email wald@lucent.com} {phone {908 582-6171}}
+</verb></tscreen>
+
+We can also extract almost the same by doing
+<tscreen><verb>
+z.1 getExplain 1 targetInfo contactInfo
+</verb></tscreen>
+which will return
+<tscreen><verb>
+{name {Robert Waldstein}} {description {strings { {language eng}
+{text {Librarian system designer - no legal anythings}} } } }
+{address {strings { {language eng} {text {Room 3D-591
+600 Mountain Ave
+Murray Hill
+N.J. USA 07974}} } } } {email wald@lucent.com} {phone {908 582-6171}}
+</verb></tscreen>
+
+<bf/End of example/
+
 <sect>Scan
 
 <p>
 <sect>Scan
 
 <p>
@@ -1146,7 +1414,7 @@ been created.
 <sect>License
 
 <p>
 <sect>License
 
 <p>
-Copyright &copy; 1995-1996, Index Data.
+Copyright &copy; 1995-2004, Index Data ApS.
 
 Permission to use, copy, modify, distribute, and sell this software and
 its documentation, in whole or in part, for any purpose, is hereby granted,
 
 Permission to use, copy, modify, distribute, and sell this software and
 its documentation, in whole or in part, for any purpose, is hereby granted,
@@ -1187,18 +1455,17 @@ development of quality software for open network communication.
 We'll be happy to answer questions about the software, and about ourselves
 in general.
 
 We'll be happy to answer questions about the software, and about ourselves
 in general.
 
-<tscreen>
-Index Data&nl
-Ryesgade 3&nl
-2200 K&oslash;benhavn N&nl
-DENMARK
-</tscreen>
-
+<tscreen><verb>
+Index Data
+Kobmagergade 43
+1150 Copenhagen K
+Denmark
+</verb></tscreen>
 <p>
 <tscreen><verb>
 <p>
 <tscreen><verb>
-Phone: +45 3536 3672
-Fax  : +45 3536 0449
-Email: info@index.ping.dk
+Phone: +45 3341 0100
+Fax  : +45 3341 0101
+Email: info@indexdata.dk
 </verb></tscreen>
 
 <sect>References
 </verb></tscreen>
 
 <sect>References
@@ -1206,19 +1473,23 @@ Email: info@index.ping.dk
 <p>
 
 <descrip>
 <p>
 
 <descrip>
-<tag>1 Ousterhout, John K.:</tag>
+<tag>1 IrTcl Homepage</tag>
+<htmlurl url="http://www.indexdata.dk/irtcl/"
+name="http://www.indexdata.dk/irtcl/">
+
+<tag>2 Ousterhout, John K.:</tag>
 Tcl and the Tk Toolkit. Addison-Wesley Company Inc (ISBN
 0-201-63337-X). The Tcl/Tk toolkit home page is
 Tcl and the Tk Toolkit. Addison-Wesley Company Inc (ISBN
 0-201-63337-X). The Tcl/Tk toolkit home page is
-<tt><htmlurl url="http://www.sunlabs.com/research/tcl/"
- name="http://www.sunlabs.com/research/tcl"></tt>.
-The primary ftp site is <tt><htmlurl url="ftp://ftp.smli.com/pub/tcl/"
-name="ftp://ftp.smli.com/pub/tcl/"></tt>.
-A mirror site can be found at <tt>
-<htmlurl url="ftp://ftp.neosoft.com/pub/tcl/mirror/ftp.smli.com"
-name="ftp://ftp.neosoft.com/pub/tcl/mirror/ftp.smli.com"></tt>.
-<tag>2 Furniss, Peter:</tag>
-RFC 1698: Octet Sequences for Upper-Layer OSI to Support
-Basic Communications Applications.
+<htmlurl url="http://tcl.activestate.com"
+ name="http://tcl.activestate.com">.
+The primary download area is 
+<htmlurl url="http://prdownloads.sourceforge.net/tcl/"
+name="http://prdownloads.sourceforge.net/tcl/">.
+
+<tag>3 Welch, Brent B.:</tag>
+Practical Programming in Tcl and Tk. Prentice Hall
+(ISBN 0-13-616830-2).
+
 </descrip>
 
 </article>
 </descrip>
 
 </article>