*
* $Id$
*
* $Log$
* Revision 1.1  1996/02/15 17:54:17  mclareni
* Initial revision
*
*
#include "sys/CERNLIB_machine.h"
#include "pilot.h"
      PROGRAM AKMULT
C
C CERN PROGLIB#         AKMULT          .VERSION KERNVAX  2.30  881021
C ORIG. 28/06/82 M.L.LUVISETTO, CNAF BOLOGNA
C MOD.  30/06/82 JZ
C
C     SPLIT MULTI-ROUTINES MACRO FILES
C
C--     THE FOLLOWING FILES ARE INVOLVED :

C     AKMUIN.MAR   THE MULTI-ROUTINE INPUT FILE, EACH ROUTINE
C                  MUST START WITH A LINE '.TITLE' IN COL 2 !

C     AKMUEX.MAR   RECEIVES THE FIRST ROUTINE
C     AKM0JJ.MAR   RECEIVES ROUTINE NUMBER JJ
C
C     AKMUEX.COM   IS THE COM-FILE TO ASSEMBLE ALL ROUTINES
C                  ONTO AKMUEX.OBJ
C
      CHARACTER LINE*80
     +,FLN*12     /'AKM000.MAR'/
     +,BEGRUT*8   /' .TITLE '/
     +,ENDLINE*80 /'        .END'/
     +,MAC_COM*80 /'$ MACRO   AKMUEX'/
     +,APD_COM*80 /'$ APPEND  AKM000.OBJ  AKMUEX.OBJ'/
     +,DEL_COM*80 /'$ DELETE  AKM0*.*;*,AKMUEX.MAR;*/NOLOG/NOCONF'/
C                   ....+....1....+....2....+....3
      PARAMETER (LUNIN=1 , LUNOUT=2 , LUNCOM=33)
      DATA  NEOF / 0 /,   JFILE / 1 /
C
 8000 FORMAT (A)
C

      TYPE 9001
 9001 FORMAT ('   AKMULT EXECUTION USES :'/
     +'    INPUT FILE  AKMUIN.MAR  WITH  .TITLE IN COL 2 !'/
     +'   OUTPUT FILE  AKMUEX.COM  TO EXECUTE ASSEMBLIES ONTO'/
     +'   RESULT FILE  AKMUEX.OBJ')

      OPEN (UNIT=LUNIN,FILE='AKMUIN.MAR',TYPE='OLD',READONLY)
      OPEN (UNIT=LUNCOM,FILE='AKMUEX.COM',TYPE='NEW'
     +,                 CARRIAGECONTROL='NONE')

   22 READ(LUNIN,8000,END=99) LINE
      IF (LINE(1:8).NE.BEGRUT) GO TO 22
      OPEN (UNIT=LUNOUT,FILE='AKMUEX.MAR',TYPE='NEW'
     +,                 CARRIAGECONTROL='NONE')
      WRITE(LUNCOM,8000) MAC_COM
      GO TO 43

   31 JFILE = JFILE+1
      NUNI  = MOD(JFILE,10)
      NTEN  = JFILE/10
      FLN(5:6)=CHAR(NTEN+48)//CHAR(NUNI+48)
      OPEN (UNIT=LUNOUT,FILE=FLN,TYPE='NEW',CARRIAGECONTROL='NONE')
      MAC_COM(10:30)=FLN(1:6)
      APD_COM(11:16)=FLN(1:6)
      WRITE(LUNCOM,8000) MAC_COM
      WRITE(LUNCOM,8000) APD_COM
      GO TO 43

   41 READ(LUNIN,8000,END=46) LINE
      IF (LINE(1:8).EQ.BEGRUT) GO TO 47
   43 WRITE(LUNOUT,8000) LINE
      GO TO 41

   46 NEOF = 7
   47 WRITE(LUNOUT,8000) ENDLINE
      CLOSE(LUNOUT)
      IF (NEOF.EQ.0)         GO TO 31

  99  WRITE(LUNCOM,8000) DEL_COM
      STOP
      END
