Skip to main content
OCLC Support

Z39.50Server File Layouts

Find information about the Z39.50Server file layouts for Amlib.

Z3950SERVER.INI

The Z3950SERVER.INI file contains various parameters for configuring the Z39.50 Server. It allows you to setup which databases are searchable and whether authentication is required.

[Start]
ulPortNumber=210
ulTimeOut=300
ulWantWindow=1

[Tracing]
trace=0
tracefile="trace%d.txt"

[InitializeRequest]
ulAuthentication=1

[Authentication]
STAFF=AMLIB
JOHN=SMITH

[InitializeResponse]
pcProtocolVersion="111"
pcOptions="110000010000000"
ulPreferredMessageSize=64000
ulMaximumMessageSize=64000
pcImplementationId="Crossnet Systems (61)"
pcImplementationName="Amlib Z-Server"
pcImplementationVersion="Amlib Z-Server 1.1"

[Present]
pcDefaultRecordFormat=F
ulMaximumRequestRecords=25

[ControlFiles]
pcControlFilesDir="Standard"

[ODBC:AMLIB]
AMCAT="DRIVER=Centura SQLBase 3.6 32-bit Driver -NT & Win95;DB=AMCAT;UID=XXX;PWD=YYY"
AMLIB="DRIVER=Centura SQLBase 3.6 32-bit Driver -NT & Win95;DB=AMLIB;UID=XXX;PWD=YYY"

[ODBC:LOCALHISTORY]
AMCAT="Driver=SQL Server;Server=myserver;Database=TECAT;UID=XXX;PWD=YYY"
AMLIB="Driver=SQL Server;Server=myserver;Database=TELIB;UID=XXX;PWD=YYY"

The above file has been configured to only permit authenticated users (ulAuthentication=1). The [Authentication] section allows you to specify the permitted users. The two users that are allowed are usernames STAFF and JOHN with a password of AMLIB and SMITH respectively. To allow anonymous access you would need to change the ‘ulAuthentication’ parameter to 0 instead of 1.

The above file has been configured to allow Z39.50 clients to search either the AMLIB or LOCALHISTORY databases (ie [ODBC:AMLIB] & [ODBC:LOCALHISTORY]). For each available database both an AMLIB and AMCAT entry must appear in the INI file with a valid ODBC connect string.

The [ControlFiles] section specifies where the SEARCH.TBLX, SCAN.TBLX, PRESENT.FULL, PRESENT.BRIEF and MARCDEF2.TBLX files reside. The ‘pcControlFilesDir’ entry in the above sample file specifies that these files are in the ‘Standard’ subdirectory relative to where Z3950Server.exe is loaded. This entry can be changed to include an absolute path or can be removed altogether (it will then assume all the files are in the same directory as Z3950Server.exe).

SEARCH.TBLX

The SEARCH.TBLX translates Z29.50 search attributes to SQL statements. You can setup this file to allow both browse and keyword searches with either browse or keyword as the default depending upon the specified Z39.50 search attribute. If a search attribute is not specified in this file then the search is disallowed. A sample file is as follows:

DATABASE, "DEFAULT";
OBJECTIDENTIFIER, "1.2.840.10003.3.1";
INDIVIDUAL;
MAXIMUMCODEDITEMS, 1000;
KEYS, "distinct a.ca_cat_no", FALSE;
STOPWORDS, " AND ", " OR ", " NOT ", " THE ", " OF ", " TO ", " AN ", " I ", " A ", " IN "," WITH ", " THIS ", " THAT ", " BY ", " IT " , " FOR ", " OFF", " ARE ", " ALSO ", " ON ", "  THERE ", " WHICH ", " WERE ", " WAS ", " NOT", " ANY ", " SHOULD ", " SHALL ", " THESE ", " THOSE ", " MORE ", " WHEN ", " IS ", " DOES ";

ATTRIBUTES;

/* Title Browse */
"4,3,0,101,0,0",
"Select      c.CAT_NO
From         CATALOGUE_REFS c, AUTHORITY a
Where       c.AUTH_NO = a.AUTH_NO and
                   a.AUTH_TAG_NO in (245, 246) and
                   a.AUTH_KEY XXTERMXX", FALSE, FALSE, 0, 0, 0, "TROUTINE4";

/* Title (1 Keyword) */
4,
"Select    CA_CAT_NO
From        CAT_ALLWORDS
Where      CA_TAG_NO in ( 245, 246 ) and
                  CA_KEYWORD XXTERMXX1", WORDLIST1, FALSE, 0, 0, 0, "TROUTINE4";

/* Title (2 Keywords) */
4,
"Select Distinct
                  a. CA_CAT_NO
From         CAT_ALLWORDS a, CAT_ALLWORDS b
Where       a.CA_TAG_NO in ( 245, 246 ) and
                   a.CA_KEYWORD XXTERMXX1 and
                   a.CA_CAT_NO = b.CA_CAT_NO and
                   b.CA_TAG_NO in ( 245, 246 ) and
                   b.CA_KEYWORD XXTERMXX2", WORDLIST2, FALSE, 0, 0, 0, "TROUTINE4";

/* Title (3+ Keywords) */
4,
"Select Distinct
                    a.CA_CAT_NO
