8.60. SKPCMP

SKPCMP    SKPCMP    SKPCMP    SKPCMP    SKPCMP    SKPCMP    SKPCMP    
          **********************************************
                    **************************
                              ******

SUBROUTINE SKPCMP (ISTR, IRAY, NN, SETS, NSETS, ISET, IND, NT)
This subroutine can do everything that the subroutine SKCOMP can do,
and additionally, has the capabilities of separating the elements of
IRAY into categories and then search IRAY by element and category.
The categories that each element of IRAY will be assigned to are
specified by the input character string vector SETS of vector length
NSETS.  Elements of each category in IRAY must be grouped congrously.
The number of elements in each category within IRAY is specified by
the input integer vector ISET.  To search for the existence of an
element within acategory ISTR may additionally be composed of two
substrings, ISTR="ELEMENT_NAME/CATEGORY_NAME/", where CATEGORY_NAME
is one of the categories specified in SETS.  In this case, IND will
return the first position in IRAY where ELEMENT_NAME occurred within
the category CATEGORY_NAME.  NT will return the total number of
times ELEMENT_NAME occurred within the category CATEGORY_NAME.
If ELEMENT_NAME is not found within the specified category, IND and
NT are returned with a value of zero.  If no category is specified
within ISTR, IND and NT return with the same values as they would
from subroutine SKCOMP.

Consider the following example,
      IRAY = {"RED", "BLUE", "JADE", "RUBY", "TOPAZ", "JADE"}
      NN = 6
      SETS = {"COLORS", "STONES"},
      NSETS = 2
      ISET = {4, 2}.
This assumes that the elements of IRAY were grouped into two
sets, consisting of 4 and 2 elements, respectively, and the
following names
      "COLORS"  = {"RED", "BLUE", "JADE", "RUBY"}, and
      "STONES"  = {"TOPAZ", "JADE"}.

If ISTR="BLUE" then IND=2 and NT=1;
if ISTR="PINK" then IND=0 and NT=0; and
if ISTR="JADE",then IND=3 and NT=2.

If ISTR="BLUE/COLORS/" then IND=2 and NT=1;
if ISTR="BLUE/STONES/" then IND=0 and NT=0;
if ISTR="JADE/GEMS/"   then IND=0 and NT=0; and
if ISTR="JADE/STONES/",then IND=6 and NT=1.

INPUT
ISTR        - Character string, which may or may not end with a
              slash-delimited substring.
IRAY(*)     - Character string array;
              dimension at least NN.
NN          - Integer scalar, number of entries in IRAY(*).
SETS(*)     - Character string array, cross-reference set to relate
              with elements of IRAY;
              dimension at least NSETS.
NSETS       - Integer scalar, number of entries in SETS(*)
ISET(*)     - Integer array, total number of entries in a subset of
              IRAY;  dimension at least NSETS.

OUTPUT
IND         - Integer scalar, index of ISTR in IRAY(*).
              If ISTR is not in IRAY(*), IND = 0.
              If the slash-delimited substring of ISTR is not
              in SETS(*), IND = 0.
              If the slash-delimited substring of ISTR is in
              SETS(N), but the substring before the slash is
              not a member of the subset associated with SETS(N),
              IND = 0, whether or not the substring is in IRAY(*).
NT          - Integer scalar, total occurrence of ISTR in IRAY(*),
              or total number of times ISTR occurs in a subset
              of IRAY(*).