Msg: 4448 *Conference*

06-24-93 11:37:05

From: CARROLL LEWIS

To : ALL

Subj: HELP ME, PLEASE

   An interesting problem has come up and, although I have been able to correct
it I am still at a loss as to the cause.
 
 I have added a gosub routine to the "B3OF9CLK.BA" program uploaded in "7" on
the bbs.
 
 At the end of the day this routine opens a ".do" file (for append as 4 )  with
the name "OLD"+ the employees #, and prints a carrige return. Then the current
day file is opened (for input as 3), the contents are read and printed into
"old". When the EOF (3) is reached the commands to close (day and old) are
given, then "day" is killed, and finnally the return.
 
 All this works just fine except that somehow the wand (opened for input as 1
in line 3) gets closed and the program goes to the error trap.
 
 What I can't figure out is WHY the wand got closed. 
 
 The changes to the program are:
 
 line 2 changed maxfiles from 3 to 4
 
 line 28 added  GOSUB38  between "close3" and "goto24"
 
 added:
 38 F4="OLD"+MID$(E,3,2)+".DO":OPENF4FOR APPEND AS 4:OPEN F3 FOR INPUT AS3:CLS:
PRINT@55,"UP-DATING": PRINT#4 CHR$(13)
 
 39 IF EOF (3) THEN CLOSE3:CLOSE4:KILLF3 :RETURN
 
 40 LINE INPUT#3,B$:PRINT#4,B$:GOTO39
 
 Those are the original changes made. When run as above, the program "returns"
to line 28, then goes to line 24 where files 2 and 3 are closed and goes to
line 7. Line 7 is exicuted, line 8 is exicuted, line 9 errors at the command to
"line input #1" (error 58, file not open), exicution then branches to the error
trap on line 29,  "flashes" the message " error # 58 in line 9" one time, and
then continues to flash on and off with the message "error 58 in line 32" (I
use input#1 as a "stop")
 
 The "fix" to this problem is:
 
 line 39 add OPEN"WAND:"FOR INPUT AS1 between killf3 and return 
 
 The only new commands are "KILLF3" and "PRINT#1,CHR$(13)". The print command
is not the culprit as I have run it with it removed, so it seems likely that
"kill" is closing the wand. Any help? any IDEAS?? ANY EXPLAINATIONS???
 
 -CARROLL LEWIS-