C-----------------------------------------------------------------------
C  USPUNC -- SET NEW USER PUNCTUATION STRING
C
      SUBROUTINE USPUNC(ZPUNCT)
C
      USE USERIO
C
      CHARACTER*(*) ZPUNCT
C
      CHARACTER*1 ZNULL,ZBLANK,ZTAB
      CHARACTER*65 ZBAD
C
      DATA ZBLANK/' '/
      DATA ZTAB/'	'/
      DATA ZBAD/'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$0
     >123456789"'/
C---------------------------------------
C
      ZNULL=CHAR(0)
C
      IF(ZPUNCT.EQ.' ') THEN
        LPUNCT=0
        RETURN
      ENDIF
C
      IC=0
      ILEN=LEN(ZPUNCT)
      IF((ILEN.EQ.0).OR.(ILEN.GT.16)) GO TO 910
C
C  CHECK LEGALITY OF PASSED PUNCTUATION CHARACTERS
      DO 10 IC=1,ILEN
        IF(ZPUNCT(IC:IC).EQ.ZBLANK) GO TO 900
        IF(ZPUNCT(IC:IC).EQ.ZTAB) GO TO 900
        IF(ZPUNCT(IC:IC).EQ.ZNULL) GO TO 900
        IF(INDEX(ZBAD,ZPUNCT(IC:IC)).NE.0) GO TO 900
 10   CONTINUE
C
      LPUNCT=ILEN
      UPUNCT=ZPUNCT
      RETURN
C
C------------
C  ERRORS
C
 900  CONTINUE
      WRITE(LUNTRM,9001) ZPUNCT,IC
 9001 FORMAT('?USPUNC -- ILLEGAL CHARACTER FOR PUNCTUATION'/
     >'  INPUT STRING IS "',A,'" AT CHARACTER POSITION ',I2)
      RETURN
C
 910  CONTINUE
      WRITE(LUNTRM,9101) ILEN
 9101 FORMAT(' ?USPUNC -- ARGUMENT LENGTH ERROR, ILEN=',I10)
      RETURN
      END
