          SUBROUTINE (ID,OWORDS,FLID,CONV,LEFT,TOP,LENGTH,CWID,CONV.SUB,IDICT,AUTH.BRS,OPTS,TITLE,NOTLASTPASS)
** Version# 87.0001[1] - 03/21/2014 - 11:49am - TSMITH - eclipse
** Copied from SP FINDID Version# 87 - 04/20/2011 - 03:37pm - CASEY - main

*** Subroutine: FINDID
*-------------------------------------------------------------------------*
*** Program takes variable OWORDS and tries to locate items in FLID that
*** match OWORDS.  It then creates a table so that a user can
*** select from IDS that were found.  The ID that is chosen is then passed
*** back in the ID variable.
*-------------------------------------------------------------------------*
*** ID      [OUT] - ID of the item that is being passed back
*** OWORDS   [IN] - String to Search off of.
*** FLID     (IN) - File to search on
*** CONV     (IN) - The Type of output conversion to use to format the data
***                 that appears in the table the users select from.
*** LEFT     (IN) -  X position that the table should start on
*** TOP      (IN) - Y Position that the table should start on
*** LENGTH   (IN) - length of the table
*** CWID     (IN) - Column width of the table
*** CONV.SUB (IN) - Subroutine to use for output conversions on that
***                 data as well as limiting the IDS that appear in the
***                 table
***                 NOTE:  This is converted to CSUB...in the program use
***                        that variable instead.  Do not use CONV.SUB as
***                        that can break when coming in from Java due to
***                        data structure differences.
*** IDICT    (IN) - Index to search off of
*** AUTH.BRS (IN) - User Authrized branches
*** OPTS     (IN) - Pass in new if it can be an opition in the table
*** TITLE    (IN) - Title of the table
*** NOTLASTPASS (IN) - Can be set to 1 if you don't want the program to
***                    beep when it doesn't find an ID.
*-------------------------------------------------------------------------*
*** COMMON VARIABLES:
***       JAVA.PROC$ - JAVA Support
*-------------------------------------------------------------------------*
          *** This is here because for some reason if this routine is
          *** called directly from java, a CALL @ of a variable passed from
          *** Java causes the UniSubroutine to fail with an UnknownError
          *** So DO NOT use CONV.SUB anywhere...use CSUB instead
          CSUB           = CONV.SUB<1>
          FILTER.FLAG    = CONV.SUB<2>
          FILTER.AUTODEL = CONV.SUB<3>

          ID         = ''
          VAL.PLINES = ""
          ST.POS     = 1
          NEW        = NO
          ID.WORD    = NO
          WORDS      = TRIM(OWORDS)
          LOCATE 'NEW' IN OCONV(OPTS<1>,'MCU') SETTING NEW.OK ELSE NEW.OK=NO
          IF OCONV(OPTS<1>,"MCU") = "PRD PLINE" THEN
             VAL.PLINES = TRIM(OPTS<2>,VM,"T")
             OPTS = ""
          END
*------------------------------------------------------------------------*
          WLEFT = LEFT
          IF WLEFT>36 THEN WLEFT=36
          WTOP  = TOP+2
          IF WTOP>11 THEN WTOP=1
          READ ZONE.REQ FROM CTRLFILE,'SOE.REQR.PRD.ZONE' ELSE ZONE.REQ = ''
          *** Check to see if customer is allowed to view products outside
          *** their valid product zones
          CHECK.KEY 'PRD.ZONE',OUTSIDE.ZONE.OK
          TITLE.OPT    = TITLE
          TITLE.OPT<3> = 'F9.F10.OK'
