      PROGRAM SET_NAME
C
C     This program asks the user to supply a
C        new process name and sets it for them.
C
      INTEGER*4 SYS$SETPRN
      EXTERNAL SS$_DUPLNAM
C     15 is max length for a process name 
      CHARACTER*15 NAME    
C     Find out what name they want
10    TYPE *,'Desired process name : '
      ACCEPT 100,L,NAME
100   FORMAT(Q,A)
C     Attempt to set new name
C     We must save the result to see if
C     this name is already used.
      I = SYS$SETPRN(NAME(1:L))  
      IF(I.EQ.%LOC(SS$_DUPLNAM))THEN   
         TYPE *,'That name is already in use.'
         GOTO 10
      END IF
C     Any other errors are fatal.
      CALL IFERR(I)
C     If no error, tell them it worked.
      TYPE *,'Your new process name is '
     &   //NAME(1:L)
      STOP
      END
