1YAZ-CLIENT(1)                      Commands                      YAZ-CLIENT(1)
2
3
4

NAME

6       yaz-client - Z39.50/SRU client for implementors
7

SYNOPSIS

9       yaz-client [-a apdulog] [-b berdump] [-c cclfile] [-d dump]
10                  [-f cmdfile] [-k size] [-m marclog] [-p proxy-addr]
11                  [-q cqlfile] [-t dispcharset] [-u auth] [-v loglevel] [-V]
12                  [-x] [server-addr]
13

DESCRIPTION

15       yaz-client is a Z39.50[1]/SRU[2] client (origin) with a simple command
16       line interface that allows you to test behavior and performance of
17       Z39.50 targets and SRU servers.
18
19       From YAZ version 4.1.0 yaz-client may also operate as a Solr[3] Web
20       Service client.
21
22       If the server-addr is specified, the client creates a connection to the
23       Z39.50/SRU target at the address given.
24
25       When yaz-client is started it tries to read commands from one of the
26       following files:
27
28       •   Command file if it is given by option -f.
29
30       •   .yazclientrc in current working directory.
31
32       •   .yazclientrc in the user's home directory. The value of the $HOME
33           environment variable is used to determine the home directory.
34           Normally, $HOME is only set on POSIX systems such as Linux,
35           FreeBSD, Solaris.
36
37

OPTIONS

39       -a filename
40           If specified, logging of protocol packages will be appended to the
41           file given. If filename is specified as -, the output is written to
42           stdout.
43
44       -b filename
45           If specified, YAZ will dump BER data in readable notation to the
46           file specified. If filename is specified as - the output is written
47           to stdout.
48
49       -c filename
50           If specified, CCL configuration will be read from the file given.
51
52       -d dump
53           If specified, YAZ will dump BER data for all PDUs sent and received
54           to individual files, named dump.DDD.raw, where DDD is 001, 002,
55           003, ...
56
57       -f cmdfile
58           Reads commands from cmdfile. When this option is used, YAZ client
59           does not read .yazclientrc from current directory or home
60           directory.
61
62       -k size
63           Sets preferred messages and maximum record size for Initialize
64           Request in kilobytes. Default value is 65536 (64 MB).
65
66       -m filename
67           If specified, retrieved records will be appended to the file given.
68
69       -p proxy-addr
70           If specified, the client will use the proxy at the address given.
71           YAZ client will connect to a proxy on the address and port given.
72           The actual target will be specified as part of the InitRequest to
73           inform the proxy about the actual target.
74
75       -q filename
76           If specified, CQL configuration will be read from the file given.
77
78       -t displaycharset
79           If displaycharset is given, it specifies name of the character set
80           of the output (on the terminal on which YAZ client is running).
81
82       -u auth
83           If specified, the auth string will be used for authentication.
84
85       -v level
86           Sets the LOG level to level. Level is a sequence of tokens
87           separated by comma. Each token is a integer or a named LOG item -
88           one of fatal, debug, warn, log, malloc, all, none.
89
90       -V
91           Prints YAZ version.
92
93       -x
94           Makes the YAZ client print hex dumps of packages sent and received
95           on standard output.
96

COMMANDS

