Koha How-To

Koha's New Z39.50 Responder - Item Statuses

Koha has had the ability to provide a public Z39.50 service since the adoption of Zebra, and this continued to work with the addition of Elasticsearch. As we begin to consider a future when ES may be the only search engine used for a site, the community was interested in providing a solution that works with either search engine, or indeed with possible future search engines.

Now, if you are one of those people who aren't excited to talk about the in depth differences between the mechanics of how the Z39 engine translates requests to the backend of Koha, you're in luck. The Z39 engine shouldn't change anything in the way records are searched or returned, butt for those using Z39 to integrate with outside services the new responder provides an exciting new feature: item status/availability.

Previously, the only way to determine availability was to check a combination of the subfields that contained:
lost status
damaged status
withdrawn status
onloan status
notforloan status

Additionally, there were statuses that could not be seen in the records:

  • on hold
  • in transit

Here is a sample listing of items with multiple statuses with no availability info

952 $0 0 $1 0 $2 ddc $4 0 $6 _ $7 0 $9 1 $a CPL $b CPL $c GEN $d 2014-05-07 $p 3999900000001 $r 2014-05-07 $w 2014-05-07 $y BK

952 $0 1 $1 1 $2 ddc $4 1 $7 0 $9 983 $a CPL $b CPL $d 2020-10-16 $o 782.42166092 B $p 3999800000002 $r 2020-10-16 $w 2020-10-16 $y BK

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $9 984 $a CPL $b CPL $d 2020-10-16 $l 0 $o 782.42166092 B $p 3999800000003 $r 2020-10-16 $w 2020-10-16 $y BK

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $9 985 $a CPL $b CPL $d 2020-10-16 $l 1 $o 782.42166092 B $p 3999800000004 $q 2020-10-21 $r 2020-10-16 $s 2020-10-16 $w 2020-10-16 $y BK

With the new responder you have two options:

--add-item-status=s :

This allows you to choose a single subfield in the record (default is k) which will list all of the items statuses, or show available, for example:

952 $0 0 $1 0 $2 ddc $4 0 $6 _ $7 0 $a CPL $b CPL $c GEN $d 2014-05-07 $p 3999900000001 $r 2014-05-07 $w 2014-05-07 $y BK $k Available

952 $0 1 $1 1 $2 ddc $4 1 $7 0 $a CPL $b CPL $d 2020-10-16 $o 782.42166092 B $p 3999800000002 $r 2020-10-16 $w 2020-10-16 $y BK $k Lost, Damaged, Withdrawn

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $a CPL $b CPL $d 2020-10-16 $l 0 $o 782.42166092 B $p 3999800000003 $r 2020-10-16 $w 2020-10-16 $y BK $k On Hold

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $a CPL $b CPL $d 2020-10-16 $l 1 $o 782.42166092 B $p 3999800000004 $q 2020-10-21 $r 2020-10-16 $s 2020-10-16 $w 2020-10-16 $y BK $k Checked Out

Note in the above that we now have a 'k' subfield appended which lists the various statuses of the items, we can easily see what is available and what is not.

--add-status-multi-subfield :

This option adds to the previous, and rather than combining the statuses into a single field, we get a 'k' for each status:

952 $0 1 $1 1 $2 ddc $4 1 $7 0 $a CPL $b CPL $d 2020-10-16 $o 782.42166092 B $p 3999800000002 $r 2020-10-16 $w 2020-10-16 $y BK $k Lost $k Damaged $k Withdrawn

One more exciting feature of the new responder is the ability to define the text for each status. For instance, if you wanted 'Available' to say 'On the shelf' or 'Damaged' to say 'Awaiting repair' you can do so using the Authorized values section in the Koha administration panel


First you need to create a 'New category' with code Z3950_STATUS

Then you can add new authorized values like:

The authorized value must match the list on the left below, the description field will replace the default value for the status on the right, none of the other settings for the authorized value are used.
AVAILABLE => 'Available'
CHECKED_OUT => 'Checked Out'
LOST => 'Lost'
NOT_FOR_LOAN => 'Not for Loan'
DAMAGED => 'Damaged'
WITHDRAWN => 'Withdrawn'
IN_TRANSIT => 'In Transit'
ON_HOLD => 'On Hold'


So, here are the two I mentioned above:

And when I restart the Z39.50 responder and search for the record I now get:

952 $0 0 $1 0 $2 ddc $4 0 $6 _ $7 0 $a CPL $b CPL $c GEN $d 2014-05-07 $p 3999900000001 $r 2014-05-07 $w 2014-05-07 $y BK $k On the shelf

952 $0 1 $1 1 $2 ddc $4 1 $7 0 $a CPL $b CPL $d 2020-10-16 $o 782.42166092 B $p 3999800000002 $r 2020-10-16 $w 2020-10-16 $y BK $k Lost $k Awaiting repair $k Withdrawn

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $a CPL $b CPL $d 2020-10-16 $l 0 $o 782.42166092 B $p 3999800000003 $r 2020-10-16 $w 2020-10-16 $y BK $k On Hold

952 $0 0 $1 0 $2 ddc $4 0 $6 782_421660920000000_B $7 0 $a CPL $b CPL $d 2020-10-16 $l 1 $o 782.42166092 B $p 3999800000004 $q 2020-10-21 $r 2020-10-16 $s 2020-10-16 $w 2020-10-16 $y BK $k Checked Out


Voila! Custom status responses from a Z39.50 responder in Koha.