$CDS ON 
      SUBROUTINE CLONE
      STOP 'CLONE DANS GRAPH.FTN !' 
      END 
  
      INTEGER FUNCTION Get_acct_id()
      INTEGER OwnerToId 
      CHARACTER*16 USER 
      CALL USNAM(USER)
      Get_acct_id=OwnerToId(USER) 
      END 
  
      SUBROUTINE SpiceRunProgram(ICC,IERR)
      PARAMETER (NBMOTS=60,NBCARMAX=2*NBMOTS) 
      CHARACTER*(NBCARMAX) C
      CHARACTER*6 RUNNAME 
      INTEGER ICC(*),IC(NBMOTS),PARM(5),FmpRunProgram 
      EQUIVALENCE (C,IC)
      IF(IERR.LE.0.OR.IERR.GT.NBCARMAX) THEN
        WRITE(1,*) 'IERR,NBCARMAX=',IERR,NBCARMAX 
        STOP 'SpiceRunProgram !'
      ENDIF 
      DO I=1,(IERR+1)/2 
        IC(I)=ICC(I)
      ENDDO 
      IF(IERR.LT.NBCARMAX) C(IERR+1:NBCARMAX)=' ' 
      IERR=FmpRunProgram(C,PARM,RUNNAME)
      IF(IERR.LT.0) THEN
        CALL FmpReportError(IERR,C(4:22)) 
        IF(PARM(1).LT.0) THEN 
          CALL EXEC(2,1,18HProgram aborted :_,-18)
          CALL EXEC(2,1,PARM(2),4)
        ENDIF 
      ENDIF 
      END 
      SUBROUTINE OPEN_RM(DCB,IERR,IFICH0,IOPTION,ISECU,ICR,IDCBS) 
      SAVE ITYPE,LRECL
      PARAMETER (NBMOTS=32) 
      INTEGER DCB(*),IFICH(NBMOTS),IFICH0(32),FmpOpen,ISIZE(2),PCOUNT 
      CHARACTER*(2*NBMOTS) FICH 
      CHARACTER*5 OPTIONS,IntToDecimal
      LOGICAL LCREAT
      EQUIVALENCE (FICH,IFICH)
      NBARG=PCOUNT()
      IF(NBCOUNT.GT.6) THEN 
        NBDCB=IDCBS 
      ELSE
        NBDCB=1 
      ENDIF 
C     WRITE(1,*) '&dDOPEN_RM&d@ : ICR=',ICR,' PCOUNT=',NBARG
      LCREAT=.FALSE.
      NBDCB=1 
      IF(IOPTION.EQ.0) THEN 
        OPTIONS='RWO' 
      ELSE
        OPTIONS='RWOS'
        IF(IOPTION.NE.1) WRITE(1,*) 'Attention : IOPTION#0 ou 1 !!!'
      ENDIF 
      GOTO 10 
  
      ENTRY CREAT_RM(DCB,IERR,IFICH0,ISIZE,ITYPE0,ISECU,ICR,IRECL)
      NBARG=PCOUNT()
C     WRITE(1,*) '&dDCREAT_RM&d@ : ICR=',ICR,' IDCBS=',IDCBS, 
C    1  ' PCOUNT=',NBARG,' ITYPE=',ITYPE0 
      LCREAT=.TRUE. 
      NBDCB=1 
      LRECL=IRECL 
      OPTIONS='RWC' 
      ITYPE=ITYPE0
  
10    FICH=' '
      DO I=1,NBMOTS 
        IFICH(I)=IFICH0(I)
      ENDDO 
      IF(LCREAT) THEN 
        LFICH=LONG(FICH)
        FICH(LFICH+1:LFICH+8)=':::'//IntToDecimal(ITYPE)
        IS=ISIZE(1) 
        IF(IS.EQ.-1) THEN 
          LFICH=LONG(FICH)
          FICH(LFICH+1:LFICH+6)=':'//IntToDecimal(24) 
          WRITE(1,*) 'ISIZE(1)=-1 DANS CREAT_RM !' 
        ELSE
          LFICH=LONG(FICH)
          FICH(LFICH+1:LFICH+6)=':'//IntToDecimal(IS) 
        ENDIF 
        IF(ITYPE.EQ.2) THEN 
          LFICH=LONG(FICH)
          FICH(LFICH+1:LFICH+6)=':'//IntToDecimal(LRECL)
        ENDIF 
      ENDIF 
  
      IF(.NOT.LCREAT) CALL FmpRecordLen(FICH,LRECL) 
      ITYPE=FmpOpen(DCB,IERR,FICH,OPTIONS,NBDCB)
      RETURN
      ENTRY LOCF_RM(DCB,IERR,ID1,ID2,ID3,ID4,LU_NUM,IFILETYPE,
     1      IRECLEN)
      NBARG=PCOUNT()
      IF(NBARG.GE.7) LU_NUM=0 
      IF(NBARG.GE.8) IFILETYPE=ITYPE
      IF(NBARG.GE.9) IRECLEN=LRECL
      IERR=0
      END 
      SUBROUTINE CLOSE_RM(DCB,IERR,ITRUN) 
      CALL FmpClose(DCB,IERR) 
      END 
      SUBROUTINE PURGE_RM(DCB,IERR,NAME,ISECU,ICR)
      PARAMETER (NBMOTS=32) 
      INTEGER NAME(3),IFICH(NBMOTS),FmpPurge,PCOUNT 
      CHARACTER*(2*NBMOTS) FICH 
      EQUIVALENCE (IFICH,FICH)
      NBARG=PCOUNT()
      FICH=' '
      DO I=1,NBMOTS 
        IFICH(I)=NAME(I)
      ENDDO 
      CALL FmpClose(DCB,IERR) 
      IERR=FmpPurge(FICH) 
      END 
      FUNCTION LONG(S)
     +    ,PRINTER(RM) <890405.1036>
      CHARACTER*(*) S 
      INTEGER TrimLen 
      LONG=MAX(1,TrimLen(S))
      END 
      SUBROUTINE WAIT_FOR_RETURN(IRET,MSG)
     +    ,ROUTINES(RM) <890405.1036> 
      INTEGER PCOUNT
      CHARACTER*1 REP 
      CHARACTER*(*) MSG 
      NBARG=PCOUNT()
      GOTO (10,20,30) NBARG+1 
10    WRITE(1,'("RETURN pour continuer :_")') 
      GOTO 40 
20    WRITE(1,'("RETURN pour continuer,A pour Arreter :_")')
      GOTO 40 
30    WRITE(1,'(A)') MSG
40    REP='A' 
      READ(1,'(A)',END=50) REP
      GOTO 60 
50    WRITE(1,'(" ")')
60    WRITE(1,'("AKA")') 
      IF(NBARG.GT.0) THEN 
        IF(REP.EQ.' ') THEN 
          IRET=0
        ELSE
          CALL CaseFold(REP)
          IRET=-ICHAR(REP)
        ENDIF 
      ENDIF 
      END 