98       The YAZ client accepts the following commands.
99
100       open zurl
101           Opens a connection to a server. The syntax for zurl is the same as
102           described above for connecting from the command line.
103
104           Syntax:
105
106           [(tcp|ssl|unix|http)':']host [:port][/base]
107
108       quit
109           Quits YAZ client
110
111       find query
112           Sends a Search Request using the query given. By default the query
113           is assumed to be PQF. See command querytype for more information.
114
115       delete setname
116           Deletes result set with name setname on the server.
117
118       base base1 base2 ...
119           Sets the name(s) of the database(s) to search. One or more
120           databases may be specified, separated by blanks. This command
121           overrides the database given in zurl.
122
123       show [start[+number [+resultset]]]
124           Fetches records by sending a Present Request from the start
125           position given by start and a number of records given by number,
126           from the result set resultset. If start is not given, then the
127           client will fetch from the position of the last retrieved record
128           plus 1. If number is not given, then one record will be fetched at
129           a time. If resultset is not given, the most recently retrieved
130           result set is used.
131
132       scan term
133           Scans database index for a term. The syntax resembles the syntax
134           for find. If you want to scan for the word water you could write
135
136                     scan water
137
138
139           but if you want to scan only in, say the title field, you would
140           write
141
142                     scan @attr 1=4 water
143
144
145       setscan set term
146           Scans database index for a term within a result set. This is
147           similar to the scan command but has a result set as its first
148           argument.
149
150       scanpos pos
151           Sets preferred position for scan. This value is used in the next
152           scan. By default, position is 1.
153
154       scansize size
155           Sets number of entries to be returned by scan. Default number of
156           entries is 20.
157
158       scanstep step
159           Set step-size for scan. This value is used in the next scan sent to
160           the target. By default step-size is 0.
161
162       sort sortspecs
163           Sorts a result set. The sort command takes a sequence of
164           space-separated sort specifications, with each sort specification
165           consisting of two space-separated words (so that the whole
166           specification list is made up of an even number of words). The
167           first word of each specification holds a field (sort criterion) and
168           the second holds flags. If the sort criterion includes = it is
169           assumed that the SortKey is of type sortAttributes using Bib-1: in
170           this case the integer before = is the attribute type and the
171           integer following = is the attribute value. If no = character is in
172           the criterion, it is treated as a sortfield of type
173           InternationalString. The flags word of each sort specification must
174           consist of s for case sensitive or i for case insensitive, and <
175           for ascending order or > for descending order.
176
177           Example using sort criterion with attributes use=local-number and
178           structure=numeric and ascending flag: 1=12,4=109 <
179
180           Another example with "Title" sort field and descending flag: Title
181           >
182
183       sort+
184           Same as sort but stores the sorted result set in a new result set.
185
186       authentication openauth
187           Sets up an authentication string if a server requires
188           authentication (v2 OpenStyle). The authentication string is first
189           sent to the server when the open command is issued and the Z39.50
190           Initialize Request is sent, so this command must be used before
191           open in order to be effective. A common convention for the authopen
192           string is that the username - and password is separated by a slash,
193           e.g.  myusername/mysecret.
194
195       sru method version
196           Selects Web Service method and version. Must be one of post, get,
197           soap (default) or solr. Version should be either 1.1, 1.2 or 2.0
198           for SRU. Other versions are allowed - for testing purposes (version
199           negotiation with SRU server). The version is currently not used for
200           Solr Web Services
201
202       list_all
203           This command displays status and values for many settings.
204
205       lslb n
206           Sets the limit for when no records should be returned together with
207           the search result. See the Z39.50 standard on set bounds[4] for
208           more details.
209
210       ssub n
211           Sets the limit for when all records should be returned with the
212           search result. See the Z39.50 standard on set bounds[4] for more
213           details.
214
215       mspn n
216           Sets the number of records that should be returned if the number of
217           records in the result set is between the values of lslb and ssub.
218           See the Z39.50 standard on set bounds[4] for more details.
219
220       status
221           Displays the values of lslb, ssub and mspn.
222
223       setname
224           Switches named result sets on and off. Default is on.
225
226       cancel
227           Sends a Trigger Resource Control Request to the target.
228
229       facets spec
230           Specifies requested facets to be used in search. The notation is
231           specified in ???.
232
233       format oid
234           Sets the preferred transfer syntax for retrieved records.
235           yaz-client supports all the record syntaxes that currently are
236           registered. See Z39.50 Record Syntax Identifiers[5] for more
237           details. Commonly used records syntaxes include usmarc, sutrs and
238           xml.
239
240       elements e
241           Sets the element set name for the records. Many targets support
242           element sets B (for brief) and F (for full).
243
244       close
245           Sends a Z39.50 Close APDU and closes connection with the peer
246
247       querytype type
248           Sets the query type as used by command find. The following is
249           supported: prefix for Prefix Query Notation (Type-1 Query); ccl for
250           CCL search (Type-2 Query), cql for CQL (Type-104 search with CQL
251           OID), ccl2rpn for CCL to RPN conversion (Type-1 Query), cql2rpn for
252           CQL to RPN conversion (Type-1 Query).
253
254       attributeset set
255           Sets attribute set OID for prefix queries (RPN, Type-1).
256
257       refid id
258           Sets reference ID for Z39.50 Request(s).
259
260       itemorder type no
261           Sends an Item Order Request using the ILL External.  type is either
262           1 or 2 which corresponds to ILL-Profile 1 and 2 respectively. The
263           no is the Result Set position of the record to be ordered.
264
265       update action recid doc
266           Sends Item Update Request. The action argument must be the action
267           type: one of insert, replace, delete and update. The second
268           argument, recid, is the record identifier (any string). Third
269           argument which is optional is the record document for the request.
270           If doc is preceded with "<", then the following characters are
271           treated as a filename with the records to be updated. Otherwise doc
272           is treated as a document itself. The doc may also be quoted in
273           double quotes. If doc is omitted, the last received record (as part
274           of present response or piggybacked search response) is used for the
275           update.
276
277       source filename
278           Executes list of commands from file filename, just like 'source' on
279           most UNIX shells. A single dot (.) can be used as an alternative.
280
281       ! args
282           Executes command args in subshell using the system call.
283
284       push_command command
285           The push_command takes another command as its argument. That
286           command is then added to the history information (so you can
287           retrieve it later). The command itself is not executed. This
288           command only works if you have GNU readline/history enabled.
289
290       set_apdufile filename
291           Sets that APDU should be logged to file filename. Another way to
292           achieve APDU log is by using command-line option -a.
293
294       set_auto_reconnect flag
295           Specifies whether YAZ client automatically reconnects if the target
296           closes connection (Z39.50 only).
297
298           flag must be either on or off.
299
300       set_auto_wait flag
301           Specifies whether YAZ client should wait for response protocol
302           packages after a request. By default YAZ client waits (on) for
303           response packages immediately after a command (find, show) has been
304           issued. If off is used, YAZ client does not attempt to receive
305           packages automatically. These will have to be manually received
306           when command wait_response is used.
307
308           flag must be either on or off.
309
310       set_marcdump filename
311           Specifies that all retrieved records should be appended to file
312           filename. This command does the same thing as option -m.
313
314       schema schemaid
315           Specifies schema for retrieval. Schema may be specified as an OID
316           for Z39.50. For SRU, schema is a simple string URI.
317
318       charset negotiationcharset [displaycharset] [[marccharset]]
319           Specifies character set (encoding) for Z39.50 negotiation / SRU
320           encoding and/or character set for output (terminal).
321
322           negotiationcharset is the name of the character set to be
323           negotiated by the server. The special name - for negotiationcharset
324           specifies no character set to be negotiated.
325
326           If displaycharset is given, it specifies name of the character set
327           of the output (on the terminal on which YAZ client is running). To
328           disable conversion of characters to the output encoding, the
329           special name - (dash) can be used. If the special name auto is
330           given, YAZ client will convert strings to the encoding of the
331           terminal as returned by nl_langinfo call.
332
333           If marccharset is given, it specifies name of the character set of
334           retrieved MARC records from server. See also marccharset command.
335
336               Note
337               Since character set negotiation takes effect in the Z39.50
338               Initialize Request you should issue this command before command
339               open is used.
340
341               Note
342               MARC records are not covered by Z39.50 character set
343               negotiation, so that's why there is a separate character that
344               must be known in order to do meaningful conversion(s).
345
346       negcharset charset
347           Specifies character set for negotiation (Z39.50). The argument is
348           the same as second argument for command charset.
349
350       displaycharset charset
351           Specifies character set for output (display). The argument is the
352           same as second argument for command charset.
353
354       marccharset charset
355           Specifies character set for retrieved MARC records so that YAZ
356           client can display them in a character suitable for your display.
357           See charset command. If auto is given, YAZ will assume that
358           MARC21/USMARC is using MARC8/UTF8 and ISO-8859-1 for all other MARC
359           variants. The charset argument is the same as third argument for
360           command charset.
361
362       querycharset charset
363           Specifies character set for query terms for Z39.50 RPN queries and
364           Z39.50 Scan Requests (termListAndStartPoint). This is a pure
365           client-side conversion which converts from displayCharset to
366           queryCharset.
367
368       set_cclfile filename
369           Specifies that CCL fields should be read from file file filename.
370           This command does the same thing as option -c.
371
372       set_cqlfile filename
373           Specifies that CQL fields should be read from file file filename.
374           This command does the same thing as option -q.
375
376       register_oid name class OID
377           This command allows you to register your own object identifier - so
378           that instead of entering a long dot-notation you can use a short
379           name instead. The name is your name for the OID, class is the
380           class, and OID is the raw OID in dot notation. Class is one of:
381           appctx, absyn, attet, transyn, diagset, recsyn, resform, accform,
382           extserv, userinfo, elemspec, varset, schema, tagset, general. If
383           you're in doubt use the general class.
384
385       register_tab command string
386           This command registers a TAB completion string for the command
387           given.
388
389       sleep seconds
390           This command makes YAZ client sleep (be idle) for the number of
391           seconds given.
392
393       wait_response [ number]
394           This command makes YAZ client wait for a number of response
395           packages from target. If number is omitted, 1 is assumed.
396
397           This command is rarely used and is only useful if command
398           set_auto_wait is set to off.
399
400       xmles OID doc
401           Sends XML Extended Services request using the OID and doc given.
402
403       zversion ver
404           This command sets Z39.50 version for negotiation. Should be used
405           before open. By default 3 (version 3) is used.
406
407       options op1 op2..
408           This command sets Z39.50 options for negotiation. Should be used
409           before open.
410
411           The following options are supported: search, present, delSet,
412           resourceReport, triggerResourceCtrl, resourceCtrl, accessCtrl,
413           scan, sort, extendedServices, level_1Segmentation,
414           level_2Segmentation, concurrentOperations, namedResultSets,
415           encapsulation, resultCount, negotiationModel, duplicationDetection,
416           queryType104, pQESCorrection, stringSchema.
417

