      REM PLIP-RPC-KEY
*PIC-LAN
*
*ALL
*PC
*N
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
      INCLUDE PL.INIT.INCLUDE
*
      PRINT 'This utility will generate a DES key and place it into the'
      PRINT 'PLIP.CTRL CONFIG item.'
      PRINT
      PRINT 'Enter DES key strength (0,1,3) : ' :
*
      INPUT ANS
*
      BEGIN CASE
         CASE ANS = '0'
         CASE ANS = '1'
         CASE ANS = '3'
         CASE YES
            PRINT 'Invalid entry.'
            STOP
      END CASE
*
      LL = ANS * 8
*
      KEY.STR = ''
      FOR I = 1 TO LL
         KEY.STR = KEY.STR : OCONV(RND(256),'MCDX') 'R%2'
      NEXT I
*
      OPEN 'PLIP.CTRL' TO CTRL.FD ELSE STOP 201,'PLIP.CTRL'
*
      READ DD FROM CTRL.FD , 'CONFIG' ELSE STOP 202,'CONFIG'
*
      I1 = DCOUNT(DD,AM)
      FLG = NO
      FOR I = 1 TO I1 UNTIL FLG
         D = DD<I>
         W = TRIM(FIELD(D,'=',1))
         IF W = 'RPC KEY' THEN
            DD<I> = 'RPC KEY=' : KEY.STR
            FLG = YES
         END
      NEXT I
*
      IF NOT(FLG) THEN
         DD<-1> = 'RPC KEY=' : KEY.STR
      END
*
      WRITE DD ON CTRL.FD , 'CONFIG'
   END