From           CAT_ALLWORDS a, CAT_ALLWORDS b, CAT_ALLWORDS c
Where        a.CA_TAG_NO in ( 245, 246 ) and
                    a.CA_KEYWORD XXTERMXX1 and
                    a.CA_CAT_NO = b.CA_CAT_NO and
                    b.CA_TAG_NO in ( 245, 246 ) and
                    b.CA_KEYWORD XXTERMXX2 and
                    a.CA_CAT_NO = c.CA_CAT_NO and
                    c.CA_TAG_NO in ( 245, 246 ) and
                    c.CA_KEYWORD XXTERMXX3", WORDLISTD3, FALSE, 0, 0, 0, "TROUTINE4";

The most important entries in this file are all the entries below ATTRIBUTES. This sample file will only allow users to search on Titles (ATTR1=4) and all other searches such as Author (ATTR1=1003) and Subject (ATTR1=21) will be rejected.

If you look at the above sample file you will notice that keyword searches are the default when searching for a title. When Attribute 1 is specified by a Z39.50 client (ATTR1=4) and no other Attributes are specified then a keyword search is performed. A browse search is only performed when Attributes 1, 2 & 4 are specified by a Z39.50 client (ATTR1=4, ATTR2=3, ATTR4=101).

The ‘Where Clauses’ for each SQL statement can be modified to include additional conditions. The above sample file only searches the 245 and 246 tags when performing a title search. This can be changed for example to include the 740 tag as well.

PRESENT.BRIEF & PRESENT.FULL

The PRESENT.BRIEF & PRESENT.FULL files contain the SQL for retrieving Bibliographic and Holdings information for a record. The PRESENT.BRIEF file is used when a Z39.50 client requests a ‘Brief’ Marc record, otherwise the PRESENT.FULL file is used. A sample file is as follows:

# DEFAULT #

select
a.tag_no,
tag_ind1,
tag_ind2,
b.cat_sf,
b.cat_sf_data,
cat_sf_sequence,
cat_sf_long_no,
c.auth_no + c.cattag_no
from cat_sf b, cat_tag a, catalogue_refs c
where cattag_no = tag_unique_no and
tag_unique_no = cat_tag_unique_no and
c.cat_no = XXXXX
union
select a.auth_tag_no, auth_ind1, auth_ind2, b.sf, b.sf_data, sf_sequence, 0,
c.auth_no + c.cattag_no
from sf_data b, authority a, catalogue_refs c
where a.auth_no = c.auth_no and
b.sf_auth_no = c.auth_no and
c.cat_no = XXXXX
order by 1, 8, 6;

Select     STK_ITEM_NO, STK_LINE6, STK_LOC_PERM,
                STK_FORM, STK_IS_RESERVED, STK_IS_ON_LOAN,
                STK_DATE_DUE, STK_FOR_LOAN, STK_IS_ON_ORDER
From       STK_ITEM
Where     STK_CAT_REF = XXXXX and
                STK_OPAC_SHOW = 'Y';

The #DEFAULT# indicates that the SQL commands are to be applied to all databases. If #DEFAULT# was changed to #AMLIB# then the SQL commands would only apply to the AMLIB database, all other requested databases would return an error.

The first SQL command retrieves the Marc data for a catalogue. You will notice that it retrieves all the subfields for all the Marc Tags. You can change the SQL command to include a Where Clause such as ‘TAG_NO <= 900’ to exclude all tags that are greater than or equal to 900 (for example). It is important that you do not change the columns in the select statement because they are closely related to entries in the MARCDEF2.TBLX file.

The second SQL statement retrieves the Holdings data for a catalogue. You will notice that it retrieves all the stockitems where the Opac Show is set to ‘Y’. You can change the SQL command to include a Where Clause such as ‘STK_LOC_TEMP not in (‘NED’, ‘SUB’)’ to exclude locations that should not be shown. It is important that you do not change the columns in the select statement because they are closely related to entries in the MARCDEF2.TBLX file.

MARCDEF2.TBLX

The MARCDEF2.TBLX file is used in conjunction with the PRESENT.FULL & PRESENT.BRIEF files. The columns selected in the PRESENT.FULL & PRESENT.BRIEF files require an associated entry in the MARCDEF2.TBLX file. A sample file is as follows:

"XXDATABASESXX", "DEFAULT";
"MARCOID", "1.2.840.10003.5.10";

"TAGNO", "a.tag_no";
"INDICE1", "tag_ind1";
"INDICE2", "tag_ind2";
"SUBFIELD", "b.cat_sf";
"DATA", "b.cat_sf_data";
"COMPLETE", "cat_sf_sequence";
"EXTRANO", "cat_sf_long_no";
"SAMEFIELD", "c.auth_no + c.cattag_no";
"SPILLOVER", "select cl_data from cat_long where cl_unique_no = XXXXX";
"BARCODE", "stk_item_no";
"AVAILABLE DATE", "stk_date_due";
"TEMP LOCATION", "stk_loc_temp";
"LOCAL LOCATION", "stk_loc_perm";
"ON LOAN", "stk_is_on_loan";
"ON ORDER", "stk_is_on_order";
"FOR LOAN", "stk_for_loan";
"CALL NUMBER", "stk_line6";
"RESERVES", "stk_is_reserved";
"FORMAT", "stk_form";

If the columns in the ‘Select’ statement(s) change in the PRESENT.FULL & PRESENT.BRIEF files then this file has to be changed also.