
                                                                26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   1
                                                                12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

0001    	OPTIONS/EXTEND
0002    	SUBROUTINE BMS_MAIL( MAIL_DATA, USRNM, MAILDIR, NUMMSG, NEWMCNT )
0003    C
0004    C *************************************
0005    C
0006    C PURPOSE:  
0007    C
0008    C **  MAILDIR  = VIRTUAL MEMORY ARRAY FOR STORAGE OF MAIL DIRECTORY INFORMATION.	ADDRESS PASSED IN.
0009    C **  NUMMSG   = NUMBER OF POTENTIAL MAIL MESSAGES TO BE STORED IN VIRTUAL ARRAY.	PASSED IN
0010    C
0011    C *************************************
0012    C
0013    C **  INCLUDE LOCAL DECLARATIONS FOR LOCAL DATA.
0014    C
0015    	INTEGER*4	MOVLEN, NUMMSG, IDIR, HDR, LUN, NEWMCNT
0016    C
0017    	CHARACTER	LOCTIME*7, FULTIME*17, NULLDESCR*74, FM_USER*80,
0018         &			WFILE*64, MOVFLDR*39, MAILDIR(NUMMSG)*86,
0019         &			USRNM*12, TFILE*64, SUBJECT*255, TO_USER*80
0020    C
0021    C **  INCLUDE GLOBAL COMMON DECLARATIONS FOR PASSING DATA.
0022    C
0023    	INCLUDE 'LIFE_DEV:REMD$DEC.INC/NOLIST'
0446    C
0447    	EXTERNAL	REMD$MAIL_FILE, REMD$MAIL_DIR, REMD$MAIL_GET
0448    	EXTERNAL	REMD$MAIL_REPLY, REMD$MAIL_SELECT
0449    C
0450    C **  INITIALIZE VARIABLES NEEDED FOR CHECKING FOLDERS FOR MAIL COUNTS.
0451    C
0452    	MOVFLDR = 'NEW_TEMP_MAIL'
0453    	MOVLEN = 13
0454    	MAIL_DATA.FOLDER = 'NEWMAIL'
0455    	MAIL_DATA.FL = 7
0456    C
0457    C **  INITIALIZE VARIABLE DESIGNATING USER MAIL BEING SENT TO.
0458    C
0459    	CALL STR$TRIM( TO_USER, USRNM, LL )
0460    C
0461    C **  IF NEWMAIL PRESENT, THEN MOVE IT TO TEMPORARY FOLDER.
0462    C
0463    	IF (NEWMCNT .GT. 0) THEN
0464    C
0465    C **  LOOP THROUGH NEWMAIL FOLDER, MOVE EACH MESSAGE TO TEMP FOLDER.
0466    C
0467    		DO JJ = 1,NEWMCNT
0468    C
0469    C **  SET KEY VALUE OF NEWMAIL ELEMENT
0470    C
0471    			MAIL_DATA.KEYVAL = JJ
0472    C
0473    C **  RE-FILE THE MESSAGE TO THE TEMPORARY FOLDER.
0474    C
0475    			CALL REMD$MAIL_FILE( MOVFLDR, MOVLEN, 1, MAIL_DATA )
0476    C
0477    		ENDDO
0478    C
0479    	ENDIF

BMS_MAIL                                                        26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   2
                                                                12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

