
                                                                26-Mar-1991 15:55:09	VAX FORTRAN V5.5-98                 Page   1
                                                                12-Feb-1991 19:28:43	LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.FOR;24   

0001    	OPTIONS/EXTEND
0002    	PROGRAM BMS_EXEC
0003    C
0004    C
0005    C *************************************
0006    C
0007    C PURPOSE:  CHECKS FOR NEW MAIL DELIVERED TO THE 'LIFEMAIL' ACCOUNT.
0008    C	    IF NEW MAIL EXIST OR IF MAIL STILL EXIST IN THE TEMPORARY
0009    C	    HOLDING FOLDER, THEN THE SYSTEM PROCESSES THE MAIL AS
0010    C	    REQUIRED.  PROCESSING REQUIREMENT ARE DETERMINED BY THE
0011    C	    BMS_MAIL MODULE TO THIS PROGRAM.
0012    C
0013    C **
0014    C	DECLARE LOCAL VARIABLES
0015    C
0016    	INTEGER*4	RZONE, MAILDIR(2), UNRCNT, RL, NEWCNT
0017    	CHARACTER	MAILFILE*64, USRNM*12, USRLOC*64
0018    	CHARACTER	LOCTIME*7, FULTIME*17, WAIT*9
0019    	LOGICAL		DO_WORK
0020    C
0021    	INTEGER*4 DT(2)        ! Timer values
0022    	INTEGER*4	SYS$BINTIM, SYS$SCHDWK, SYS$HIBER
0023    C
0024    C **  INCLUDE GLOBAL COMMON DECLARATIONS FOR PASSING DATA.
0025    C
0026    	INCLUDE	'LIFE_DEV:REMD$DEC.INC/NOLIST'
0449    C
0450    	EXTERNAL	REMD$MAIL_OPEN, REMD$MAIL_SELECT, REMD$MAIL_CLOSE
0451    C
0452    C **  DEFINE LOGICAL TO KEEP LOOP MOVING.
0453    C
0454    	DO_WORK = .TRUE.
0455    C
0456    C **  TIME TO WAIT BETWEEN RUNS.
0457    C
0458    	WAIT = '0 :15:0.0'
0459    	ISTATUS= SYS$BINTIM( WAIT, DT )
0460    C
0461    C **  OPEN A NEW LOGFILE FOR THIS RUN.
0462    C
0463    	OPEN(UNIT=18, FILE='BMS_LOG', CARRIAGECONTROL='LIST',
0464         &		SHARED, FORM='FORMATTED', TYPE='UNKNOWN', ACCESS='APPEND',
0465         &		ORGANIZATION='SEQUENTIAL', RECORDTYPE='VARIABLE' )
0466    C
0467    C **  WRITE OUT DATE TIME LOGFILE WAS INITIALIZED.
0468    C
0469    	CALL LIFE$STR_TIME( LOCTIME, FULTIME )
0470    	WRITE(18,1000) FULTIME
0471    C
0472    	CLOSE(UNIT=18)
0473    C
0474    C **  BEGIN THE OPERATIONAL LOOP.
0475    C
0476    	DO WHILE (DO_WORK)
0477    C
0478    C **  OPEN THE LOGFILE FOR NEXT TIME PERIOD.
0479    C

BMS_EXEC                                                        26-Mar-1991 15:55:09	VAX FORTRAN V5.5-98                 Page   2
                                                                12-Feb-1991 19:28:43	LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.FOR;24   

