C     SIMPLE SINGLE-SERVER QUEUE SIMULATION IN GASP
      PROGRAM QUEUE
      COMMON/GCM1/ATRIB(20),DD(20),DDL(20),DTNOW,I,MFA,MFE,MSTOP,
     1NCLNR,NCRDR,NPRNT,NNRUN,NNSET,NTAPE,SS(20),SSL(20),TNOW,XX(20)
      DIMENSION NSET(50),QSET(50)

C     INITIALIZE SIMULATION
      CALL GASP

C     SET SIMULATION PARAMETERS
      TNOW = 0.0
      MSTOP = 1000

C     SCHEDULE FIRST ARRIVAL
      CALL SCDHL(1,0.0,ATRIB)

C     RUN SIMULATION
      CALL SIMUL

C     OUTPUT RESULTS
      WRITE(NPRNT,100)
  100 FORMAT('SIMULATION COMPLETE')

      STOP
      END

C     EVENT ROUTINE - ARRIVAL
      SUBROUTINE EVENT(I)
      COMMON/GCM1/ATRIB(20),DD(20),DDL(20),DTNOW,I,MFA,MFE,MSTOP,
     1NCLNR,NCRDR,NPRNT,NNRUN,NNSET,NTAPE,SS(20),SSL(20),TNOW,XX(20)

      GO TO (10,20),I

C     ARRIVAL EVENT
   10 CONTINUE
      CALL FILEM(1,ATRIB)
      IF(NNQ(1).EQ.1) CALL SCDHL(2,0.0,ATRIB)
      CALL SCDHL(1,EXPON(10.0,1),ATRIB)
      RETURN

C     DEPARTURE EVENT
   20 CONTINUE
      CALL REMOV(1,ATRIB)
      IF(NNQ(1).GT.0) CALL SCDHL(2,GASP(5.0,2),ATRIB)
      RETURN
      END
