DATESCN
PROGRAM DATESCN(INPUT,OUTPUT,TAPE1,TAPE4)
**
* TAPE1 = MONTHLY ACCOUNT FILE TO BE SEARCHED
* TAPE4 IS AN OUTPUT FILE ON WHICH TO STORE THE
* BEGINNING AND END DATES FOR EACH RECORD IN THE
* MONTHLY ACCOUNT FILE
*
* SEENBEG = TRUE IF *ABSY* OR *ARSY* HAS BEEN FOUND
* SINCE THE LAST TIME *AESY* WAS FOUND
*
IMPLICIT INTEGER (A-Z)
LOGICAL SEENBEG
DIMENSION ICARD(4)
* WRITE OUT A HEADER
WRITE(4,101)
101 FORMAT(*BILLING CYCLE DATES*)
*
SEENBEG=.FALSE.
ICARD(4)=0
* READ NEXT RECORD IN THE ACCOUNT FILE; EXIT IF END OF FILE
111 READ(1,112) (ICARD(I),I=1,3)
112 FORMAT(A10,10X,A4,3X,A10)
IF(EOF(1)) 500,200
*
* CODE FOR ABSY
*
200 IF(ICARD(2).NE.10LABSY ) GOTO 300
* IF TWO CONSECUTIVE, THEN NEED TO FAKE AESY
IF(.NOT.SEENBEG) GOTO 201
WRITE (4,210) ICARD(1),ICARD(3),10LAESY
201 WRITE (4,210) ICARD(1),ICARD(3),ICARD(2)
210 FORMAT(A10,1X,A8,1X,A4)
SEENBEG=.TRUE.
CALL REMARK(ICARD(3))
GOTO 111
*
* CODE FOR AESY
*
300 IF(ICARD(2).NE.10LAESY ) GOTO 400
WRITE (4,210) ICARD(1),ICARD(3),ICARD(2)
SEENBEG=.FALSE.
GOTO 111
*
* CODE FOR ARSY
*
400 IF(ICARD(2).NE.10LARSY ) GOTO 111
* ONLY CARE ABOUT ARSY IF ABSY NOT SEEN AS THIS MEANS THAT
* THE ABSY WAS LOST
IF(SEENBEG) GOTO 111
ICARD(3)=ICARD(3).AND.74777777777777777777B
ICARD(3)=ICARD(3).OR.05000000000000000000B
WRITE (4,401) ICARD(1),ICARD(3),ICARD(2)
401 FORMAT(A10,1X,R8,1X,A4)
SEENBEG=.TRUE.
CALL REMARK(ICARD(3))
GOTO 111
*
* WRITE ENDING INFORMATION AND THEN EXIT
*
500 WRITE(4,501)
501 FORMAT(X,*END OF FILE*)
END