FUNCTION MskExpLev, idx, expMode=expMode, expLev=expLev
;   ------------------------------------------------------------
;   -----------------------------------------------------------
;   ON_ERROR, 2 ;force a return to caller on error

    expMode = KEYWORD_SET(expMode)
    expLev  = KEYWORD_SET(expLev)

    CASE (1) OF
      (expMode):    a = idx AND 192b    ;mask-out all but 6&7
      (expLev): a = idx AND 63b     ;mask-out all but 0,1,2,3,4,5
      ELSE: BEGIN
          a = 0
          print, '**** MskExpLev--error incorrect input'
        END
    ENDCASE
    
    RETURN, a
    END