Code: Select all
#lang "QB"
DECLARE SUB Initialization ()
'DECLARE SUB ErrorHandler3'()
OPTION BASE 1
DIM SHARED Col(10), Row(10), v$(10), D$(10), I$(10), R$(10, 1)
DIM SHARED DR$
DR$="InptFile"
ON ERROR GOTO ErrorHandler3 '<<<--------------------------
CALL Initialization
ErrorHandler3:
'print "Debug line - Were here ErrorHandler3":Sleep:STOP
IF ERR = 53 THEN 'ERR = 53 File Not Found
BEEP
R$(1, 1) = DR$ + ".ZIP"
A1 = INSTR(1, R$(1, 1), ".")
OPEN MID$(R$(1, 1), 1, A1 - 2) + ".DAT" FOR INPUT LOCK WRITE AS #1
RESUME NEXT
ELSE
'some other error, so print message and abort
PRINT "Unrecoverable error--"; ERR
'ON ERROR GOTO 0
STOP: RESUME
END IF
SUB Initialization
' Calculate number of records of file to extract
' ----------------------------------------------
RecNum = 0
OPEN MID$(R$(1, 1), 1, A1% - 2) + ".DAT" FOR INPUT LOCK WRITE AS #1
DO
C$ = "": LINE INPUT #1, C$
IF MID$(C$, 23, 3) <> "," + CHR$(34) + "S" THEN RecNum = RecNum + 1
LOOP UNTIL EOF(1) = -1
CLOSE #1
END SUB