home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol266 / endsv3.for < prev    next >
Encoding:
Text File  |  1986-05-19  |  2.5 KB  |  74 lines

  1.         SUBROUTINE      ENDSV(NSET)
  2. C////////////////////////////////////////////////////////////////
  3. C/                                                              /
  4. C/      Program-id.     ENDSV                                   /
  5. C/      Date-written.   Jan. 23rd 1984                /
  6. C/      File-name.      ENDSV3.FOR                              /
  7. C/      Remarks.        Subroutine ENDSV page 126               /
  8. C/            In ENDSV(End_of_Service) it is first    /
  9. C/            necessary to collect statiscal infor-    /
  10. C/            mation about the item completing     /
  11. C/            processing.                /
  12. C/            This is the version for Examle 3.    /
  13. C/                                                              /
  14. C////////////////////////////////////////////////////////////////
  15. C
  16. C    * Default size of INTEGER = 2 bytes in F80
  17. C       
  18.         INTEGER*4       NSET(6,1)
  19. C
  20.       COMMON /C1/ID,IM,INIT,JEVNT,JMNIT,MFA,MSTOP,MX,MXC,NCLCT,NHIST,
  21.      1           NOQ,NORPT,NOT,NPRMS,NRUN,NRUNS,NSTAT,OUT,SCALE,ISEED,
  22.      2           TNOW,TBEG,TFIN,MXX,NPRNT,NCRDR,NEP,VNQ(4)
  23. C
  24.       COMMON /C2/ATRIB(4),ENQ(4),INN(4),JCELS(5,22),KRANK(4),MAXNQ(4),
  25.      1           MFE(4),MLC(4),MLE(4),NCELS(5),NQ(4),PARAM(20,4),
  26.      2           QTIME(4),SSUMA(10,5),SUMA(10,5),NAME(6),NPROJ,MON,
  27.      3         NDAY,NYR,JCLR
  28. C
  29.     COMMON /C3/ XISYS,BUS
  30. C
  31. C    --- Compute time in system equal to current time minus arrival
  32. C        time of customer finishing service. Cmpute statistics on
  33. C        in system.
  34. C
  35.     TISYS = TNOW - ATRIB(3)
  36.     CALL    COLCT(TISYS,1,NSET)
  37.     CALL    HISTO(TISYS,2.0,1.0,1)
  38. C
  39. C    --- Since a customer will depart from the system due to the
  40. C        end of service collect ststistics on number in system
  41. C        and decrement the number in the system by one.
  42. C
  43.     CALL    TMST(XISYS,TNOW,1,NSET)
  44.     XISYS = XISYS - 1.0
  45. C
  46. C    --- Test to see if customer are waiting for service. If none
  47. C        collect statistics on the busy time of the server and set
  48. C        his status to idle by making bus equal zero.
  49. C        If customer are waiting for service remove first customer
  50. C        from the queue of the server which is file two.
  51. C
  52.     IF (NQ(2)) 7,8,9
  53.     7    CALL    ERROR(41,NSET)
  54.     RETURN
  55. C
  56.     8    CALL    TMST(BUS,TNOW,2,NSET)
  57.     BUS = 0.0
  58.     RETURN
  59. C
  60.     9    CALL     RMOVE(MFE(2),2,NSET)
  61. C
  62. C    --- Compute waiting time of customer and collect statistics
  63. C        on waiting time. Put customer in service by scheduling
  64. C        and end of service event for the customer.
  65. C
  66.     WT = TNOW - ATRIB(3)
  67.     CALL    COLCT(WT,2,NSET)
  68.     CALL    DRAND(ISEED,RNUM)
  69.     ATRIB(1) = TNOW - PARAM(2,1) * ALOG(RNUM)
  70.     ATRIB(2) = 2.0
  71.     CALL    FILEM(1,NSET)
  72.     RETURN
  73.     END
  74.