*-------------------------------------------------------------------------*
START:    BEGIN CASE
          CASE OWORDS='..'
             LOCATE FLID IN LAST.IDS$<10> SETTING POS THEN
                ID = LAST.IDS$<11,POS>
                RETURN
             END ELSE PRINT BELL:; RETURN
          CASE OWORDS='.'
             IF LAST.IDS$<1>=FLID THEN
                LAST.ID = LAST.IDS$<2>     ;* Chosen ID
                IDS     = LAST.IDS$<3>     ;* List od IDs
                LOCATE LAST.ID IN IDS<1> SETTING ST.POS ELSE ST.POS = 1
                GOTO INMENU
             END ELSE PRINT BELL:; RETURN
          CASE FLID = 'RECURRING.JE'; NULL;  * Allow null words for genled.
          CASE FLID = 'TERRITORY'; NULL;  * Allow null words for brs,terrs
          CASE FLID = 'GENLED';           * Allow null words for genled.
             IF OWORDS='/' THEN
                CHECK.KEY 'GL.DYNAMIC.ADDITION',ENTRY.OK,LEVEL
                IF ENTRY.OK THEN
                   READV TST FROM CTRLFILE,'GL.STRUCTURE',5 ELSE TST=''
                   IF TST#'' THEN
                      GL.DYNAMIC.ADDITION ID
                      GOTO FINISH
                   END
                END
             END
          CASE NEW.OK AND (FLID='CMP' OR FLID='PROMPTS' OR FLID='SCREEN')
             * first in xref file, then AD, then cmp directly
             STRIP.PREFIX = YES
             EXECUTE 'SSELECT PGM.DOC WITH &INDEX& = "':FLID:'~':OWORDS:']"' CAPTURING MSG
             READLIST WK.IDS ELSE WK.IDS = ''
             IF WK.IDS = '' THEN
                EXECUTE 'SSELECT AD WITH &INDEX& = "ID~':FLID:'~':OWORDS:']"' CAPTURING MSG
                READLIST WK.IDS ELSE WK.IDS = ''
                IF WK.IDS # '' THEN
                   IF FLID = 'PROMPTS' THEN
                      X.LIST = ''
                      W.CT   = DCOUNT(WK.IDS,AM)
                      FOR W = 1 TO W.CT
                         CK.ID = FIELD(WK.IDS<W>,'~',2,999)
                         GET.ACTIVE.DATA 'PROMPTS',CK.ID,DATA.REC,RECORD.FOUND
                         IF RECORD.FOUND THEN
                            X.CT = DCOUNT(DATA.REC<4>,VM)
                            FOR X = 1 TO X.CT
                               WK.ID = DATA.REC<4,X>
                               X.LIST<-1> = FIELD(WK.ID,'~',DCOUNT(WK.ID,'~'))
                            NEXT X
                         END ELSE
                            X.LIST<-1> = CK.ID
                         END
                      NEXT W
                      WK.IDS = X.LIST
                      STRIP.PREFIX = NO
                   END
                END ELSE
                   EXECUTE 'SSELECT ':FLID:' = "':OWORDS:']"' CAPTURING MSG
                   READLIST WK.IDS ELSE WK.IDS = ''
                   IF WK.IDS # '' THEN STRIP.PREFIX = NO
                END
             END
             IF WK.IDS # '' THEN
                IF STRIP.PREFIX THEN
                   IDS = ''
                   W.CT = DCOUNT(WK.IDS,AM)
                   FOR W = 1 TO W.CT
                      IDS<-1> = FIELD(WK.IDS<W>,'~',2,999)
                   NEXT W
                END ELSE
                   IDS = WK.IDS
                END
                GOTO GOT.IDS
             END
          CASE HELP AND IDICT = ""
             IF FLID='CUSTOMER' OR FLID='PRODUCT' OR FLID='ZIP' OR FLID='VENDOR' THEN RETURN
             OPEN FLID TO INFILE ELSE RETURN
             BEGIN CASE
             CASE FLID = 'ABC.CODES'
                EXECUTE 'SSELECT ':FLID:' = "':OWORDS:']" BY TYPE BY AUTO.CODE BY DESC' CAPTURING MSG
             CASE FLID = 'EDICT' AND FIELD(OWORDS,'~',1) = 'SQL'
                OWORDS = FIELD(OWORDS,'~',2,99)
                CMD    = 'SSELECT ':FLID:' = "':OWORDS:']" WITH SQL'
                EXECUTE CMD CAPTURING MSG
             CASE OTHERWISE
                EXECUTE 'SSELECT ':FLID:' = "':OWORDS:']"' CAPTURING MSG
                IF FLID = 'PP' OR FLID = 'CC' OR FLID = 'MP' THEN
                   READLIST IDS ELSE IDS = ''
                   EXECUTE 'SSELECT PGM.DOC WITH &INDEX& = "':FLID:'~':OWORDS:']"' CAPTURING MSG
                   READLIST IDS2 ELSE IDS2 = ''
                   IF IDS = IDS2 THEN
                      IF IDS = '' THEN RETURN
                      GOTO GOT.IDS
                   END
                   I.CT = DCOUNT(IDS2,AM)
                   FOR I = 1 TO I.CT
                      LOCATE IDS2<I> IN IDS BY 'A' SETTING POS ELSE
                         IDS = INSERT(IDS,POS;IDS2<I>)
                      END
                   NEXT I
                   GOTO GOT.IDS
                END
             END CASE
             READLIST IDS ELSE RETURN
             GOTO GOT.IDS
          CASE WORDS = '';       RETURN
          CASE (WORDS[1,1]='@' OR WORDS[1,1]='.') AND NUM(WORDS[2,99])
             ID.WORD = YES
             IDS = FIELD(WORDS,' ',1)[2,999]

             IF FLID       ='PRODUCT' THEN GOSUB CHK.ALLOWED.PRDS
             IF FLID[1,10] = 'ZZPROD.IDX' THEN GOSUB CHK.ALLOWED.PRDS
             IF FLID       ='CUSTOMER' THEN GOSUB CHK.CUSTS

             IF CSUB THEN GOSUB SEL.CSUB
             ID = IDS
             BEGIN CASE
             CASE FLID = 'CUSTOMER'
                READV TST FROM CUSFILE,ID,7 ELSE TST = ''
                TST = RAISE(TST)
                BEGIN CASE
                * Bill To Only
                CASE IDICT = '&INDEX&.BT'
                   IF NOT(TST<1>) THEN ID = ''
                * Ship To Only
                CASE IDICT = '&INDEX&.ST'
                   IF NOT(TST<2>) THEN ID = ''
                * No Index
                CASE OTHERWISE
                   IF NOT(TST<1>) AND NOT(TST<2>) AND NOT(TST<9>) THEN
                      ID = ''
                   END
                END CASE
             CASE FLID = 'VENDOR'
                READV TST FROM CUSFILE,ID,7 ELSE TST = ''
                BEGIN CASE
                * Pay To Only
                CASE IDICT = '&INDEX&.PT'
                   IF NOT(TST<1,5>) THEN ID = ''
                * Ship From Only
                CASE IDICT = '&INDEX&.SF'
                   IF NOT(TST<1,6>) THEN ID = ''
                * No Index
                CASE OTHERWISE
                   IF NOT(TST<1,5>) AND NOT(TST<1,6>) THEN ID = ''
                END CASE
             CASE FLID = 'PRODUCT'
                READV TST FROM PRDFILE,ID,1 ELSE ID = ''
                IF VAL.PLINES THEN
                   READV PPLNE FROM PRDFILE,ID,9 ELSE PPLNE = ""
                   LOCATE PPLNE IN VAL.PLINES<1> SETTING DUMMY ELSE
                      ID = ""
                   END
                END
             END CASE
             GOTO FINISH
          CASE FLID = 'CUSTOMER' AND WORDS[1,1]='#'
             SOE.SELECT.TID WORDS[2,99],TID
             IF TID = '' THEN GOTO FINISH
             * find customers from the selected ledger ids
             CT = DCOUNT(TID,AM)
             IDS = ''
             FOR I = 1 TO CT
                OID = FIELD(TID<I>,'.',1)
                READ TST FROM LEDFILE,OID ELSE TST = ''
                GID = FIELD(TID<I>,'.',2)
                IF LEN(GID) = 4 THEN
                   LOCATE GID+0 IN TST<12> SETTING GEN ELSE GEN = ''
                END ELSE
                   LOCATE GID+0 IN TST<8> SETTING GEN ELSE GEN = ''
                END
                IDS<-1> = TST<1,GEN>
             NEXT I

             GOTO GOT.IDS
          CASE (FLID = 'CUSTOMER' OR FLID='VENDOR' OR FLID='ENTITY') AND ( LEN(FIELD(WORDS,'.',1))=OID.LGTH$ OR LEN(FIELD(WORDS, '.',1))=8 )
             OID = OCONV(FIELD(WORDS,'.',1),'MCU')
             READ LREC FROM LEDFILE,OID THEN
                INVN = FIELD(WORDS,'.',2)
                IF (NUM(INVN)) AND INVN#'' THEN
                   LOCATE INVN IN LREC<8> SETTING GEN ELSE GEN = 1
                END ELSE GEN = 1
                IF FLID = 'VENDOR' AND OID[1,1] = 'S' THEN
                   IF LREC<33,GEN> AND LREC<6,GEN>#'Y' THEN
                      LOCATE LREC<33,GEN> IN LREC<12> SETTING GEN2 THEN
                         GEN = GEN2
                      END
                   END
                END
                IDS = LREC<1,GEN>
                IF LREC<5,GEN> # LREC<1,GEN> THEN IDS<1,2> = LREC<5,GEN>
                READV TST FROM CUSFILE,IDS<1,1>,7 ELSE TST = ''
                IF FLID # 'ENTITY' THEN
                   IF FLID = 'CUSTOMER' THEN
                      IF NOT(TST<1,1>) AND NOT(TST<1,2>) THEN IDS = ''
                   END ELSE
                      IF NOT(TST<1,5>) AND NOT(TST<1,6>) THEN IDS = ''
                   END
                END
                GOTO GOT.IDS
             END
          CASE FLID='PRODUCT' AND WORDS[1,1]='/'
             OE.SELECT.FAMILY ,,WORDS,IDS
             * OE.SELECT.FAMILY adds @@SELECT@@ to signal to solar that
             * it should display the buy line select dialog. In this case
             * the @@SELECT@@ and related information should be ignored
             * and an empty IDS should be returned so that Solar doesn't
             * display @@SELELCT@@ as a valid product. In the case where
             * IDS contains @@SELECT@@ there are no valid products in the
             * list so IDS can be safely cleared.
             IF IDS<1,1> ='@@SELECT@@' THEN
                IDS = ""
             END
             GOTO GOT.IDS
          END CASE
