Main -> Support Zone -> InSite Archives -> June Front Page -> Tips & Techs

InSite, June 1999
Tips & Techs  Pointers from Open SiteSearch Product Support Staff

Compliant zclient: Using zclient to test Z39.50 resources
John Trares, Product Support Specialist
Z39.50 is a standard protocol that allows a user to search databases, view records, and manipulate result sets.

In a perfectly standard world, each Z39.50 vendor would implement the client/server protocol in the same manner and would provide the necessary information for the configuration of Z39.50 clients. But because each vendor has implemented a different flavor of Z39.50 and has created unique databases, some Z39.50 compatibility testing is necessary.

Open SiteSearch 4.x provides a basic Z39.50 client, zclient, to aid in this testing process and is able to test client/server connections, verify searchable indexes, view records, and analyze Application Protocol Data Units (APDUs).

Reference
Checklist  

Core elements you'll need:
  • Server ip address or domain name (i.e., hostname)
  • Port number on server for Z39.50 communication
  • Database name

Additional helpful information:

  • Query type supported
  • Record syntaxes supported
  • Indexes available for searching and definitions of index behavior
    (i.e., Z39.50 Attributes: Use, Structure, Truncation)
  • Additional Z39.50 Facilities supported (i.e., Scan, Sort, etc.)
Most of the information you'll need is located in the <database>.ini and <server>.ini files. Printing these files for reference may be useful.

The <database>.ini file specifies the server where the database is located, the name assigned to the database, the syntax of the records and the use and structure of the searchable indexes.

The <server>.ini lists port, hostname, autho and password (if necessary), query type and whether it supports advanced searching features such as scan and sort.

Sample
 
port:
hostname:
autho:
password:
query type:
dbname:
index(01):
syntax:
Use data below to test zclient
 
210
tikal.dev.oclc.org
100118439
pxg2gxuge
101 wcat keyword; use=1016; structure=2 marc
   
Start a Session  

From the <WebZ_root>/scripts directory, start a zclient session using the syntax shown to the right.

Optional parameter - result set name

Servers that do not support Result set naming will return an error message: "Must use ResultSetName of 'default'". Subsequent searches will be processed correctly, though, because zclient automatically switches to naming results sets as default. However, you can avoid receiving this error message entirely but adding the -d parameter to the request.

Note that there are no spaces following each of the parameters, -h, -p, and -u. The autho and password, if required, should be separated by a forward slash.

Syntax

Command: zclient -h<hostname> -p<port> -u<autho/pwd>

NOTE: There are no spaces between the parameters (-h, -p , -u) and the values.

Example

Command: zclient -htikal.dev.oclc.org -p210 -u100118439/pxg2gxuge

Emphasis added to improve readability.

The communication or message sent by the client to the server is called the initRequest.

The server returns another communication or message called the initResponse.

The initialization is established once the client and server negotiate communication limits and features. The message at right will appear.

If the server does not support scanning or the display of available databases, it will include this information in the initResponse and display either/both messages shown at right.

Init message

Talking to port 210 of host dev.oclc.org
Done with Init request

Does not support scan message

This server indicates that it does NOT support the Scan Facility

Does not display available database message

I don't know if you have access to any dbs

   
Set parameters  

  Select a database to search. You'll need to know how the database is known to the server. Often this name is abbreviated, such as wcat for WorldCat.

Zclient will search on the database name entered, regardless of whether it is a valid name or not. Check typing for accuracy.

If known, also set the query type and record syntax before beginning a search.

Query types supported by zclient: 0, 1 and 101.

Record formats supported by zclient: MARC, SUTRS, BER, GRS_1 and OPAC.

Create a session log

You can create a log of your session by including the verbose parameter. Simply type 'verbose' at the prompt. This creates a ZCLIENT.LOG file in the scripts subdirectory. The log records all the interactions between zclient and the target server.

To read and interpret this file, refer to the ANS.1 specification outlined in chapter four "Protocol Specification" of the ANSI/NISO Z39.50-1995 manual.

Select database

Command: db wcat

Set query type

Command: query 101

Set record syntax

Command: syntax marc

NOTE: These commands cannot be combined on one line but must be entered separately.

   
Basic Searching  

  Search Facility

Constructing a simple keyword search is straightforward in zclient.

Type in the search term or phrase and specify its use and structure. The syntax is shown at right. The combination of use and structure define an index. Use corresponds to the field indexed (ie author, title, corporate name etc) and structure corresponds to how the field is indexed (keyword, phrase etc).

