compile subroutine reactor_log_rpt4_prn( FromDate, ThruDate, Summary )
! 
* LIST REACTOR_LOG ID-SUPP REACT_AREA_DESC REACT_PROB_DESC  JUSTLEN 30 REACT_SERV_DESC JUSTLEN 30 REACT_ITEM_IDS REACT_ITEMS_DESC  JUSTLEN 30 REACT_ITEM_QTY JUSTLEN 4 COLHEAD 'Qty' NOTES JUSTLEN 30 START_DATE JUSTLEN 10 START_TIME JUSTLEN 10 ELAPSED_HOURS JUSTLEN 7 COLHEAD 'Hours' HEADING " Run Date: 'TS39'Page 'P''LS22'Reactor Log Report 05/01/98 To 05/02/98"
! 
declare function set_printer
*PRINTER ON
* 
* HEADING/FOOTING
Font = 'Courier New,6,L,0'
convert ',' to @fm in Font
HeadPos = '.38/1/1.44/1.44/.75/1.44/.5/1.75/.5/.5/.5'
convert '/' to @fm in HeadPos
TheHeader = " Reactor Log Report from (":oconv(FromDate, 'D2/'):") Thru (":oconv(ThruDate, 'D2/' ):')':" 'D' 'T' PAGE # 'P'":@fm
COLHEADER = "React" : @vm : "Area" : @vm : "Problem" : @vm : "Service" : @vm : "Items" : @vm : "Items Description":@vm: "Qty" : @vm : "Notes" : @vm : "Start" : @vm : "Start" : @vm : "Elapse":@fm
COLHEADER:= "or" : @vm : "" : @vm : "" : @vm : "" : @vm : "" : @vm : "" : @vm : "" : @vm: "": @vm : "Date" : @vm : "Time" : @vm : "Hours":@fm
*COLHEADER:= str('_',9):@vm:str('_',16):@vm:str('_',25):@vm:str('_',25):@vm:str('_',25):@vm:str('_',9):@vm:str('_',25):@vm:str('_',9):@vm:str('_',9):@vm:str('_',9):@fm
COLHEADER:= str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@vm:str('_',30):@fm
Void = set_printer( 'FONTHEADFOOT', Font )
Void = set_printer( 'HEADER', TheHeader, HeadPos, ColHeader )
Void = set_printer( 'FONT', Font )
* 
@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
* 
COLHEADING "Reactor Area" : @FM : "Reactor Problem" : @FM : "Reactor Service" : @FM : "React Item IDs" : @FM : "Reactor Items" : @FM : "Qty" : @FM : "Notes" : @FM : "Start Date" : @FM : "Start Time" : @FM : "Hours"
COLLENGTH 20 : @FM : 30 : @FM : 30 : @FM : 20 : @FM : 30 : @FM : 4 : @FM : 30 : @FM : 10 : @FM : 10 : @FM : 7
* 
! 
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.REACTULAREAULDESC={REACT_AREA_DESC}
I.REACTULAREAULDESC=S.REACTULAREAULDESC
S.REACTULPROBULDESC={REACT_PROB_DESC}
I.REACTULPROBULDESC=S.REACTULPROBULDESC
S.REACTULSERVULDESC={REACT_SERV_DESC}
I.REACTULSERVULDESC=S.REACTULSERVULDESC
M.REACTULITEMULIDS={REACT_ITEM_IDS}<1,WHICH.VALUE> ; P.REACTULITEMULIDS=1 ; C.REACTULITEMULIDS=7
M.REACTULITEMSULDESC={REACT_ITEMS_DESC}<1,WHICH.VALUE> ; P.REACTULITEMSULDESC=1 ; C.REACTULITEMSULDESC=7
M.REACTULITEMULQTY={REACT_ITEM_QTY}<1,WHICH.VALUE> ; P.REACTULITEMULQTY=1 ; C.REACTULITEMULQTY=7
M.NOTES=FMT({NOTES},"T#30") ; P.NOTES=1 ; C.NOTES=7
S.STARTULDATE={START_DATE}
I.STARTULDATE=S.STARTULDATE
S.STARTULTIME={START_TIME}
I.STARTULTIME=S.STARTULTIME
S.ELAPSEDULHOURS={ELAPSED_HOURS}
I.ELAPSEDULHOURS=S.ELAPSEDULHOURS
* 
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=@REC.COUNT
* 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.REACTULITEMULIDS GE PREVIOUS.MARK.LEVEL THEN
REMOVE I.REACTULITEMULIDS FROM M.REACTULITEMULIDS AT P.REACTULITEMULIDS SETTING C.REACTULITEMULIDS
S.REACTULITEMULIDS=I.REACTULITEMULIDS
END
IF C.REACTULITEMULIDS GT NEW.MARK.LEVEL THEN NEW.MARK.LEVEL=C.REACTULITEMULIDS
IF C.REACTULITEMSULDESC GE PREVIOUS.MARK.LEVEL THEN
REMOVE I.REACTULITEMSULDESC FROM M.REACTULITEMSULDESC AT P.REACTULITEMSULDESC SETTING C.REACTULITEMSULDESC
S.REACTULITEMSULDESC=I.REACTULITEMSULDESC
END
IF C.REACTULITEMSULDESC GT NEW.MARK.LEVEL THEN NEW.MARK.LEVEL=C.REACTULITEMSULDESC
IF C.REACTULITEMULQTY GE PREVIOUS.MARK.LEVEL THEN
REMOVE I.REACTULITEMULQTY FROM M.REACTULITEMULQTY AT P.REACTULITEMULQTY SETTING C.REACTULITEMULQTY
S.REACTULITEMULQTY=I.REACTULITEMULQTY
END
IF C.REACTULITEMULQTY GT NEW.MARK.LEVEL THEN NEW.MARK.LEVEL=C.REACTULITEMULQTY
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.REACTULITEMULQTY NE "" THEN S.REACTULITEMULQTY=OCONV(S.REACTULITEMULQTY,"MD0")
IF S.STARTULDATE NE "" THEN S.STARTULDATE=OCONV(S.STARTULDATE,"D2/")
IF S.STARTULTIME NE "" THEN S.STARTULTIME=OCONV(S.STARTULTIME,"MTH")
IF S.ELAPSEDULHOURS NE "" THEN S.ELAPSEDULHOURS=OCONV(S.ELAPSEDULHOURS,"MD2")
* 
* PRINT DETAIL LINE
* 
PRINTLINE= S.REACTOR:@vm
PRINTLINE:= S.REACTULAREAULDESC:@vm
PRINTLINE:= S.REACTULPROBULDESC:@vm
PRINTLINE:= S.REACTULSERVULDESC:@vm
PRINTLINE:= S.REACTULITEMULIDS:@vm
PRINTLINE:= S.REACTULITEMSULDESC:@vm
PRINTLINE:= S.REACTULITEMULQTY:@vm
PRINTLINE:= S.NOTES:@vm
PRINTLINE:= S.STARTULDATE:@vm
PRINTLINE:= S.STARTULTIME:@vm
PRINTLINE:= S.ELAPSEDULHOURS
TableColInfo = '>+547':@vm:'<+1440':@vm:'<+2074':@vm:'<+2074':@vm:'<+1080':@vm:'<+2074':@vm:'>+720':@vm
TableColInfo:= '<+2520':@vm:'<+720':@vm:'<+720':@vm:'>+720'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PRINTLINE, '', '', 1, TB_NONE ) 

* 
IF NEW.MARK.LEVEL THEN
S.REACTOR=''
S.REACTULAREAULDESC=''
S.REACTULPROBULDESC=''
S.REACTULSERVULDESC=''
S.REACTULITEMULIDS=''
S.REACTULITEMSULDESC=''
S.REACTULITEMULQTY=''
S.NOTES=''
S.STARTULDATE=''
S.STARTULTIME=''
S.ELAPSEDULHOURS=''
PREVIOUS.MARK.LEVEL=NEW.MARK.LEVEL
GOTO DETAIL
END
* 
GOTO READRECORD
* 
END

