FileClose Greater than 5 Files Error
Keywords: fileclose
Question:
When a certain file is run it gets the date and time then writes it to a log file. After it writes 5 times I get the Error >5 files open. I can step through with debug and it looks like everything is being processed properly, but after 5 writes it goes Kaput. The code is straight from the book. Any Ideas?This is the code:
:LOG IF FILEEXIST(LOGFILE) THEN FMODE = "APPEND" ELSE FMODE = "WRITE" END IF HOLD=FILEOPEN(LOGFILE,"%FMODE%") FILEWRITE(HOLD, "%LOGLINE%") FILECLOSE(HOLD) RETURNAnswer:
This particular code sample looks good. I suspect you are doing a FileOpen elsewhere without a FileClose, and it just catches up with you here.If you are running your WBT script, by first launching WINBATCH.EXE (or WBAT16I.EXE), then you will run into this 5 file limitation. The solution is to launch your script from File Manager or Explorer, by double clicking on your WBT file.
Article ID: W13059Filename: FileClose Greater than 5 Files Error.txt