The database ini file lists the use and structure attributes for each index. OCLC SiteSearch includes database ini files for several OCLC FirstSearch databases and many vendor databases. To create a database ini file for a different database, we advise using an existing file as a template. To get the use and structure information for OCLC FirstSearch databases, refer to

FirstSearch Databases Available from OCLC's Z39.50 Server

Syntax

Command: <term | phrase>/u=<use attribute>;s=<structure attribute>

Simple Title Search (keyword)

Command: lifelong/u=4;s=2

Exact Title Search (phrase)

Command: "introduction to lifelong education"/u=4;s=1

NOTE: Phrase searches require double quotes

  Results

After a searchRequest has been correctly sent to the server, the server should response with a searchResponse. The postings count should appear.

Successful search

Command: lifelong/u=4;s=2
5 records found Search Successful! :-)
recordSyntax='null'
rspTime is 149 msecs

   
Displaying  

 

Records from this result set can now be viewed using the Retrieval Facility by sending a presentRequest to the server.

The Z39.50 server will respond with a presentResponse and the records will be displayed in the zclient session.

Display records

Command: d 1-2

2 records returned
Present successful
recordSyntax='1.2.840.10003.5.10'
DataDir: fldid(0) asn1class(1) form(1) length(0) count(10)
child: DataDir: fldid(0) asn1class(2) form(0) length(0) count(8)
data: 63 61 6d 20 20 20 20 20 cam
. . .
     
Boolean Searches  

  Boolean searches are constructed using Reverse Polish Notation (RPN) in zclient. In a simple boolean search, the first search term is listed (with its use and structure) followed by the second search term (with its use and structure). The boolean operator linking them is added at the end, as seen at right.

To expand on the basic search, add successive search terms followed by the associated boolean operator. Examples of more complicated searches are also shown.

Syntax

Command: <term1>/u=;s= <term2>/u=;s= <boolean operator>

Emphasis added to improve readability.

Examples

Command: education/u=1016;s=2 higher/u=1016;s=2 and

Command: education/u=1016;s=2 higher/u=1016;s=2 and computer/u=4;s=2 and

Command: education/u=1016;s=2 higher/u=1016;s=2 and computer/u=4;s=2 and college/u=21;s=2 not

The logic for the last example looks like this:

(((kw: education and kw: higher) and ti: computer) not sh: college)

   
Advanced Searches  

  Proximity

Proximity searches can be tested with zclient if the target server supports type 101 queries.

'Within' specifies order and relation. The first search term must appear first and within n terms of the second search term.

'Near' specifies only relation. The first search term must appear within n terms of the second search term in any order.

For OCLC FirstSearch databases, the maximum value for 'n' is 25.

Syntax

Command: <term1>/u=<>;s=<> <term2>/u=<>;s=<> within/<n>

Command: <term1>/u=<>;s=<> <term2>/u=<>;s=<> near/<n>

Examples

Command: history/u=4;s=2 physical/u=4;s=2 within/2
3 records found

Command: history/u=4;s=2 physical/u=4;s=2 within/3
23 records found

Command: history/u=4;s=2 physical/u=4;s=2 near/2
3 records found

Command: history/u=4;s=2 physical/u=4;s=2 near/3
24 records found

     
  Truncation

Zclient can be instructed to submit a Truncation Attribute of '1' for Right Truncation of a search term. If the Z39.50 server supports right truncation of search terms for the specified index, the server will locate all index terms beginning with the abbreviated search term.

Zclient does not use wildcards to indicate truncation. Rather, a -t parameter is added to the search string. The value of t for right truncation is '1'.

The examples compare regular searches with truncated searches.

Examples

Command: education/u=1016;s=2
2597 records found

Command: educat/u=1016;s=2;t=1
2887 records found

Command: "history of physical education"/u=4;s=1;t=1
1 records found

Command: "history of"/u=4;s=1;t=1
479 records found

     
  Browse Facility

The browse or scan feature can be tested with zclient if the target server supports this feature. As mentioned previously the server normally will indicate if it does not support scan at the start of a session.

The "number of terms requested" specifies the number of terms to display. The default value is 20.

The "position of search term in list" specifies where in the list to show the search term. The default value is 11.

Syntax

Command: scan -<number> -<position> <term | phrase>/u=<>;s=<>

Remember to add leading dashes with no spaces before the first two parameters, "number of terms requested" and "position of search terms in list."

Example

Command: scan -5 -3 "history of physical education"/u=4;s=1

'history of pharmacy in pictures reproductions of a series of original' 1
'history of philosophy' 1
'history of physical education and sport in the libyan arab republic' 1
'history of piatt county' 1
'history of pike county illinois' 1


[Main] [Documentation] [Support Services] [Technical Reference] [Glossary] [Search]