*------------------------------------------------------------------------*
          *** Get a list of products that meet the description entered by
          *** the user
          INDEX.IDS.GET FLID,IDICT,WORDS,IDS

          IF WORDS # TRIM(OWORDS) THEN
             *** WORDS changed, so the user narrowed the search string.
             *** Update OWORDS with the narrowed string.
             OWORDS = WORDS
          END

          IF IDICT = '&INDEX&.CAT' AND OUTSIDE.ZONE.OK THEN
             *** If user has auth key, display '*** Press F10...' to view
             *** catalog products outside users product zones
             GOSUB PRD.ZONE.CAT
          END

          IF FLID='VENDOR' THEN
             IDS.CT = DCOUNT(IDS,VM)
             FOR I = 1 TO IDS.CT
                READV TST FROM CUSFILE,IDS<1,I>,7 ELSE TST = ''
                IF TST<1,9> THEN IDS = DELETE(IDS,I)
             NEXT I
          END

          *** If the IDICT is &INDEX& go to CHK.CATALOG.  In that internal
          *** subroutine, the products that are catalog index will not be
          *** displayed
          BEGIN CASE
          CASE (FLID='PRODUCT' OR FLID = 'CUSTOMER') AND IDICT='&INDEX&'
             IDS.CT = DCOUNT(IDS,VM)
             IF JAVA.PROC$ THEN
                IF IDS.CT = 1 THEN
                   *** We only need to check for catalog items if there is
                   *** exactly one ID being returned because in Solar
                   *** the tabs are always visible (unlike the host where
                   *** the "*** Catalog..." line in the menu table is the
                   *** only indication that the user can search for
                   *** catalog products).
                   GOSUB CHK.CATALOG
                END
             END ELSE
                IF IDS.CT > 0 THEN
                   GOSUB CHK.CATALOG
                END
             END
          CASE FLID = 'EDICT' AND IDICT='&INDEX&.NONARCH'
             INDEX.IDS.GET FLID,'&INDEX&.ARCH',WORDS,TIDS
             IF TIDS THEN
                IDS<-1> = '*** Press F10 for Archived Dictionaries ***'
             END
          END CASE
