NCSA
emerge@ncsa.uiuc.edu

Using the Gazelle Client

Gazelle comes with a small client application which you can use to test your service by issuing a simple query and retrieving a record. In the src directory, type
% ./zclient
You should see the following:
usage: zclient [-hparfb] db_name term
options:
  -h host        z3950 host [localhost]
  -p port        z3950 port [2210]
  -a attribute   attribute to search on [1=21]
  -r rec #       which record to retrieve [none]
  -f             retrieve a full record
  -b             retrieve a brief record [default]
Now, assuming you've built gazelle and have started it, you can try a query:
% ./zclient -a 1=1 mydb supernova

Connecting to localhost:2210 ...
Searching db named mydb for supernova (1=1) ...
Found 36 records.
Here, we've searched our locally-running copy of gazelle for the term "supernova" against Z39.50 attribute type 1, value 1, in a database called "mydb". If we want to retrieve a record, we can use the -r option combined with the -f or -b option, to specify which record to retrieve and whether we want a brief or full record. Here we retrieve the first record as a brief record:
% ./zclient -a 1=1 -r 1 -b mydb supernova

Connecting to localhost:2210 ...
Searching db named mydb for supernova (1=1) ...
Found 36 records.
Retrieving record #1 ...
Supernovas For Fun and Profit
For full records, which can be long and can be in non-text formats, we can redirect the output of zclient into a file:
% ./zclient -a 1=1 -r 1 -f mydb supernova > myrec.xml

Connecting to localhost:2210 ...
Searching db named mydb for supernova (1=1) ...
Found 36 records.
Retrieving record #1 ...
Supernovas For Fun and Profit

% cat myrec.xml

<?xml version='1.0'>
<record>
    <title>Supernovas For Fun and Profit</title>
    <control>387hn33-39ah</control>
    <cover src="cv8378.tiff"/>
    ... etc ...
</record>