0480    		OPEN(UNIT=18, FILE='BMS_LOG', CARRIAGECONTROL='LIST',
0481         &		    SHARED, FORM='FORMATTED', TYPE='UNKNOWN', ACCESS='APPEND',
0482         &		    ORGANIZATION='SEQUENTIAL', RECORDTYPE='VARIABLE' )
0483    C
0484    		OPEN(UNIT=19, FILE='BMS_USERS', CARRIAGECONTROL='LIST',
0485         &		    ACCESS='SEQUENTIAL', FORM='FORMATTED',  TYPE='OLD',
0486         &		    SHARED, ORGANIZATION='SEQUENTIAL', RECORDTYPE='VARIABLE' )
0487    C
0488    C **  GET THE FIRST USERS NAME.
0489    C
0490    200		READ(19,2000,END=7000) RL, USRNM, USRLOC
0491    2000	FORMAT(Q,A12,A64)
0492    C
0493    		RL = RL - 12
0494    C
0495    C **  GENERATE THE MAIL FILE NAME
0496    C
0497    		MAIL_DATA.MAILFILE = USRLOC(1:RL)//'MAIL.MAI'//' '
0498    		MAIL_DATA.ML = RL + 8
0499    C
0500    C **  OPEN THE READ MAIL CONTEX.
0501    C
0502    		CALL REMD$MAIL_OPEN( MAIL_DATA )
0503    C
0504    C **  GET THE CURRENT COUNT IN THE TEMPORARY NEWMAIL FOLDER.
0505    C
0506    		MAIL_DATA.FOLDER = 'NEW_TEMP_MAIL'
0507    		MAIL_DATA.FL = 13
0508    C
0509    		CALL REMD$MAIL_SELECT( UNRCNT, MAIL_DATA )
0510    C
0511    C **  GET THE CURRENT COUNT IN THE NEWMAIL FOLDER.
0512    C
0513    		MAIL_DATA.FOLDER = 'NEWMAIL'
0514    		MAIL_DATA.FL = 7
0515    C
0516    		CALL REMD$MAIL_SELECT( NEWCNT, MAIL_DATA )
0517    C
0518    C **  TOTAL UP THE TOTAL POSSIBLE MESSAGES.
0519    C
0520    		NUM_MAIL = NEWCNT + UNRCNT
0521    C
0522    		IF (NUM_MAIL .GT. 0) THEN
0523    C
0524    			WRITE(18,2500) USRNM, NUM_MAIL
0525    2500	FORMAT('%BMS-FOUND, MAIL FOUND FOR:  ',A12,', COUNT = ',I3)
0526    C
0527    C **  CALCULATE THE AMOUNT OF VIRTUAL MEMORY NEEDED BY ROUTINE.
0528    C
0529    			MEM_NEED = (NUM_MAIL+2)*128
0530    			IMEM = (MEM_NEED/512) + 1
0531    C
0532    C **  CREATE THE VIRTUAL MEMORY ZONE.
0533    C
0534    			ISTAT = LIB$CREATE_VM_ZONE( RZONE,,,,32,IMEM,128 )
0535    			IF (.NOT. ISTAT) CALL LIB$SIGNAL(%VAL(ISTAT))
0536    C

BMS_EXEC                                                        26-Mar-1991 15:55:09	VAX FORTRAN V5.5-98                 Page   3
                                                                12-Feb-1991 19:28:43	LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.FOR;24   

0537    C **  ALLOCATE THE VIRTURAL MEMORY.
0538    C
0539    			ISTAT = LIB$GET_VM( MEM_NEED, MEM_ADDR, RZONE )
0540    			IF (.NOT. ISTAT) CALL LIB$SIGNAL(%VAL(ISTAT))
0541    C
0542    C **  DECLARE THE ADDRESS SPACE FOR THE VIRTUAL MEMORY.
0543    C
0544    			MAILDIR(1) = MEM_NEED
0545    			MAILDIR(2) = MEM_ADDR
0546    C
0547    C **  CALL THE READ MAIL ROUTINE, PASS THE TOTAL NUMBER OF MAIL MESSAGES,
0548    C **  AND THE ADDRESS OF THE VIRTUAL MEMORY STARTING ADDRESS.
0549    C
0550    			CALL BMS_MAIL( MAIL_DATA, USRNM, MAILDIR, NUM_MAIL, NEWCNT )
0551    C
0552    C **  WE ARE DONE WITH THE VIRTUAL MEMORY REQUIRED, FREE IT UP.
0553    C
0554    			ISTAT = LIB$FREE_VM( MEM_NEED, MEM_ADDR, RZONE )
0555    			IF (.NOT. ISTAT) CALL LIB$SIGNAL(%VAL(ISTAT))
0556    C
0557    C **  RESET THE VIRTUAL MEMORY ZONE.
0558    C
0559    			ISTAT = LIB$RESET_VM_ZONE( RZONE )
0560    			IF (.NOT. ISTAT) CALL LIB$SIGNAL(%VAL(ISTAT))
0561    C
0562    C **  DELETE THE VIRTUAL MEMORY ZONE.
0563    C
0564    			ISTAT = LIB$DELETE_VM_ZONE( RZONE )
0565    			IF (.NOT. ISTAT) CALL LIB$SIGNAL(%VAL(ISTAT))
0566    C
0567    		ENDIF
0568    C
0569    C **  CLOSE THE READ MAIL CONTEX.
0570    C
0571    		CALL REMD$MAIL_CLOSE( MAIL_DATA )
0572    C
0573    		GOTO 200
0574    C
0575    7000		CLOSE(UNIT=18)
0576    		CLOSE(UNIT=19)
0577    C
0578    C **  CHECK TIME OF DAY, EXIT PROGRAM AT 11PM.
0579    C
0580    		CALL LIFE$STR_TIME( LOCTIME, FULTIME )
0581    		IF (LOCTIME(2:3) .NE. '23') THEN
0582    C
0583    C **  SCHEDULE WAKEUP TIME
0584    C
0585    			ISTATUS = SYS$SCHDWK(,,DT,)
0586    C
0587    C **  GO TO SLEEP FOR SCHEDULED PERIOD.
0588    C
0589    			ISTATUS = SYS$HIBER()
0590    C
0591    C **  DEFINE PROGRAM EXIT FLAG.
0592    C
0593    		ELSE