0480    C
0481    C **  RESET NEWMAIL COUNT TO ZERO.
0482    C
0483    	IF (NEWMCNT .GT. 0) THEN
0484    		NEWMCNT = 0
0485    		CALL REMP$PROFILE_SET( 5, LL, USRNM, NEWMCNT )
0486    	ENDIF
0487    C
0488    C **  COUNT THE NUMBER OF MESSAGES IN THE TEMPORARY FOLDER.
0489    C
0490    	MAIL_DATA.FOLDER = MOVFLDR(1:MOVLEN)//' '
0491    	MAIL_DATA.FL = MOVLEN
0492    C
0493    C **  SELECT THE TEMPORARY NEW MAIL FOLDER.
0494    C
0495    	CALL REMD$MAIL_SELECT( NUMMSG, MAIL_DATA )
0496    C
0497    C **  GET CURRENT TIME AND POST TO LOGFILE.
0498    C
0499    	CALL LIFE$STR_TIME( LOCTIME, FULTIME )
0500    	WRITE(18,8100) FULTIME
0501    C
0502    C **  DEFINE COUNTER FOR DELETED, RE-FILED MESSAGES.
0503    C
0504    	IDIR = 0
0505    C
0506    	DO WHILE ( NUMMSG .GT. IDIR )
0507    C
0508    C **  INCREMENT COUNT OF MAIL COUNTER
0509    C
0510    		IDIR = IDIR + 1
0511    C
0512    C **  GET RECORD.
0513    C **  GET MESSAGE NUMBER AND EXTRACT THE MESSAGE TO A TEXT FILE
0514    C
0515    		MAIL_DATA.KEYVAL = IDIR
0516    		CALL REMD$MAIL_DIR( NULLDESCR, MAIL_DATA )
0517    C
0518    C **  POST INFORMATION READ INTO DATA ARRAY STRING.
0519    C
0520    		MAILDIR(IDIR) = ' '
0521    		ENCODE(5,'(I5)',MAILDIR(IDIR)(1:5)) MAIL_DATA.KEYVAL			!POSITIONS 6,7,8 FUTURE USAGE.
0522    		MAILDIR(IDIR)(9:82) = NULLDESCR
0523    C
0524    C **  POST BASIC DIRECTORY INFORMATION TO LOGFILE.
0525    C
0526    		WRITE(18, 3300) IDIR, NULLDESCR
0527    C
0528    C **  GET THE TIME STRING FOR CREATING FILE NAMES.
0529    C
0530    		CALL LIFE$STR_TIME( LOCTIME, FULTIME )
0531    C
0532    C **  DEFINE THE FILE NAME FOR THE FILE FOR THE EXTRACTED MESSAGE.
0533    C
0534    		WFILE = 'LOC_DOC:SEND'//LOCTIME//'.DOC'
0535    C
0536    C **  GET THE MESSAGE TEXT FOR FORWARDING TO ANOTHER USER.

BMS_MAIL                                                        26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   3
                                                                12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

0537    C
0538    		HDR = 2
0539    		LUN = 8
0540    		CALL REMD$MAIL_GET( LUN, WFILE, HDR, MAIL_DATA )
0541    		CALL REMD$MAIL_REPLY( FM_USER, SUBJECT, MAIL_DATA )
0542    C
0543    C **  PARSE FROM STRING.
0544    C
0545    		IF (USRNM(1:LL) .EQ. 'LIFEMAIL') CALL BMS$TO_PARSE( TO_USER, SUBJECT )
0546    		CALL BMS$FROM_PARSE( FM_USER, SUBJECT, LSRTR )
0547    C
0548    C **  DEFINE THE FILE FOR THE CREATED DISTRIBUTION LIST.
0549    C
0550    		TFILE     = 'LOC_RMAIL:USE'//LOCTIME//'.DISTRIBUTION'
0551    C
0552    C **  OPEN THE FILE FOR THE FINAL ADDRESSES FOR SENDING MAIL.
0553    C
0554    		OPEN(UNIT=32, CARRIAGECONTROL='LIST', RECORDTYPE='VARIABLE',
0555         &			STATUS='NEW', FORM='FORMATTED', FILE=TFILE,
0556         &			ORGANIZATION='SEQUENTIAL')
0557    C
0558    C **  TRIM OFF WHAT SYSTEM DISTRIBUTED THE MAIL ORIGINALLY.
0559    C
0560    		CALL STR$TRIM( TO_USER, TO_USER, LTU )
0561    		WRITE(32,400) TO_USER
0562    C
0563    C **  CLOSE THE DLIST FILES
0564    C
0565    		CLOSE(UNIT=32)
0566    C
0567    C **  SEND THE MESSAGE.
0568    C
0569    		CALL GNRL$DO_SEND( LOCTIME, SUBJECT, TFILE, WFILE )
0570    C
0571    C **  CLEAR UP THE VARIABLES FOR SENDING MAIL.
0572    C
0573    		SUBJECT = ' '
0574    C
0575    C **  RETURN TO THE READ MENU.
0576    C
0577    	ENDDO
0578    C
0579    C **  FILE ALL THE MESSAGES TO THE MAIL FOLDER, CLEANUP USING NORMAL SYSTEM JOBS.
0580    C
0581    	IF (USRNM(1:LL) .EQ. 'LIFEMAIL') THEN
0582    		CALL LIFE$STR_TIME( LOCTIME, FULTIME )
0583    		MOVFLDR = FULTIME(1:11)//' '
0584    		IF (MOVFLDR(1:1) .EQ. ' ') MOVFLDR(1:1) = '0'
0585    		MOVLEN = 11
0586    	ELSE
0587    		MOVFLDR = 'YOUR_WASTE'
0588    		MOVLEN = 10
0589    	ENDIF
0590    C
0591    C **  LOOP UNTIL ALL MESSAGES MOVED TO OLD MAIL FOLDER.
0592    C
0593    	DO MOVCNT = 1, NUMMSG

