ASEARCH SUBROUTINEA%X;* CONVERSION SEARCH SUBROUTINE *X;A BASIC USR ROUTINE(AX;INDEX=USR(ADR(SUBR),COUNT,ADR(TABLE),ADR(UNITS),LEN(UNITS$))2X;<X;Variable length recordsF"X;Records terminated with commaPX;Checks for trailing "S"ZX;dnTBLL;;TABLE ADDRESS LOxTBLH;; HI BYTEUNITSL;;UNITS STRING LOUNITSH;; HI BYTERECNUM;;RECORD NUM INDEXNCHARS;;CHARS IN STRINGCOUNTL;;RECORD COUNT LOCOUNTH;; HI BYTEX;77PCOUNTH;;FETCH ARGUMENTS7;; FROM STACK PCOUNTL7 PTBLH7 PTBLL"7, PUNITSH67@ PUNITSLJ7;;(IGNORE HI BYTE)T7^ PNCHARShQ>r PRECNUM|LOOP1%>;;USE Y AS INDEXLOOP2Q@UNITSL7R@TBLL7;;COMPARE CHARSHSE1;;NO MATCH, DONE?3;;CHARACTERS MATCH Q@TBLL7R> ,;';END OF RECORD?FSE2;; YES, COMP LEN)NCHARS;; NO, ALL TRIED?GLOOP2;; NOSE1QRECNUMRCOUNTL;;LAST RECORD?HLOOP3;; NO, NEXT RECORDQ>;; YES, COUNT=0PCOUNTL;; NO MATCH:;;RETURN TO BASICLOOP33;;INC CHARACTER INDEX& Q@TBLL70R> ,;';FIND NEXT COMMA: HLOOP3?3DCN,XOTBLL;;ADVANCE POINTERbPTBLL;; TO NEXT RECORDvD ;;IF PAGE CROSSED#TBLH;; INCREMENT HI #RECNUM, DLOOP1SE2)NCHARS;;LENGTHS EQUAL?FEXIT;; YES.3;;LONGER BY 1? )NCHARS HSE3;; NO 1;; YES Q@UNITSL7R> S;';LAST CHAR AN S?FEXIT;; YES.SE3%>;;RESET INDEX FSE1;;GO SEE IF DONEEXITQRECNUM;;MATCH FOUND PCOUNTL;;PASS REC COUNT*:;; AS RETURN ARG