G
Guest
I'm trying to convert some dBaseIV runtime stuff over into Access. I'm not
sure of the right way or easiest way to do this since I'm new to both
programs. The current program takes a couple of tables to use as an index
then searches for those records between two date/time entries. The dates and
times are parameters entered at the beginning of the query. The records
between the date/times entered are then processed to find the total time in
days for each identical ID and the occurences counted. Can you point me in
the right direction and recommend some references to learn from?
A small part of the dBase code I'm converting is below. The whole runtime
programming covers about 1000 pages.
PROCEDURE prtavall
ON KEY LABEL F10 DO Abortproc
mstartime = space(5)
mstoptime = space(5)
mmachid = space(7)
STORE CTOD(" / / ") TO startday
STORE "07:00" TO startime
STORE DATE() TO stopday
STORE "07:00" TO stoptime
USE C:&mdirectory.\&mfilename. ORDER machid IN 1
USE equip ORDER machid IN 2
USE ssa ORDER machtype IN 3
SELECT 1
GO TOP
SELECT 2
GO TOP
SELECT 3
GO TOP
STORE 1 TO run1
DO WHILE run1 = 1
@ 0,01 SAY DBF()
@ 6,00 CLEAR
@ 7,26 SAY "INDICES REPORT INPUT SCREEN"
@ 10,19 SAY "ENTER THE STARTING DATE and TIME:" GET startday PICT
"99/99/9999"
@ 10,65 GET startime PICT "99:99"
@ 12,20 SAY "ENTER THE ENDING DATE and TIME :" GET stopday PICT
"99/99/9999"
@ 12,65 GET stoptime PICT "99:99"
READ
CLEAR GETS
IF startday = CTOD(" / / ")
STORE 0 TO run1
EXIT
ENDIF
@ 6,00 CLEAR
@ 12,32 SAY "PRINTING REPORT"
SET DEVICE TO PRINTER
@ 01,31 SAY "PHOTRONICS - ALLEN"
@ 01,70 SAY DATE()
@ 02,28 SAY "EQUIPMENT INDICES REPORT"
@ 04,16 SAY "PERIOD COVERED:"
@ 04,32 SAY startday
@ 04,43 SAY startime PICT "99:99"
@ 04,49 SAY "TO"
@ 04,52 SAY stopday
@ 04,64 SAY stoptime PICT "99:99"
@ 06,13 SAY "BREAKDOWN RECALL"
@ 07,03 SAY "EQUIP RATE RATE THD OCC. MTBF
MTTR AVAIL"
@ 08,03 SAY REPLICATE("_",76)
STORE 9 TO lineno
SELECT 2
STORE 2 TO run2
DO WHILE run2 = 2
IF EOF()
STORE 0 TO run2
EXIT
ENDIF
IF servflag = "Y"
STORE machid TO mmachid
ELSE
SKIP
LOOP
ENDIF
STORE startday TO mstartday
STORE startime TO mstartime
STORE stopday TO mstopday
STORE stoptime TO mstoptime
mstartime = (VAL(SUBSTR(startime,1,2))+VAL(SUBSTR(startime,4,2))/60)/24
mstoptime = (VAL(SUBSTR(stoptime,1,2))+VAL(SUBSTR(stoptime,4,2))/60)/24
mthd = 0
mperiod = ((mstopday+mstoptime)-(mstartday+mstartime))*24
mpmavail = 0
mcnt = 0
cnt = 0
mtbfcnt = 0
mmssn = 0
ssct = 0
zthd = 0
zmtbfthd = 0
mtbfthd = 0
SELECT 1
GO TOP
SEEK mmachid
SCAN REST FOR (machid = mmachid.AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => startday +
mstartime .AND. ;
daydown + (VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24
<= stopday + mstoptime).OR.(dayup = CTOD(" / / ");
.AND. timedown <> " ").OR.(machid = mmachid .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 =>;
startday + mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24<= stopday +
mstoptime).OR.;
(machid = mmachid.AND.((thd/24) + daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24) => stopday +
mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= stopday +
mstoptime) WHILE machid = mmachid
IF dayup = CTOD(" / / ").AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE mperiod TO zthd
STORE 1 + cnt TO cnt
ELSE
IF (dayup = CTOD(" / / ").AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstopday +
mstoptime)
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE mperiod TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
mstopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE (((dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24) - (mstartday +
mstartime))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <= mstopday +
mstoptime
STORE thd TO zthd
STORE 1 + cnt TO cnt
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
STORE (mthd + zthd) TO mthd
STORE 0 TO zthd
ENDSCAN
GO TOP
SEEK mmachid
SCAN REST FOR (machid = mmachid.AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => startday +
mstartime .AND. ;
daydown + (VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24
<= stopday + mstoptime .AND. (action = "PM" .OR. action = "SM")) .OR.;
(dayup = CTOD(" / / ") .AND. timedown <> " " .AND. (action =
"PM" .OR. action = "SM")) .OR.( ;
machid = mmachid .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => startday +
mstartime .AND. ;
dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
stopday + mstoptime .AND. (action = "PM" .OR. action = "SM")) .OR.(machid =
mmachid.AND.((thd/24) + daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24) ;
=> stopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= stopday +
mstoptime .AND. (action = "PM" .OR. action = "SM")) WHILE machid = mmachid
IF dayup = CTOD(" / / ").AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE mperiod TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF (dayup = CTOD(" / / ").AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstopday +
mstoptime)
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE mperiod TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
mstopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE (((dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24) - (mstartday +
mstartime))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <= mstopday +
mstoptime
STORE thd TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
STORE (mtbfthd + zmtbfthd) TO mtbfthd
STORE 0 TO zmtbfthd
ENDSCAN
GO TOP
STORE 3 TO run3
SELECT 3
GO TOP
STORE SUBSTR(mmachid,1,3) TO mmachtype
SEEK mmachtype
DO WHILE run3 = 3
IF machtype <> mmachtype .OR. EOF()
STORE 0 TO run3
EXIT
ENDIF
STORE code TO mssc
SELECT 1
GO TOP
SEEK mmachid
SCAN REST FOR
(machid=mmachid.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24=>startday+mstartime.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24;
<=stopday+mstoptime.AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.(dayup=CTOD("
/ / ").AND.timedown<>"
".AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.;
(machid=mmachid.AND.dayup+(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24=>startday+mstartime.AND.dayup+(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24<=stopday+mstoptime.AND.;
subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.(machid=mmachid.AND.((thd/24)+daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24)=>stopday+mstoptime.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24<=stopday+mstoptime.AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")) WHILE machid=mmachid
STORE mmssn + 1 TO mmssn
ENDSCAN
IF mmssn > 0
STORE mmssn -1 TO mmssn
ENDIF
STORE (mmssn + ssct) TO ssct
STORE 0 TO mmssn
SELECT 3
SKIP
ENDDO
mmtbf = ROUND(((mperiod - mthd) + mtbfthd) / (cnt - mtbfcnt),1)
mmmtbf = IIF((cnt = 0).OR.(cnt = mtbfcnt),mperiod,IIF(mmtbf < 0,0,mmtbf))
mmttr = ROUND((mthd-mtbfthd) / (cnt-mtbfcnt),1)
mmmttr = IIF((cnt = 0).OR.(cnt = mtbfcnt),0,IIF(mmttr < 0,0,mmttr))
mavail = ROUND(((mperiod-mthd)/mperiod)*100,1)
mmavail = IIF(mavail < 0,"---",mavail)
mcnt = cnt-mtbfcnt
brate = ROUND((((mthd-mtbfthd)/mthd)*100),1)
mbrate = IIF(mthd = 0,0,brate)
mrr = (ssct/mcnt)*100
mmrr = IIF((ssct = 0).OR.(ssct > mcnt),0,mrr)
@ lineno,03 SAY mmachid PICT "!!!-999"
@ lineno,14 SAY mbrate PICT "999.9%"
@ lineno,23 SAY mmrr PICT "999.9%"
@ lineno,31 SAY mthd PICT "9999.9"
@ lineno,43 SAY mcnt PICT "999"
@ lineno,52 SAY mmmtbf PICT "9999.9"
@ lineno,64 SAY mmmttr PICT "999.9"
@ lineno,72 SAY mmavail PICT "999.9%"
STORE lineno + 1 TO lineno
IF lineno > 54
@ 01,31 SAY "PHOTRONICS - ALLEN"
@ 01,70 SAY DATE()
@ 02,28 SAY "EQUIPMENT INDICES REPORT"
@ 04,16 SAY "PERIOD COVERED:"
@ 04,43 SAY startime PICT "99:99"
@ 04,49 SAY "TO"
@ 04,52 SAY stopday
@ 04,64 SAY stoptime PICT "99:99"
@ 06,13 SAY "BREAKDOWN RECALL"
@ 07,03 SAY "EQUIP RATE RATE THD OCC. MTBF
MTTR AVAIL"
@ 08,03 SAY REPLICATE("_",76)
STORE 9 TO lineno
ENDIF
IF run2 = 2
SELECT 3
GO TOP
SELECT 2
SKIP
LOOP
ENDIF
ENDDO
WAIT
EXIT
ENDDO
CLOSE DATABASES
CLEAR
EJECT
SET DEVICE TO SCREEN
CLEAR
DO Titlebox
@ 0,01 SAY DBF()
@ 5,29 SAY "EQUIPMENT REPORT MENU"
sure of the right way or easiest way to do this since I'm new to both
programs. The current program takes a couple of tables to use as an index
then searches for those records between two date/time entries. The dates and
times are parameters entered at the beginning of the query. The records
between the date/times entered are then processed to find the total time in
days for each identical ID and the occurences counted. Can you point me in
the right direction and recommend some references to learn from?
A small part of the dBase code I'm converting is below. The whole runtime
programming covers about 1000 pages.
PROCEDURE prtavall
ON KEY LABEL F10 DO Abortproc
mstartime = space(5)
mstoptime = space(5)
mmachid = space(7)
STORE CTOD(" / / ") TO startday
STORE "07:00" TO startime
STORE DATE() TO stopday
STORE "07:00" TO stoptime
USE C:&mdirectory.\&mfilename. ORDER machid IN 1
USE equip ORDER machid IN 2
USE ssa ORDER machtype IN 3
SELECT 1
GO TOP
SELECT 2
GO TOP
SELECT 3
GO TOP
STORE 1 TO run1
DO WHILE run1 = 1
@ 0,01 SAY DBF()
@ 6,00 CLEAR
@ 7,26 SAY "INDICES REPORT INPUT SCREEN"
@ 10,19 SAY "ENTER THE STARTING DATE and TIME:" GET startday PICT
"99/99/9999"
@ 10,65 GET startime PICT "99:99"
@ 12,20 SAY "ENTER THE ENDING DATE and TIME :" GET stopday PICT
"99/99/9999"
@ 12,65 GET stoptime PICT "99:99"
READ
CLEAR GETS
IF startday = CTOD(" / / ")
STORE 0 TO run1
EXIT
ENDIF
@ 6,00 CLEAR
@ 12,32 SAY "PRINTING REPORT"
SET DEVICE TO PRINTER
@ 01,31 SAY "PHOTRONICS - ALLEN"
@ 01,70 SAY DATE()
@ 02,28 SAY "EQUIPMENT INDICES REPORT"
@ 04,16 SAY "PERIOD COVERED:"
@ 04,32 SAY startday
@ 04,43 SAY startime PICT "99:99"
@ 04,49 SAY "TO"
@ 04,52 SAY stopday
@ 04,64 SAY stoptime PICT "99:99"
@ 06,13 SAY "BREAKDOWN RECALL"
@ 07,03 SAY "EQUIP RATE RATE THD OCC. MTBF
MTTR AVAIL"
@ 08,03 SAY REPLICATE("_",76)
STORE 9 TO lineno
SELECT 2
STORE 2 TO run2
DO WHILE run2 = 2
IF EOF()
STORE 0 TO run2
EXIT
ENDIF
IF servflag = "Y"
STORE machid TO mmachid
ELSE
SKIP
LOOP
ENDIF
STORE startday TO mstartday
STORE startime TO mstartime
STORE stopday TO mstopday
STORE stoptime TO mstoptime
mstartime = (VAL(SUBSTR(startime,1,2))+VAL(SUBSTR(startime,4,2))/60)/24
mstoptime = (VAL(SUBSTR(stoptime,1,2))+VAL(SUBSTR(stoptime,4,2))/60)/24
mthd = 0
mperiod = ((mstopday+mstoptime)-(mstartday+mstartime))*24
mpmavail = 0
mcnt = 0
cnt = 0
mtbfcnt = 0
mmssn = 0
ssct = 0
zthd = 0
zmtbfthd = 0
mtbfthd = 0
SELECT 1
GO TOP
SEEK mmachid
SCAN REST FOR (machid = mmachid.AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => startday +
mstartime .AND. ;
daydown + (VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24
<= stopday + mstoptime).OR.(dayup = CTOD(" / / ");
.AND. timedown <> " ").OR.(machid = mmachid .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 =>;
startday + mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24<= stopday +
mstoptime).OR.;
(machid = mmachid.AND.((thd/24) + daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24) => stopday +
mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= stopday +
mstoptime) WHILE machid = mmachid
IF dayup = CTOD(" / / ").AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE mperiod TO zthd
STORE 1 + cnt TO cnt
ELSE
IF (dayup = CTOD(" / / ").AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstopday +
mstoptime)
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE mperiod TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
mstopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE (((dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24) - (mstartday +
mstartime))*24) TO zthd
STORE 1 + cnt TO cnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <= mstopday +
mstoptime
STORE thd TO zthd
STORE 1 + cnt TO cnt
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
STORE (mthd + zthd) TO mthd
STORE 0 TO zthd
ENDSCAN
GO TOP
SEEK mmachid
SCAN REST FOR (machid = mmachid.AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => startday +
mstartime .AND. ;
daydown + (VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24
<= stopday + mstoptime .AND. (action = "PM" .OR. action = "SM")) .OR.;
(dayup = CTOD(" / / ") .AND. timedown <> " " .AND. (action =
"PM" .OR. action = "SM")) .OR.( ;
machid = mmachid .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => startday +
mstartime .AND. ;
dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
stopday + mstoptime .AND. (action = "PM" .OR. action = "SM")) .OR.(machid =
mmachid.AND.((thd/24) + daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24) ;
=> stopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= stopday +
mstoptime .AND. (action = "PM" .OR. action = "SM")) WHILE machid = mmachid
IF dayup = CTOD(" / / ").AND.daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE mperiod TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF (dayup = CTOD(" / / ").AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstopday +
mstoptime)
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE mperiod TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 => mstopday +
mstoptime
STORE (((mstopday + mstoptime) - (daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF dayup + (VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <=
mstopday + mstoptime .AND. daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 <= mstartday +
mstartime
STORE (((dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24) - (mstartday +
mstartime))*24) TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ELSE
IF daydown +
(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24 => mstartday +
mstartime .AND. dayup +
(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24 <= mstopday +
mstoptime
STORE thd TO zmtbfthd
STORE 1 + mtbfcnt TO mtbfcnt
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
STORE (mtbfthd + zmtbfthd) TO mtbfthd
STORE 0 TO zmtbfthd
ENDSCAN
GO TOP
STORE 3 TO run3
SELECT 3
GO TOP
STORE SUBSTR(mmachid,1,3) TO mmachtype
SEEK mmachtype
DO WHILE run3 = 3
IF machtype <> mmachtype .OR. EOF()
STORE 0 TO run3
EXIT
ENDIF
STORE code TO mssc
SELECT 1
GO TOP
SEEK mmachid
SCAN REST FOR
(machid=mmachid.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24=>startday+mstartime.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24;
<=stopday+mstoptime.AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.(dayup=CTOD("
/ / ").AND.timedown<>"
".AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.;
(machid=mmachid.AND.dayup+(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24=>startday+mstartime.AND.dayup+(VAL(SUBSTR(timeup,1,2))+VAL(SUBSTR(timeup,4,2))/60)/24<=stopday+mstoptime.AND.;
subsys=mssc.AND.(action<>"PM".AND.action<>"SM")).OR.(machid=mmachid.AND.((thd/24)+daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24)=>stopday+mstoptime.AND.daydown+(VAL(SUBSTR(timedown,1,2))+VAL(SUBSTR(timedown,4,2))/60)/24<=stopday+mstoptime.AND.subsys=mssc.AND.(action<>"PM".AND.action<>"SM")) WHILE machid=mmachid
STORE mmssn + 1 TO mmssn
ENDSCAN
IF mmssn > 0
STORE mmssn -1 TO mmssn
ENDIF
STORE (mmssn + ssct) TO ssct
STORE 0 TO mmssn
SELECT 3
SKIP
ENDDO
mmtbf = ROUND(((mperiod - mthd) + mtbfthd) / (cnt - mtbfcnt),1)
mmmtbf = IIF((cnt = 0).OR.(cnt = mtbfcnt),mperiod,IIF(mmtbf < 0,0,mmtbf))
mmttr = ROUND((mthd-mtbfthd) / (cnt-mtbfcnt),1)
mmmttr = IIF((cnt = 0).OR.(cnt = mtbfcnt),0,IIF(mmttr < 0,0,mmttr))
mavail = ROUND(((mperiod-mthd)/mperiod)*100,1)
mmavail = IIF(mavail < 0,"---",mavail)
mcnt = cnt-mtbfcnt
brate = ROUND((((mthd-mtbfthd)/mthd)*100),1)
mbrate = IIF(mthd = 0,0,brate)
mrr = (ssct/mcnt)*100
mmrr = IIF((ssct = 0).OR.(ssct > mcnt),0,mrr)
@ lineno,03 SAY mmachid PICT "!!!-999"
@ lineno,14 SAY mbrate PICT "999.9%"
@ lineno,23 SAY mmrr PICT "999.9%"
@ lineno,31 SAY mthd PICT "9999.9"
@ lineno,43 SAY mcnt PICT "999"
@ lineno,52 SAY mmmtbf PICT "9999.9"
@ lineno,64 SAY mmmttr PICT "999.9"
@ lineno,72 SAY mmavail PICT "999.9%"
STORE lineno + 1 TO lineno
IF lineno > 54
@ 01,31 SAY "PHOTRONICS - ALLEN"
@ 01,70 SAY DATE()
@ 02,28 SAY "EQUIPMENT INDICES REPORT"
@ 04,16 SAY "PERIOD COVERED:"
@ 04,43 SAY startime PICT "99:99"
@ 04,49 SAY "TO"
@ 04,52 SAY stopday
@ 04,64 SAY stoptime PICT "99:99"
@ 06,13 SAY "BREAKDOWN RECALL"
@ 07,03 SAY "EQUIP RATE RATE THD OCC. MTBF
MTTR AVAIL"
@ 08,03 SAY REPLICATE("_",76)
STORE 9 TO lineno
ENDIF
IF run2 = 2
SELECT 3
GO TOP
SELECT 2
SKIP
LOOP
ENDIF
ENDDO
WAIT
EXIT
ENDDO
CLOSE DATABASES
CLEAR
EJECT
SET DEVICE TO SCREEN
CLEAR
DO Titlebox
@ 0,01 SAY DBF()
@ 5,29 SAY "EQUIPMENT REPORT MENU"