BMS_MAIL                                                        26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   4
                                                                12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

0594    C
0595    		MAIL_DATA.KEYVAL = MOVCNT
0596    C
0597    C **  RESET THE FOLDER NAME OF THE MESSAGE.
0598    C
0599    		CALL REMD$MAIL_FILE( MOVFLDR, MOVLEN, 1, MAIL_DATA )
0600    C
0601    	ENDDO
0602    C
0603    C **  RETURN TO CALLING PROGRAM.
0604    C
0605    	RETURN
0606    C
0607    400	FORMAT(A<LTU>)
0608    3300	FORMAT(1X,I5,1X,A74)
0609    8100	FORMAT('%BMS-TIME, STARTING WORK:  ',A17/1X,'    #   From                 Date         Subject')
0610    C
0611    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  802   PIC CON REL LCL   SHR   EXE   RD NOWRT QUAD
  1 $PDATA                                 189   PIC CON REL LCL   SHR NOEXE   RD NOWRT QUAD
  2 $LOCAL                                1136   PIC CON REL LCL NOSHR NOEXE   RD   WRT QUAD

    Total Space Allocated                 2127


ENTRY POINTS

    Address  Type  Name          

  0-00000000       BMS_MAIL      


VARIABLES

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

  2-00000062  CHAR FM_USER         2-00000007  CHAR FULTIME         2-000002AC  I*4  HDR                 **      I*4  IDIR          
      **      I*4  ISTAT               **      I*4  JJ              2-000002B4  I*4  LL              2-00000000  CHAR LOCTIME       
  2-000002BC  I*4  LSRTR           2-000002C0  I*4  LTU             2-000002B0  I*4  LUN                 **      I*4  MOVCNT        
  2-000000F2  CHAR MOVFLDR         2-000002A8  I*4  MOVLEN         AP-00000014@ I*4  NEWMCNT         2-00000018  CHAR NULLDESCR     
 AP-00000010@ I*4  NUMMSG          2-00000159  CHAR SUBJECT         2-00000119  CHAR TFILE           2-00000258  CHAR TO_USER       
 AP-00000008@ CHAR USRNM           2-000000B2  CHAR WFILE         

BMS_MAIL                                                        26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   5
01                                                              12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

RECORDS

    Address   Name          Structure           Bytes

 AP-00000004@ MAIL_DATA     MAIL_INFO             123


ARRAYS

    Address  Type  Name                Bytes  Dimensions

 AP-0000000C@ CHAR MAILDIR                **  (*)


LABELS

    Address   Label       Address   Label       Address   Label   

  1-0000000B  400'      1-00000012  3300'     1-0000001B  8100'   


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

        BMS$FROM_PARSE                          BMS$TO_PARSE                            FOR$CLOSE                       
        FOR$OPEN                                GNRL$DO_SEND                            LIFE$STR_TIME                   
        REMD$MAIL_DIR                           REMD$MAIL_FILE                          REMD$MAIL_GET                   
        REMD$MAIL_REPLY                         REMD$MAIL_SELECT                        REMP$PROFILE_SET                
        STR$TRIM                        


OPTIONS QUALIFIERS

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


COMMAND QUALIFIERS

  FOR/LIST/SHOW/EXTEND BMS_SUB0

  /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_SUB0.LIS;30                                                           
  /OBJECT=LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.OBJ;30                                                           

BMS_MAIL                                                        26-Mar-1991 15:55:13	VAX FORTRAN V5.5-98                 Page   6
01                                                              12-Feb-1991 19:30:00	LIB4:[LIFENET.REMMAIL.BMS]BMS_SUB0.FOR;31   

COMPILATION STATISTICS

  Run Time:           2.84 seconds
  Elapsed Time:       3.79 seconds
  Page Faults:        953
  Dynamic Memory:     968 pages
