SPIRES Image
INDEX, SUB-INDEX LINKAGE
FILE DEFINITION, section B.8.5   note: Manual link may not be current

The general form of SUB-INDEX linkage is similar to INDEX-NAME:

    SUB-INDEX = name of an index record STRUCTURE whose KEY
          is to receive a goal record value;
    SEARCHTERMS = the names and aliases to be allowed in
          a search command such as FIND;
    SEARCHPROC = processing rules applied to the values in a
          search request;
    GOALREC-ELEM = name of the element in the goal record
          that is passing its value to this sub-index;
    PASSPROC = processing rules applied to goal record
          elements before placing them in the sub-index;
    PRIV-TAG = number; to limit the use of these SEARCHTERMS.

When SUB-INDEX terms are added to a simple index, the effect  is  to  introduce
additional  structural  levels  to  the  hierarchy  leading from the KEY of the
INDEX-NAME record to the PTR-GROUP element.  SUB-INDEX names a keyed  structure
in  the  index  record.   The  KEY of that STRUCTURE receives the goal record's
value being passed for the sub-index term.  A personal name  index  is  a  good
example  of a simple index with a sub-index structure.  Let's modify our sample
file definition to include a PERSON element in the BOOK  records,  and  another
index record: REC04

    FILE = GA.SPI.BIBLIOGRAPHY;
    AUTHOR = JOHN SACK;
    RECORD-NAME = BOOK;
      REMOVED;  SLOT;
      FIXED;
        ELEM = DATE;  LEN = 4;  OCC = 1;
          INPROC = AS31; OUTPROC = A76;
      REQUIRED;
        ELEM = TITLE;
          INPROC = A40;
        ELEM = PERSON;
          INPROC = A40/ A41:1;

    RECORD-NAME = REC04;
        KEY = LAST-NAME;
        ELEM = FIRST-NAME-STR;
          TYPE = STR;
    STRUCTURE = FIRST-NAME-STR;
        KEY = FIRST-NAME;
          INPROC = A38;
          OUTPROC = A38;
        ELEM = POINT-BACK;
          TYPE = LCTR;

    GOALREC-NAME = BOOK;
    PTR-ELEM = POINT-BACK;
    EXTERNAL-NAME = CITATION;
    PASSPROC = A170;

    INDEX-NAME = REC04;
          SEARCHTERMS = PERSON, NAME, PN, N;
          SEARCHPROC = A44,'.',/ A38/ A11:1,#;
          GOALREC-ELEM = PERSON;
          PASSPROC = A166/ A44,'.',/ A38;

       SUB-INDEX = FIRST-NAME-STR;
          SEARCHTERMS = NULL;
          PASSPROC = A165;

       PTR-GROUP = POINT-BACK;

No GOALREC-ELEM was needed for the SUB-INDEX term in this example  because  the
PASSPROC  A165  indicates the value to be passed to FIRST-NAME had already been
created by A38 in the PASSPROC associated with INDEX-NAME.  This is usually the
case with personal name sub-indexes, but not for  other  sub-index  structures.
The  SEARCHTERMS  of  the SUB-INDEX for personal name are not usually used in a
search request because A38 in the SEARCHPROC of  the  INDEX-NAME  provides  the
necessary  search  values  for  the SUB-INDEX.  [EXPLAIN INPROC-REQ STATEMENT.]

Let's examine  the  index  record  definition  and  linkage  definition  for  a
sub-index  that  is  not  for a personal name.  Suppose the following hierarchy
were needed for an airline reservation system:

    Index:  Flight Number
      Sub-Index:  Section Number
        Sub-Index:  Seat Number

So, SEAT is inside SECTION which is inside FLIGHT.  The index record definition
for this structure would look like this:

    RECORD-NAME = REC04;
        KEY = FLIGHT-NUMBER;
        ELEM = SECTION-NUMBER-STR;
          TYPE = STR;
    STRUCTURE = SECTION-NUMBER-STR;
        KEY = SECTION-NUMBER;
        ELEM = SEAT-NUMBER-STR;
          TYPE = STR;
    STRUCTURE = SEAT-NUMBER-STR;
        KEY = SEAT-NUMBER;
        ELEM = POINT-BACK;
          TYPE = LCTR;

The linkage definition for this index record would look like this:

    INDEX-NAME = REC04;
          SEARCHTERMS = FLIGHT-NUMBER, FLIGHT;
          SEARCHPROC = <appropriate search processing rules>;
          GOALREC-ELEM = FLIGHT;
          PASSPROC = A169:1;

       SUB-INDEX = SECTION-NUMBER-STR;
          SEARCHTERMS = SECTION-NUMBER, SECTION;
          SEARCHPROC = <appropriate search processing rules>;
          GOALREC-ELEM = SECTION;
          PASSPROC = A171,0/ A169:1;

       SUB-INDEX = SEAT-NUMBER-STR;
          SEARCHTERMS = SEAT-NUMBER, SEAT;
          SEARCHPROC = <appropriate search processing rules>;
          GOALREC-ELEM = SEAT;
          PASSPROC = A171,0/ A169:1;

       PTR-GROUP = POINT-BACK;

Note the use of A171 to pass a default value of SECTION and SEAT if no value is
found in the goal record.  This will ensure that the index record  is  created,
even  if  it  is  incomplete.   A171 is also used this way in passing qualifier
elements.  [EXPLAIN LINKAGE, QUALIFIER, GLOBAL, or EXPLAIN LINKAGE, QUALIFIER.]

The SEARCHTERMS of a SUB-INDEX are specified with a leading @-sign in a  search
request along with the SEARCHTERMS of the INDEX-NAME.  For example, FIND FLIGHT
27  @SECTION  B  @SEAT  9 requests a specific hierarchy within the REC04 index.

**Reference to:  INPROC-REQ STATEMENT
                 LINKAGE, QUALIFIER
                 LINKAGE, QUALIFIER, GLOBAL

**Referenced by: NOSEARCH STATEMENT
                 PASSPROC, CHOOSING FETCHER
                 INDEX-NAME STATEMENT
:: Spires Explain :: About SPIRES :: SLAC :: SLAC Library :: Contact ::

 SPIRES HEP is a joint project of SLAC, DESY & FNAL as well as the worldwide HEP community.
 Mirrors: DESY (Germany), FNAL (US), IHEP (Russia), IPPP (UK), SLAC (US), YITP (Japan) 

 dick.guertin@gmail.com