![]() |
help!?! converting random file info to a sequential list - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: help!?! converting random file info to a sequential list (/thread-115.html) |
help!?! converting random file info to a sequential list - moosecode - 01-30-2003 The project i am working on is a dispatching program for service calls. I've defined the types, the time variables, and the time evaluation routines. I have 2 problems. 1. When I display the results, I can't get the "completed" calls to move off the screen and be replaced by the "incomplete" calls. I can see what I want to do, but not quite HOW. 2. I can't seem to get the loop going deep enough that it does the val(current time) vs val(expiration time) AND doesn't run out of stack space or some other memory error. The main issue is that I can't presume that each call will be taken and completed in order. A call that comes in at 1200 might be done at 1315, but a call at 1230 might be done at 1300. That's where I believe the main hangup is. Is there a way to compensate? file is located at: http://volweb.utk.edu/Schools/sullivan/gravely/maindisp.bas (No this isn't a school project - I'm just using some space on my iwfe's site) i GOT IT! - moosecode - 02-01-2003 DUHHHHHHHHHH A= B AND B= C THEN A = C I JUST NEEDED TO CAPTURE THE RECORD # OF NON-COMPLETED CALLS, DUMP THAT TO ANOTHER RANDOM FILE, AND THEN DUN THE DISPLAY OFF THE 2ND RANDOM FILE, SO IT KILLS THAT FILE AND RECREATES IT EVRYTIME 5 MINUTES TO KEEP THE INFO FRESH. 2 MONTHS TO DO THIS....JUST BECAUSE I DIDNT THINK ABOUT IT. SUB makedisplay timeval 'CAPTURES CURRENT TIME STRING (TIME$) CLS COLOR 7, 0 CLS OPEN "TIME.DAT" FOR RANDOM AS 3 LEN = LEN(clock) GET 3, 1, clock 'PRINT "current time value is:", CLOCK.VALTIME 'CHECKS TIME RECORD FOR CURRENT TIME LET TIMEX = clock.valtime ' SETS VARIABLE FOR THE CURRENT TIME CLOSE 3 LET display = 0 LOCATE 1, 1 PRINT "LOADING DISPATCH INFORMATION... " WORKING 'OPENS THE STORAGE FILE GET 100, 1, tow LET startup = tow.startup LET maxrecord = startup CLOSE LOCATE 3, 1: PRINT "max record is: ", maxrecord 'waitforme LET count = 0 sort.calls: FOR dx = 1 TO maxrecord OPEN "1.dat" FOR RANDOM AS 100 LEN = LEN(tow) GET 100, dx, tow LET complete = tow.finish IF complete = 1 THEN GOTO skip.complete 'export.info.to.file: LET count = count + 1 LOCATE 5, 1: PRINT "count is:", count LOCATE 5, 35: PRINT "current record is:", dx 'waitforme OPEN "counter.dat" FOR OUTPUT AS #5 PRINT #5, count CLOSE #5 OPEN "2.dat" FOR RANDOM AS 155 LEN = LEN(show) GET 155, count, show LET show.callno = dx LOCATE 7, 1: PRINT "show.callno = ", show.callno 'waitforme PUT 155, count, show CLOSE 155 skip.complete: CLOSE continue.next: CLOSE NEXT dx draw.the.screen: CLS COLOR 7, 0 CLS LOCATE 3, 1 COLOR 7, 1 LOCATE 3, 1: PRINT " " LOCATE 4, 1: PRINT " " LOCATE 5, 1: PRINT " " LOCATE 6, 1: PRINT " " LOCATE 3, 1 PRINT "| CALL #: | LAST NAME: | CLUB NAME | CALL | DISP | ETA | TRUCK | ARRV | COMP |" PRINT "| | | | TIME | TIME | EXP: | # | TIME | TIME |" PRINT "| _______ | __________ | _________ | ____ | ____ | ____ | _____ | ____ | ____ |" LOCATE 8, 1: PRINT " " LOCATE 9, 1: PRINT " " LOCATE 10, 1: PRINT " " LOCATE 11, 1: PRINT " " LOCATE 12, 1: PRINT " " 'LOCATE 13, 1: PRINT " " DO.THE.TIME.WARP.AGAIN: OPEN "counter.dat" FOR INPUT AS #5 INPUT #5, count CLOSE #5 LET dispx = 1 LET dispmax = count FOR display = dispx TO dispmax OPEN "2.dat" FOR RANDOM AS 155 LEN = LEN(show) GET 155, display, show LET activecall = show.callno OPEN "1.dat" FOR RANDOM AS 100 LEN = LEN(tow) GET 100, activecall, tow LET TIMEW = tow.VALcallin 'time value as call came in originally LET TIMEY = tow.ETAEXPIRES 'time value for call expiration IF TIMEX >= TIMEY THEN CLOSE 100: GOTO DRAW.DISPLAY.CRITICAL IF timelapse >= 900 THEN CLOSE 100: GOTO DRAW.DISPLAY.CALL IF timelapse <= 600 THEN CLOSE 100: GOTO DRAW.DISPLAY.WARNING do.the.loop: CLOSE NEXT display GOTO display.options DRAW.DISPLAY.CALL: LOCATE 7 + display, 1: COLOR 7, 0 FORMAT$ = " ####### \ \ \ \ \ \ \ \ \ \ #### \ \ \ \" PRINT USING FORMAT$; tow.callno; LEFT$(tow.custlast, 10); LEFT$(tow.autoclubname, 7); tow.CALLIN; tow.CALLOUT; tow.eta; tow.trucknum; tow.ata; tow.callcomplete GOTO do.the.loop DRAW.DISPLAY.WARNING: LOCATE 7 + display, 1: COLOR 14, 1: FORMAT$ = " ####### \ \ \ \ \ \ \ \ \ \ #### \ \ \ \" PRINT USING FORMAT$; tow.callno; LEFT$(tow.custlast, 10); LEFT$(tow.autoclubname, 7); tow.CALLIN; tow.CALLOUT; tow.eta; tow.trucknum; tow.ata; tow.callcomplete GOTO do.the.loop DRAW.DISPLAY.CRITICAL: LOCATE 7 + display, 1: COLOR 14, 4: FORMAT$ = " ####### \ \ \ \ \ \ \ \ \ \ #### \ \ \ \" PRINT USING FORMAT$; tow.callno; LEFT$(tow.custlast, 10); LEFT$(tow.autoclubname, 7); tow.CALLIN; tow.CALLOUT; tow.eta; tow.trucknum; tow.ata; tow.callcomplete GOTO do.the.loop display.options: CALL commands END SUB |