EXAMPLE

419       The simplest example of a Prefix Query would be something like
420
421               f knuth
422
423
424       or
425
426               f "donald knuth"
427
428
429       In those queries, no attributes were specified. This leaves it up to
430       the server what fields to search but most servers will search in all
431       fields. Some servers do not support this feature though, and require
432       that some attributes are defined. To add one attribute you could do:
433
434               f @attr 1=4 computer
435
436
437       where we search in the title field, since the use(1) is title(4). If we
438       want to search in the author field and in the title field, and in the
439       title field using right truncation it could look something like this:
440
441               f @and @attr 1=1003 knuth @attr 1=4 @attr 5=1 computer
442
443
444       Finally using a mix of Bib-1 and GILS attributes could look something
445       like this:
446
447               f @attrset Bib-1 @and @attr GILS 1=2008 Washington @attr 1=21 weather
448
449
450

FILES

452       yaz-<version>/client/client.c
453
454       $HOME/.yazclientrc
455
456       $HOME/.yazclient.history
457

SEE ALSO

459       yaz(7) bib1-attr(7)
460

AUTHORS

462       Index Data
463

NOTES

465        1. Z39.50
466           https://www.loc.gov/z3950/agency/
467
468        2. SRU
469           https://www.loc.gov/standards/sru/
470
471        3. Solr
472           https://lucene.apache.org/solr/
473
474        4. Z39.50 standard on set bounds
475           http://www.loc.gov/z3950/agency/markup/04.html#3.2.2.1.6
476
477        5. Z39.50 Record Syntax Identifiers
478           http://www.loc.gov/z3950/agency/defns/oids.html#5
479
480
481
482YAZ 5.34.0                        01/12/2023                     YAZ-CLIENT(1)
Impressum