GOT.IDS:  CONVERT AM TO VM IN IDS
          IF (FLID = "PRODUCT" AND VAL.PLINES # "") THEN
             PCT = DCOUNT(IDS<1>,VM)
             FOR CT = PCT TO 1 STEP -1
                READV TST FROM PRDFILE,IDS<1,CT>,1 ELSE TST = ""
                IF TST = "" THEN CONTINUE
                READV PPLNE FROM PRDFILE,IDS<1,CT>,9 ELSE PPLNE = ""
                LOCATE PPLNE IN VAL.PLINES<1> SETTING DUMMY ELSE
                   IDS = DELETE(IDS,1,CT)
                END
             NEXT CT
          END
          IF OPTS THEN
             LD.OPTS = ''
             CK.WORDS = UPCASE(WORDS)
             IF CK.WORDS[1,6] = 'QUOTE~' THEN CK.WORDS = CK.WORDS[7,999]
             CK.WORDS = TRIM(CK.WORDS)
             O.CT = DCOUNT(OPTS,VM)
             FOR O = 1 TO O.CT
                OPT.WORD = UPCASE(OPTS<1,O>)
                IF OPT.WORD = 'NEW' OR OPT.WORD[1,9] = '*** PRESS' THEN
                   LD.OPTS<1,-1> = OPTS<1,O>
                END ELSE
                   IF INDEX(OPT.WORD,CK.WORDS,1) THEN
                      LD.OPTS<1,-1> = OPTS<1,O>
                   END
                END
             NEXT O
             IF LD.OPTS # '' THEN
                IF ID.WORD THEN
                   LOCATE WORDS IN IDS<1> SETTING POS THEN
                      IDS = WORDS
                   END ELSE
                      IDS = INSERT(IDS,1,1;LD.OPTS)
                   END
                END ELSE
                   IDS = INSERT(IDS,1,1;LD.OPTS)
                END
             END
          END

          * This is ugly but it fixes a bug in the msg system where it
          * doesn't return personal lists properly. So, if the verf
          * program is sel.msg.group, then ignore this. otherwise do it.
       *  IF CSUB # 'SEL.MSG.GROUP' THEN
       *     LOCATE WORDS IN IDS<1> SETTING POS THEN
       *        IDS = WORDS
       *     END
       *  END
          * Check the list of products to make sure user has access to
          * view each of the products,  If not the product will be
          * deleted from the list user's will see
          IF FLID = 'PRODUCT' THEN GOSUB CHK.ALLOWED.PRDS
          IF FLID = 'PDW.INDEX' THEN
             READ DIS.ALLOWED FROM CTRLFILE,'DIS.PDW.BR.AUTH.SRCH' ELSE DIS.ALLOWED = NO
             IF NOT(DIS.ALLOWED) THEN
                GOSUB CHK.ALLOWED.PRDS
             END
          END
          IF FLID[1,10] = 'ZZPROD.IDX' THEN GOSUB CHK.ALLOWED.PRDS
          IF FLID = 'CUSTOMER' THEN GOSUB CHK.CUSTS
          IF IDS  = '' THEN GOTO FINISH
          IF CSUB # "" THEN GOSUB SEL.CSUB

          IF FLID = 'GENLED' AND NOT(NEW.OK) THEN
             IF HELP OR DCOUNT(IDS,VM)#1 THEN
                READV TST FROM CTRLFILE,'GL.STRUCTURE',5 ELSE TST=''
                IF TST#'' THEN
                   CHECK.KEY 'GL.DYNAMIC.ADDITION',ENTRY.OK,LEVEL
                   IF ENTRY.OK THEN
                      IDS<1,-1> = '** Dynamic Addition **'
                   END
                END
             END
          END
          * Set this flag if the only item in the list of products that
          * match the description is 'Press F10...' allow for it to be
          * displayed instead of automatically be entered and be an
          * invalid product.
          SINGLE.OPT = ''
          IF DCOUNT(IDS,VM) < 2 THEN
             SINGLE.OPT = 1
             IF INDEX(IDS,'Press F10',1) THEN
                SINGLE.OPT = ''
             END
          END
          * If only one product meets the description entered by the user
          * do not display it in a table but automatically enter the
          * product in the OE description column
          IF (SINGLE.OPT AND NOT(NEW.OK) AND NOT(HELP)) OR JAVA.PROC$ THEN
             ID = IDS
             LASTKEY = 13
          END ELSE
             * If more than one product meets the description entered,
             * display all the product in a TABLE.MENU format
             SV.OPTION    = OPTION
INMENU:      * Still need to do the Length calculations when doing '.'
             * logic.
             IF LENGTH+0 <= 0 THEN LENGTH = 8
             IF DCOUNT(IDS,VM) < LENGTH THEN LENGTH = DCOUNT(IDS,VM)
             IF LENGTH > 20 THEN LENGTH = 20
             MENU.TABLE ID,WLEFT,WTOP,1,LENGTH,CWID,CONV,1,IDS,TITLE.OPT,ST.POS
             IF OCONV(ID,'MCU')='NEW' AND NEW.OK THEN ID=OWORDS; NEW=YES
             IF (FLID = 'VENDOR' OR FLID='PRODUCT' OR FLID='CUSTOMER') AND ID[1,14]='*** Press F10 ' THEN LASTKEY=138
             IF FLID='GENLED' THEN
                IF ID = '** Dynamic Addition **'[1,CWID] THEN
                   GL.DYNAMIC.ADDITION ID
                END
             END

             BEGIN CASE
             CASE LASTKEY = 137;     GOSUB ADDLCRI; GOTO START
             CASE LASTKEY = 138;     NULL
             CASE OPTION=0;          ID = ''
             CASE OTHERWISE;         LASTKEY = 13
             END CASE

             IF ID#'' THEN
                LAST.IDS$<1> = FLID        ;* File ID
                LAST.IDS$<2> = ID          ;* Chosen ID
                LAST.IDS$<3> = IDS         ;* List of IDs
                LAST.IDS$<4> = TITLE
                LAST.IDS$<5> = CSUB
                LAST.IDS$<6> = CONV
                LOCATE FLID IN LAST.IDS$<10> SETTING POS ELSE
                   LAST.IDS$<10,POS> = FLID
                END
                LAST.IDS$<11,POS> = ID
             END

             OPTION = SV.OPTION
          END

          GOTO FINISH
*-------------------------------------------------------------------------*
ADDLCRI:  WINDOW ,,52,1,3,,'Additional Search Criteria'
          ID = ''
          PRINT @(0,0):WORDS    "L#50":
IN$$1:    INP WORDS,0,0,50,,LEN(WORDS)+1
          WINDOW.CLOSE
          OWORDS = WORDS
          RETURN
*-------------------------------------------------------------------------*
SEL.CSUB: IF CSUB#'' THEN
             IF AUTH.BRS # ''       THEN IDS<2> = AUTH.BRS
             IF FILTER.FLAG # ''    THEN IDS<3> = FILTER.FLAG
             IF FILTER.AUTODEL # '' THEN IDS<4> = FILTER.AUTODEL
             CALL @CSUB(IDS)
             IDS = IDS<1>
          END
          RETURN
*-------------------------------------------------------------------------*
CHK.CATALOG: *** Display a prompt for user to press F10 to display
          *** products outside the user's valid product zones and to
          *** display products that are catalog index

          IF FLID = 'PRODUCT' THEN
            INDEX.IDS.GET FLID,'&INDEX&.CAT',WORDS,CIDS,YES
          END ELSE
            INDEX.IDS.GET FLID,'&INDEX&.PROS',WORDS,CIDS
          END
          C.CT = DCOUNT(CIDS,AM)

          IF CUSS(139) = 0 OR CUS(139) = 0 THEN
             CUSS(139) = ''
             CUS(139)  = ''
          END

          * Check to see if customer is allowed to view products outside
          * their valid product zones
          IF JAVA.PROC$ THEN
             IF C.CT > 0 THEN
                JAVA.PASSER$<JP.PN.HAS.CATALOG$> = 1   ;* Yes
             END ELSE
                JAVA.PASSER$<JP.PN.HAS.CATALOG$> = 0   ;* No
             END
          END ELSE
             BEGIN CASE
             CASE C.CT = 1
                IF FLID = 'PRODUCT' THEN
                   IF OUTSIDE.ZONE.OK AND ZONE.REQ AND (CUSS(139) # '' OR CUS(139) # '') THEN
                      IDS<-1> = '*** Press F10 for Products Incl. Outside Zone  ***'
                   END ELSE
                      IDS<-1> = '*** Press F10 for the following Catalog Index Entry ***'
                      IDS<-1> = CIDS
                   END
                END ELSE
                   IDS<-1> = '*** Press F10 for the following Prospect ***'
                   IDS<-1> = CIDS
                END
             CASE C.CT > 1
                IF FLID = 'PRODUCT' THEN
                   IF OUTSIDE.ZONE.OK AND ZONE.REQ AND (CUSS(139) # '' OR CUS(139) # '') THEN
                      IDS<-1> = '*** Press F10 for Prods Including Those Outside Zones  ***'
                   END ELSE
                      IDS<-1> = '*** Press F10 to List Catalog Index Entries ***'
                   END
                END ELSE
                   IDS<-1> = '*** Press F10 to List Prospects ***'
                END
             END CASE
          END
          RETURN
*-------------------------------------------------------------------------*
PRD.ZONE.CAT: *** If only one product meets the description entered by the
          *** user do not display it in a table but automatically enter the
          *** product in the OE description column
          IF (CUSS(139) = 0 OR CUS(139) = 0) THEN
             CUSS(139) = ''
             CUS(130)  = ''
          END
          IF (CUSS(139) # '' OR CUS(139) # '') AND OUTSIDE.ZONE.OK AND ZONE.REQ THEN
             IF IDS > 1 AND NOT(JAVA.PROC$) THEN
                IDS<-1> = '*** Press F10 for Catalog Prods Including Outside Zone  ***'
             END
          END
          RETURN
*-------------------------------------------------------------------------*
CHK.ALLOWED.PRDS:*
          * Check for branch specific products *
          IF FLID = 'PDW.INDEX' THEN PDW.FLAG = YES ELSE PDW.FLAG = NO
          IDS<3> = PDW.FLAG
          SEL.PRODUCT.BR IDS

          IF IDS = 'No Access' THEN
             ID = IDS
             RETURN TO FINISH
          END
          RETURN
*-------------------------------------------------------------------------*
CHK.CUSTS:*
          ID.CT = DCOUNT(IDS,VM)
          IDX = ID.CT
          IF IDS<1,ID.CT>[1,3] = '***' THEN
             IF INDEX(IDS<1,ID.CT>,'following',1) THEN
                IDS = DELETE(IDS,1,IDX)
                IDX -= 1
                ID.CT -= 1
             END
          END
          RETURN
*-------------------------------------------------------------------------*
FINISH:   BEGIN CASE
          CASE ID='' AND NOT(NOTLASTPASS) AND NOT(JAVA.PROC$)
             PRINT BELL:
          CASE NOT(JAVA.PROC$)
                IF CONV THEN
                   WORDS = ID
                   IF CONV[1,5]='CALL ' THEN
                      SUBR = CONV[6,999]
                      CALL @SUBR(WORDS)
                   END ELSE
                      WORDS = OCONV(WORDS,CONV)
                   END
                END
          CASE JAVA.PASSER$<JP.NO.CONV$>
             *** If JAVA.PASSER$<JP.NO.CONV$> is set, then the ids
             *** shouldn't be converted in FINDID because it is
             *** more efficient to conert them in JAVA.VALIDATE.INP
             *** as they are downloading.
             JAVA.PASSER$<JP.CONV.PASSER$> = CONV
          CASE OTHERWISE
             JAVA.CONV.IDS ID,CONV
          END CASE

          RETURN
!TSMITH~03/21/14~11:49