BMS_EXEC                                                        26-Mar-1991 15:55:09	VAX FORTRAN V5.5-98                 Page   4
                                                                12-Feb-1991 19:28:43	LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.FOR;24   

0594    C
0595    			DO_WORK = .FALSE.
0596    C
0597    		ENDIF
0598    C
0599    	ENDDO
0600    C
0601    1000	FORMAT('INITIALIZE BMS LOGGING:  ',A17)
0602    C
0603    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  644   PIC CON REL LCL   SHR   EXE   RD NOWRT QUAD
  1 $PDATA                                 150   PIC CON REL LCL   SHR NOEXE   RD NOWRT QUAD
  2 $LOCAL                                 764   PIC CON REL LCL NOSHR NOEXE   RD   WRT QUAD

    Total Space Allocated                 1558


ENTRY POINTS

    Address  Type  Name          

  0-00000000       BMS_EXEC      


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

      **      L*4  DO_WORK         2-000000DF  CHAR FULTIME         2-00000114  I*4  IMEM                **      I*4  ISTAT         
      **      I*4  ISTATUS         2-000000D8  CHAR LOCTIME             **      CHAR MAILFILE        2-00000118  I*4  MEM_ADDR      
  2-00000110  I*4  MEM_NEED        2-00000108  I*4  NEWCNT          2-0000010C  I*4  NUM_MAIL        2-00000104  I*4  RL            
  2-000000FC  I*4  RZONE           2-00000100  I*4  UNRCNT          2-00000098  CHAR USRLOC          2-0000008C  CHAR USRNM         
  2-000000F0  CHAR WAIT          


RECORDS

    Address   Name          Structure           Bytes

  2-00000010  MAIL_DATA     MAIL_INFO             123


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  2-00000008  I*4  DT                      8  (2)
  2-00000000  I*4  MAILDIR                 8  (2)

BMS_EXEC                                                        26-Mar-1991 15:55:09	VAX FORTRAN V5.5-98                 Page   5
01                                                              12-Feb-1991 19:28:43	LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.FOR;24   

LABELS

    Address   Label       Address   Label       Address   Label       Address   Label       Address   Label   

  0-00000070  200       1-00000050  1000'     1-0000001A  2000'     1-00000020  2500'     0-0000023C  7000    


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

        BMS_MAIL                                FOR$CLOSE                               FOR$OPEN                        
   I*4  LIB$CREATE_VM_ZONE                 I*4  LIB$DELETE_VM_ZONE                 I*4  LIB$FREE_VM                     
   I*4  LIB$GET_VM                         I*4  LIB$RESET_VM_ZONE                       LIB$SIGNAL                      
        LIFE$STR_TIME                           REMD$MAIL_CLOSE                         REMD$MAIL_OPEN                  
        REMD$MAIL_SELECT                   I*4  SYS$BINTIM                         I*4  SYS$HIBER                       
   I*4  SYS$SCHDWK                      


OPTIONS QUALIFIERS

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /EXTEND_SOURCE  /F77  /NOG_FLOATING  /I4


COMMAND QUALIFIERS

  FOR/LIST/SHOW/EXTEND BMS_EXEC

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /DESIGN=(NOCOMMENTS,NOPLACEHOLDERS)
  /SHOW=(DICTIONARY,INCLUDE,MAP,PREPROCESSOR,SINGLE)
  /STANDARD=(NOSEMANTIC,NOSOURCE_FORM,NOSYNTAX)
  /WARNINGS=(NODECLARATIONS,GENERAL,NOULTRIX,NOVAXELN)
  /CONTINUATIONS=19  /NOCROSS_REFERENCE  /NOD_LINES  /EXTEND_SOURCE
  /F77  /NOG_FLOATING  /I4  /NOMACHINE_CODE  /OPTIMIZE  /NOPARALLEL
  /NOANALYSIS_DATA
  /NODIAGNOSTICS
  /LIST=LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.LIS;30                                                           
  /OBJECT=LIB4:[LIFENET.REMMAIL.BMS]BMS_EXEC.OBJ;31                                                           


COMPILATION STATISTICS

  Run Time:           2.78 seconds
  Elapsed Time:       3.69 seconds
  Page Faults:        936
  Dynamic Memory:     972 pages
