The YAZ client Introduction yaz-client is a line-mode Z39.50/SRU client. It supports a fair amount of the functionality of the Z39.50v3 standard. Its primary purpose is to exercise the package, and verify that the protocol works OK. For the same reason some commands offers more functionality than others. Commands that exercises common Z39.50 services such as search and present have more features than less common supported services, such as Extended Services (ItemOrder, ItemUpdate,..). Invoking the YAZ client It can be started by typing yaz-client -m fname -a fname -c fname -q fname -v level -p target -u auth -k size zurl in a UNIX shell / WIN32 console. The zurl, specifies a Z39.50/SRU host and, if specified, the client first tries to establish connection with the Z39.50/SRU target. Options are prefixed by - followed by a particular letter. The following options are supported: -m fname All retrieved transfer records are appended to file fname. All records as returned by a target(s) in Search Responses and Present Responses are appended verbatim to the file. -a fname Pretty-print log of APDUs sent and received is appended to the file fname. If fname is - (minus) the APDU log is written to stderr. -c fname Sets the filename for CCL fields to fname. If this option is not given the YAZ client reads CCL fields from file default.bib. -q fname Sets the filename for CQL fields to fname. If this option is not given the YAZ client reads CQL fields from file /usr/local/share/yaz/etc/pqf.properties. -v level Sets the LOG level to level. Level is a sequence of tokens separated by comma. Each token is a integer or a named LOG item - one of fatal, debug, warn, log, malloc, all, none. -p target Specifies proxy address. When set YAZ client will connect to a proxy on the address and port given. The actual target will be specified as part of the InitRequest to inform the proxy about actual target. -u auth Specifies authentication. Usually the form user/password is used. This option does the same thing as the auth command. -k size Specifies the maximum messages size in kilobytes. The default maximum message size for the YAZ client is 1024 (1 MB). In order to connect to Index Data's test Z39.50 server on bagel.indexdata.dk, port 210 and with the database name marc, one could type yaz-client bagel.indexdata.dk:210/marc The same server is also a SRU service. Connect to it via HTTP as follows: yaz-client http://bagel.indexdata.dk:210/marc In order to enable APDU log and connect to localhost, port 210 (default) and database Default (default) you'd write: yaz-client -a - localhost The following command connects to a local server via UNIX socket /tmp/yaz and sets maximum message size to 5 MB. yaz-client -k 5120 unix:/tmp/yaz Commands When the YAZ client has read options and connected to a target, if given, it will display Z> and await your command. Commands are executed by hitting the return key. You can always issue the command ? to see the list of available commands. The commands are (the letters in parenthesis are short names for the commands): &yaz-client-commands; Searching The simplest example of a Prefix Query would be something like f knuth or f "donald knuth" In those queries no attributes was specified. This leaves it up to the server what fields to search but most servers will search in all fields. Some servers does not support this feature though, and require that some attributes are defined. To add one attribute you could do: f @attr 1=4 computer where we search in the title field, since the use(1) is title(4). If we want to search in the author field and in the title field, and in the title field using right truncation it could look something like this: f @and @attr 1=1003 knuth @attr 1=4 @attr 5=1 computer Finally using a mix of Bib-1 and GILS attributes could look something like this: f @attrset Bib-1 @and @attr GILS 1=2008 Washington @attr 1=21 weather For the full specification of the Prefix Query see the section Prefix Query Format.