Different Z39.50 servers support different use attributes using different profiles.
Libraries Australia (LA): http://www.nla.gov.au/librariesaustralia/services/search/z3950/
Library of Congress (LOC): https://www.loc.gov/z3950/lcserver.html
More profiles: https://www.loc.gov/z3950/agency/profiles/profiles.html
In the case of Libraries Australia and Library of Congress, the profiles are different between bibliographic databases and authority databases, and this can be traced back to differences in the functional areas of the Bath profile:
For instance, Libraries Australia claims to support "Functional Area D (Authority Record Search & Retrieval) to Level 1"
It doesn't appear to in reality as it doesn't support use attribute 1002 (while the Library of Congress does support this use attribute).
The Library of Congress appears to be more in line with Functional Area D (Authority Record Search & Retrieval) to Level 2:
It doesn't look like LOC perfectly adheres to Level 2, but I'd say it does up to 99.99%. It also supports a extra attributes belonging to local indexes.
Anyway, here's the problem:
LOC use attributes 1,2, and 3, but LA does not support these attributes.
On the other hand, LA supports 1003, 1004, 1005, and 1006, but LOC does not.
LOC supports 1002, but LA does not.
We need to be able to define profiles on a server by server basis. In fact, this is even recommended by Libraries Australia: "Step 4. Configure your Bib-1 Search Attributes (if required):".
I don't think it would be that difficult to define profiles. We'd have a table with id, profile name, a name/index/description column, and a use attribute column. Then we could add a foreign key to z3950servers to specify the profile.
We'd need to do a different query for each server target but that would be easy enough on its own.
The difficulty may lie in what to do about the Z39.50 search form. Not all "names" would be supported by all targets. Bug 18096 (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18096) also mentions some local attributes. We don't have a way of specifying those in the search form at the moment, and obviously those local attributes would be local to that particular server. I suppose we could dynamically create the search form... but again not all names will correspond to all servers. I suppose we could just add that caveat. We could also be better with our presentation of results. If we get an error code of unsupported use attribute from a target server, we could surface that to users.
Not for this specific issue, but note that we have defined a field for SRU search mappings in the z3950servers table. If you add a new SRU server, you can open the admin/sru_modmapping.pl form.
This sounds like something similar for Z3950.