Simple OPEN problem
Posted: Tue Dec 16, 2008 9:59 am
I am having a problem with an OPEN statment bombing out. It is suppose to search a junk.tmp file for a string PN$=0992 then passes to FOUNDIT. The program just exits.
JUNKCHECKIT:
dro$ = "dir f:\" + PN$ + " > junk.tmp"
SHELL "cmd /c " + dro$
OPEN "junk.tmp" FOR INPUT AS #1
DO UNTIL EOF(1)
LINE INPUT #1, a$
IF INSTR(a$, PN$) <> 0 THEN
x$ = RTRIM$(LTRIM$(MID$(a$, 40, 4)))
IF x$ = PN$ THEN GOTO FOUNDIT
END
END IF
LOOP
CLOSE #1
RETURN
=================================
JUNK.TMP
Volume in drive F is DATA
Volume Serial Number is F0CA-6319
Directory of f:\0992
12/15/2008 02:40 PM <DIR> .
12/15/2008 02:40 PM <DIR> ..
12/15/2008 09:39 AM <DIR> 0992Junk
11/17/2008 01:22 PM 9,654,272 0992_Central.rvt
11/17/2008 01:22 PM <DIR> 0992_Central_backup
10/06/2008 10:17 AM <DIR> 0992_Correspondence
JUNKCHECKIT:
dro$ = "dir f:\" + PN$ + " > junk.tmp"
SHELL "cmd /c " + dro$
OPEN "junk.tmp" FOR INPUT AS #1
DO UNTIL EOF(1)
LINE INPUT #1, a$
IF INSTR(a$, PN$) <> 0 THEN
x$ = RTRIM$(LTRIM$(MID$(a$, 40, 4)))
IF x$ = PN$ THEN GOTO FOUNDIT
END
END IF
LOOP
CLOSE #1
RETURN
=================================
JUNK.TMP
Volume in drive F is DATA
Volume Serial Number is F0CA-6319
Directory of f:\0992
12/15/2008 02:40 PM <DIR> .
12/15/2008 02:40 PM <DIR> ..
12/15/2008 09:39 AM <DIR> 0992Junk
11/17/2008 01:22 PM 9,654,272 0992_Central.rvt
11/17/2008 01:22 PM <DIR> 0992_Central_backup
10/06/2008 10:17 AM <DIR> 0992_Correspondence