subroutine reactor_log_rpt2_prn( FromDate, ThruDate )
! 
* LIST REACTOR_LOG ID-SUPP REACTOR JUSTLEN 5 START_DATE JUSTLEN 10 START_TIME JUSTLEN 10 NOTES JUSTLEN 40 ENTRY_ID_NAME JUSTLEN 20 HEADING " Run Date: 'TS39'Page 'P''LS22'Pass Down Report 02/17/97 To 02/17/97"
! 
*PRINTER ON
declare function set_printer
* 
* HEADING/FOOTING
TheHeader = " Pass Down Report 'T' PAGE # 'P' "
if FromDate or ThruDate then
   TheHeader := "for Selected Dates From (":oconv( FromDate, 'D2/' ):") Thru (":oconv(ThruDate, 'D2/' ):")" 
end
ColHeader = "React":@vm:"Start Date":@vm:"Start Time":@vm:"Notes":@vm:"Entry Person"
ColHeader<-1> = str('-',5):@vm:str('-',10):@vm:str('-',10):@vm:str('-',62):@vm:str('-',28)
HeadPos = '.5,1.06,1.06,5.38,2'
convert ',' to @fm in HeadPos
*FOOTING ""
Void = set_printer( 'FONTHEADFOOT' )
Void = set_printer( 'HEADER', TheHeader, HeadPos, ColHeader )
* 
@RECCOUNT=0
FIRST.PASS=1
LAST.RECORD=0
READERR=0
* 
* OPEN DICT AND DATA FILES
* 
OPEN "DICT","REACTOR_LOG" TO @DICT ELSE return
OPEN "","REACTOR_LOG" TO FILE.IN ELSE return
* 
* MAKE COLUMN HEADING
*
! 
READRECORD:
! 
* 
* 
@FILE.ERROR.MODE=1
READNEXT @ID,WHICH.VALUE ELSE
@FILE.ERROR.MODE=0
IF STATUS() GT 0 THEN
@ANS=@FILE.ERROR<1>
Void = set_printer( 'TEXT', {RLIST_TEXT_5} )
return
END
IF @FILE.ERROR<1> EQ 421 THEN
Void = set_printer( 'TEXT', {RLIST_TEXT_6} )
GOTO READRECORD
END
IF @FILE.ERROR<1> NE 111 THEN
@ANS=@FILE.ERROR<1>
Void = set_printer( 'TEXT', {RLIST_TEXT_4} )
READERR+=1
GOTO READRECORD
END
LAST.RECORD=1
END
@FILE.ERROR.MODE=0
* 
S.ATID=@ID
* 
IF FIRST.PASS AND LAST.RECORD THEN
Void = set_printer( 'TEXT', {RLIST_TEXT_2} )
return
END
* 
IF LAST.RECORD THEN GOTO BREAKS
* 
IF @REDUCTION.DONE THEN
@FILE.ERROR.MODE=1
READO @RECORD FROM FILE.IN,@ID ELSE
@FILE.ERROR.MODE=0
IF STATUS() GT 0 THEN
@ANS=@FILE.ERROR<1>
Void = set_printer( 'TEXT', {RLIST_TEXT_5} )
return
END
IF @FILE.ERROR<1> NE 100 THEN
@ANS=@FILE.ERROR<1>
Void = set_printer( 'TEXT', {RLIST_TEXT_4} )
READERR+=1
END
GOTO READRECORD
END
@FILE.ERROR.MODE=0
END
* 
@RECCOUNT+=1
* 
* 
* CALCULATE VALUE(S) FOR COLUMN(S)
* 
S.ATID={@ID}
I.ATID=S.ATID
S.REACTOR={REACTOR}
I.REACTOR=S.REACTOR
S.STARTULDATE={START_DATE}
I.STARTULDATE=S.STARTULDATE
S.STARTULTIME={START_TIME}
I.STARTULTIME=S.STARTULTIME
*M.NOTES=FMT({NOTES},"T#40") ; P.NOTES=1 ; C.NOTES=7
M.NOTES={NOTES}; P.NOTES=1 ; C.NOTES=7
convert @tm to ' ' in M.NOTES

S.ENTRYULIDULNAME={ENTRY_ID_NAME}
I.ENTRYULIDULNAME=S.ENTRYULIDULNAME
* 
PREVIOUS.MARK.LEVEL=0
* 
IF FIRST.PASS THEN
FIRST.PASS=0
GOTO DETAIL
END
* 
* 
! 
BREAKS:
! 
* 
* 
* PERFORM LAST RECORD OUTPUT IF DONE
* 
IF LAST.RECORD THEN
* PRINT
* @ANS=@RECCOUNT
* PRINT {RLIST_TEXT_1}
IF READERR THEN
@ANS=READERR
Void = set_printer( 'TEXT', {RLIST_TEXT_3} )
END
return
END
* 
! 
DETAIL:
! 
* 
* REMOVE APPROPRIATE VALUE FROM MULTI-VALUED COLUMN(S)
* 
NEW.MARK.LEVEL=0
* 
IF C.NOTES GE PREVIOUS.MARK.LEVEL THEN
REMOVE I.NOTES FROM M.NOTES AT P.NOTES SETTING C.NOTES
S.NOTES=I.NOTES
END
IF C.NOTES GT NEW.MARK.LEVEL THEN NEW.MARK.LEVEL=C.NOTES
* 
* DO CONVERSIONS IF ANY
* 
IF S.REACTOR NE "" THEN S.REACTOR=OCONV(S.REACTOR,"MD0")
IF S.STARTULDATE NE "" THEN S.STARTULDATE=OCONV(S.STARTULDATE,"D2/")
IF S.STARTULTIME NE "" THEN S.STARTULTIME=OCONV(S.STARTULTIME,"MTH")
* 
* PRINT DETAIL LINE
* 
PRINTLINE =  S.REACTOR:@vm
PRINTLINE := S.STARTULDATE:@vm
PRINTLINE := S.STARTULTIME:@vm
PRINTLINE := S.NOTES:@vm
PRINTLINE := S.ENTRYULIDULNAME
TableColInfo = '>+720':@vm:'<+1526':@vm:'<+1526':@vm:'<+7747':@vm:'<+2880'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PRINTLINE, '', '', 1, TB_NONE ) 
Void = set_printer( 'TEXT', '' )
* 
IF NEW.MARK.LEVEL THEN
S.REACTOR=''
S.STARTULDATE=''
S.STARTULTIME=''
S.NOTES=''
S.ENTRYULIDULNAME=''
PREVIOUS.MARK.LEVEL=NEW.MARK.LEVEL
GOTO DETAIL
END
* 
GOTO READRECORD
* 
END

