User Commands YAZ-CLIENT(1) NAME yaz-client - Z39.50/SRU client for implementors SYNOPSIS yaz-client [-a _a_p_d_u_l_o_g] [-b _b_e_r_d_u_m_p] [-c _c_c_l_f_i_l_e] [-d _d_u_m_p] [-f _c_m_d_f_i_l_e] [-k _s_i_z_e] [-m _m_a_r_c_l_o_g] [-p _p_r_o_x_y-_a_d_d_r] [-q _c_q_l_f_i_l_e] [-t _d_i_s_p_c_h_a_r_s_e_t] [-u _a_u_t_h] [-v _l_o_g_l_e_v_e_l] [-V] [-x] [server-addr] DESCRIPTION yaz-client is a Z39.50/SRU client (origin) with a simple command line interface that allows you to test behavior and performance of Z39.50 targets and SRU servers. If the _s_e_r_v_e_r-_a_d_d_r is specified, the client creates a connection to the Z39.50/SRU target at the address given. When yaz-client is started it tries to read commands from one of the following files: +o Command file if it is given by option -f. +o ._y_a_z_c_l_i_e_n_t_r_c in current working directory. +o ._y_a_z_c_l_i_e_n_t_r_c in the user's home directory. The value of the HOME is used to determine the home directory. Normally, HOME is only set on POSIX systems such as Linux, FreeBSD, Solaris. OPTIONS -a _f_i_l_e_n_a_m_e If specified, logging of protocol packages will be appended file given. If _f_i_l_e_n_a_m_e is specified as -, the output is written to stdout. -b _f_i_l_e_n_a_m_e If specified, YAZ will dump BER data in readable notation to the file specified. If _f_i_l_e_n_a_m_e is specified as - the output is written to stdout. -c _f_i_l_e_n_a_m_e If specified, CCL configuration will be read from the file given. -d _d_u_m_p If specified, YAZ will dump BER data for all PDUs sent and received to individual files, named _d_u_m_p.DDD.raw, where DDD is 001, 002, 003, .. -f _c_m_d_f_i_l_e Reads commands from _c_m_d_f_i_l_e. When this option is used, YAZ 3.0.46 Last change: 06/08/2009 1 User Commands YAZ-CLIENT(1) YAZ client does not read .yazclientrc from current directory or home directory. -k _s_i_z_e Sets preferred messages and maximum record size for Initialize Request in kilobytes. Default value is 1024 (1 MB). -m _f_i_l_e_n_a_m_e If specified, retrieved records will be appended to the file given. -p _p_r_o_x_y-_a_d_d_r If specified, the client will use the proxy at the address given. 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. -q _f_i_l_e_n_a_m_e If specified, CQL configuration will be read from the file given. -t _d_i_s_p_l_a_y_c_h_a_r_s_e_t If displaycharset is given, it specifies name of the character set of the output (on the terminal on which YAZ client is running). -u _a_u_t_h If specified, the _a_u_t_h string will be used for authentication. -v _l_e_v_e_l Sets the LOG level to _l_e_v_e_l. 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. -V Prints YAZ version. -x Makes the YAZ client print hex dumps of packages sent and received on standard output. COMMANDS The YAZ client accepts the following commands. open _z_u_r_l Opens a connection to a server. The syntax for _z_u_r_l is the same as described above for connecting from the command line. YAZ 3.0.46 Last change: 06/08/2009 2 User Commands YAZ-CLIENT(1) Syntax: [(tcp|ssl|unix|http)':']_h_o_s_t [:_p_o_r_t][/_b_a_s_e] quit Quits YAZ client find _q_u_e_r_y Sends a Search Request using the _q_u_e_r_y given. By default the query is assumed to be PQF. See command querytype for more information. delete _s_e_t_n_a_m_e Deletes result set with name _s_e_t_n_a_m_e on the server. base _b_a_s_e_1 _b_a_s_e_2 ... Sets the name(s) of the database(s) to search. One or more databases may be specified separated by blanks. This commands overrides the database given in _z_u_r_l. show [_s_t_a_r_t[+_n_u_m_b_e_r]] Fetches records by sending a Present Request from the start position given by _s_t_a_r_t a number of records given by _n_u_m_b_e_r. If _s_t_a_r_t is not given, then the client will fetch from position of the last retrieved record plus 1. If _n_u_m_b_e_r is not given, then one record will be fetched at a time. scan _t_e_r_m Scans database index for a term. The syntax resembles the syntax for find. If you want to scan for the word water you could write scan water but if you want to scan only in, say the title field, you would write scan @attr 1=4 water setscan _s_e_t _t_e_r_m Scans database index for a term within a result set. This is similar to the scan command but has a result set as its first argument. scanpos _p_o_s Sets preferred position for scan. This value is used in next scan. By default position is 1. scansize _s_i_z_e Sets number of entries to be returned by scan. Default YAZ 3.0.46 Last change: 06/08/2009 3 User Commands YAZ-CLIENT(1) number of entries is 20. scanstep _s_t_e_p Set step-size for scan. This value is used in next scan sent to the target. By default step-size is 0. sort _s_o_r_t_s_p_e_c_s Sorts a result set. The sort command takes a sequence of space-separated sort specifications, with each sort specification consisting of two space-separated words (so that the whole specification list is made up of an even number of words). The first word of each specification holds a field (sort criterion) and the second holds flags. If the sort criterion includes = it is assumed that the SortKey is of type sortAttributes using Bib-1: in this case the integer before = is the attribute type and the integer following = is the attribute value. If no = is in the criterion it is treated as a sortfield of type InternationalString. The flags word of each sort specification must consist of s for case sensitive or i for case insensitive, and < for ascending order or > for descending order. sort+ Same as sort but stores the sorted result set in a new result set. authentication _o_p_e_n_a_u_t_h Sets up a authentication string if a server requires authentication (v2 OpenStyle). The authentication string is first sent to the server when the open command is issued and the Z39.50 Initialize Request is sent, so this command must be used before open in order to be effective. A common convention for the _a_u_t_h_o_p_e_n string is that the username - and password is separated by a slash, e.g. myusername/mysecret. sru _m_e_t_h_o_d _v_e_r_s_i_o_n Selects SRU method and version. Must be one of POST, GET, SOAP (default). Version should be either 1.1 or 1.2. Other versions are allowed - for testing purposes (version negotiation with SRU server). list_all This command displays status and values for many settings. lslb _n Sets the limit for when no records should be returned together with the search result. See the _Z_3_9._5_0 _s_t_a_n_d_a_r_d [1] for more details. YAZ 3.0.46 Last change: 06/08/2009 4 User Commands YAZ-CLIENT(1) ssub _n Sets the limit for when all records should be returned with the search result. See the _Z_3_9._5_0 _s_t_a_n_d_a_r_d [1] for more details. mspn _n Sets the number of records should be returned if the number of records in the result set is between the values of lslb and ssub. See the _Z_3_9._5_0 _s_t_a_n_d_a_r_d [1] for more details. status Displays the values of lslb, ssub and mspn. setname Switches named result sets on and off. Default is on. cancel Sends a Trigger Resource Control Request to the target. format _o_i_d Sets the preferred transfer syntax for retrieved records. yaz-client supports all the record syntaxes that currently are registered. See _Z_3_9._5_0 _S_t_a_n_d_a_r_d [2] for more details. Commonly used records syntaxes include usmarc, sutrs, grs1 and xml. elements _e Sets the element set name for the records. Many targets support element sets are B (for brief) and F (for full). close Sends a Z39.50 Close APDU and closes connection with the peer querytype _t_y_p_e Sets the query type as used by command find. The following is supported: prefix for Prefix Query Notation (Type-1 Query); ccl for CCL search (Type-2 Query), cql for CQL (Type-104 search with CQL OID), ccl2rpn for CCL to RPN conversion (Type-1 Query). cql2rpn for CQL to RPN conversion (Type-1 Query). attributeset _s_e_t Sets attribute set OID for prefix queries (RPN, Type-1). refid _i_d Sets reference ID for Z39.50 Request(s). itemorder _t_y_p_e _n_o Sends an Item Order Request using the ILL External. _t_y_p_e is either 1 or 2 which corresponds to ILL-Profile 1 YAZ 3.0.46 Last change: 06/08/2009 5 User Commands YAZ-CLIENT(1) and 2 respectively. The _n_o is the Result Set position of the record to be ordered. update _a_c_t_i_o_n _r_e_c_i_d _d_o_c Sends Item Update Request. The _a_c_t_i_o_n argument must be the action type: one of insert, replace, delete and update. The second argument, _r_e_c_i_d, is the record identifier (any string). Third argument which is optional is the record document for the request. If doc is a quoted string (double quotes) the string content is used verbatim. If doc is not a quoted string, it is assumed to be a filename which is read, then sent as the docuemnt content. If doc is omitted, the last received record (as parf of present response or piggybacked search response) is used for the update. source _f_i_l_e_n_a_m_e Executes list of commands from file _f_i_l_e_n_a_m_e, just like source on most UNIX shells. A single dot (.) can be used as an alternative. ! _a_r_g_s Executes command _a_r_g_s in subshell using the system call. push_command _c_o_m_m_a_n_d The push_command takes another command as its argument. That command is then added to the history information (so you can retrieve it later). The command itself is not executed. This command only works if you have GNU readline/history enabled. set_apdufile _f_i_l_e_n_a_m_e Sets that APDU should be logged to file _f_i_l_e_n_a_m_e. Another way to achieve APDU log is by using command-line option -a. set_auto_reconnect _f_l_a_g Specifies whether YAZ client automatically reconnect if target closes connection (Z39.50 only). _f_l_a_g must be either on or off. set_auto_wait _f_l_a_g Specifies whether YAZ client should wait for response protocol packages after a request. By default YAZ client waits (on) for response packages immediately after a command (find, show) has been issued. If off is used, YAZ client does not attempt to receive packages automatically. These will have to be manually received when command wait_response is used. YAZ 3.0.46 Last change: 06/08/2009 6 User Commands YAZ-CLIENT(1) _f_l_a_g must be either on or off. set_marcdump _f_i_l_e_n_a_m_e Specifies that all retrieved records should be appended to file _f_i_l_e_n_a_m_e. This command does the thing as option -m. schema _s_c_h_e_m_a_i_d Specifies schema for retrieval. Schema may be specified as an OID for Z39.50. For SRU, schema is a simple string URI. charset _n_e_g_o_t_i_a_t_i_o_n_c_h_a_r_s_e_t [_d_i_s_p_l_a_y_c_h_a_r_s_e_t] [[_m_a_r_c_c_h_a_r_s_e_t]] Specifies character set (encoding) for Z39.50 negotiation / SRU encoding and/or character set for output (terminal). _n_e_g_o_t_i_a_t_i_o_n_c_h_a_r_s_e_t is the name of the character set to be negotiated by the server. The special name - for _n_e_g_o_t_i_a_t_i_o_n_c_h_a_r_s_e_t specifies _n_o character set to be negotiated. If _d_i_s_p_l_a_y_c_h_a_r_s_e_t is given, it specifies name of the character set of the output (on the terminal on which YAZ client is running). To disable conversion of characters to the output encoding, the special name - (dash) can be used. If the special name auto is given, YAZ client will convert strings to the encoding of the terminal as returned by nl_langinfo call. If _m_a_r_c_h_a_r_s_e_t is given, it specifies name of the character set of retrieved MARC records from server. See also marcharset command. Note Since character set negotation takes effect in the Z39.50 Initialize Request you should issue this command before command open is used. Note MARC records are not covered by Z39.50 character set negotiation, so that's why there is a separate character that must be known in order to do meaningful converson(s). negcharset _c_h_a_r_s_e_t Specifies character set for negotiation (Z39.50). The argument is the same as second argument for command charset. displaycharset _c_h_a_r_s_e_t Specifies character set for output (display). The argument is the same as second argument for command YAZ 3.0.46 Last change: 06/08/2009 7 User Commands YAZ-CLIENT(1) charset. marccharset _c_h_a_r_s_e_t Specifies character set for retrieved MARC records so that YAZ client can display them in a character suitable for your display. See charset command. If auto is given, YAZ will assume that MARC21/USMARC is using MARC8/UTF8 and ISO-8859-1 for all other MARC variants. The charset argument is the same as third argument for command charset. querycharset _c_h_a_r_s_e_t Specifies character set for query terms for Z39.50 RPN queries and Z39.50 Scan Requests (termListAndStartPoint). This is a pure client-side conversion which converts from displayCharset to queryCharset. set_cclfile _f_i_l_e_n_a_m_e Specifies that CCL fields should be read from file file _f_i_l_e_n_a_m_e. This command does the thing as option -c. set_cqlfile _f_i_l_e_n_a_m_e Specifies that CQL fields should be read from file file _f_i_l_e_n_a_m_e. This command does the thing as option -q. register_oid _n_a_m_e _c_l_a_s_s _O_I_D This command allows you to register your own object identifier - so that instead of entering a long dot-notation you can use a short name instead. The _n_a_m_e is your name for the OID, _c_l_a_s_s is the class, and _O_I_D is the raw OID in dot notation. Class is one appctx, absyn, attet, transyn, diagset, recsyn, resform, accform, extserv, userinfo, elemspec, varset, schema, tagset, general. If you're in doubt use the general class. register_tab _c_o_m_m_a_n_d _s_t_r_i_n_g This command registers a TAB completion string for the command given. sleep _s_e_c_o_n_d_s This command makes YAZ client sleep (be idle) for the number of seconds given. wait_response [ _n_u_m_b_e_r] This command makes YAZ client wait for a number of response packages from target. If _n_u_m_b_e_r is omitted, 1 is assumed. This command is rarely used and is only useful if command set_auto_wait is set to off. YAZ 3.0.46 Last change: 06/08/2009 8 User Commands YAZ-CLIENT(1) xmles _O_I_D _d_o_c Sends XML Extended Services request using the OID and doc given. zversion _v_e_r This command sets Z39.50 version for negotiation. Should be used before open. By default 3 (version 3) is used. options _o_p_1 _o_p_2.. This command sets Z39.50 options for negotiation. Should be used before open. The following options are supported: search, present, delSet, resourceReport, triggerResourceCtrl, resourceCtrl, accessCtrl, scan, sort, extendedServices, level_1Segmentation, level_2Segmentation, concurrentOperations, namedResultSets, encapsulation, resultCount, negotiationModel, duplicationDetection, queryType104, pQESCorrection, stringSchema. EXAMPLE 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 _a_n_d 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: YAZ 3.0.46 Last change: 06/08/2009 9 User Commands YAZ-CLIENT(1) f @attrset Bib-1 @and @attr GILS 1=2008 Washington @attr 1=21 weather FILES _y_a_z-<_v_e_r_s_i_o_n>/_c_l_i_e_n_t/_c_l_i_e_n_t._c $_H_O_M_E/._y_a_z_c_l_i_e_n_t_r_c $_H_O_M_E/._y_a_z_c_l_i_e_n_t._h_i_s_t_o_r_y SEE ALSO yaz(7) bib1-attr(7) NOTES 1. Z39.50 standard http://www.loc.gov/z3950/agency/markup/04.html#3.2.2.1.6 2. Z39.50 Standard http://www.loc.gov/z3950/agency/defns/oids.html#5 ATTRIBUTES See attributes(5) for descriptions of the following attributes: _______________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE| |_________________________________________|____________________________________|_ | Availability | SUNWlibyaz | |_________________________________________|____________________________________|_ | Interface Stability| Uncommitted | |_____________________|__________________| NOTES Source for YAZ is available on http://opensolaris.org. YAZ 3.0.46 Last change: 06/08/2009 10