DEFINT A-Z
'$DYNAMIC
DECLARE FUNCTION ConsistsOfHexDigits% ()
DIM SHARED History&(0 TO 16383)

DIM SHARED This$
OPEN COMMAND$ FOR INPUT AS #1
DO
TOP:
 IF SEEK(1) >= LOF(1) THEN GOTO PrintResults
 LINE INPUT #1, A$
 IF "call" = MID$(A$, 36, 4) THEN
   Curr$ = MID$(A$, 43, 6)
   This$ = Curr$
   IF ConsistsOfHexDigits THEN
     This$ = MID$(A$, 43, 8)
     IF ConsistsOfHexDigits THEN
       Curr$ = This$
     END IF
     CurrNum& = VAL("&H" + Curr$)
     IF HistoryCount% = 0 THEN
        History&(0) = CurrNum&
        HistoryCount% = HistoryCount% + 1
        GOTO TOP
     END IF
     FOR I% = 0 TO HistoryCount% - 1
       IF History&(I%) = CurrNum& THEN
         
         GOTO TOP
       END IF
     NEXT I%
     History&(HistoryCount%) = CurrNum&
     HistoryCount% = HistoryCount% + 1
   END IF
 END IF
LOOP
PrintResults:
 PRINT HistoryCount%

REM $STATIC
FUNCTION ConsistsOfHexDigits%
    IF LEN(This$) = 0 THEN EXIT FUNCTION
    FOR I% = 1 TO LEN(This$)
     IF INSTR("0123456789abcdefABCDEF", MID$(This$, I%, 1)) = 0 THEN
        ConsistsOfHexDigits% = 0
        EXIT FUNCTION
     END IF
    NEXT
    ConsistsOfHexDigits% = -1
END FUNCTION

