Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie seeks help

Status
Not open for further replies.

JOE50

Vendor
Joined
Jul 14, 2003
Messages
2
Location
GB
Why does this give a "subscript out of range"? It was working but I must have changed something and I do not see it. I have marked where the prog goes wrong with “” Your help will be appreciated.

DIM M$(9)
SHELL "if exist go.bat del go.bat"
PRINT : PRINT : PRINT
PRINT "This program requires 5 files"
PRINT
PRINT " file description"
PRINT " HEADER start of script action"
PRINT " FILLER script action per drawing !!! = drawing"
PRINT " FOOTER last action of script"
PRINT " LISTING list with all drawings to do without extension"
PRINT " BAT One line containing action for all files"
PRINT
OPEN "header" FOR INPUT AS #2
OPEN "new.scr" FOR OUTPUT AS #3
WHILE NOT EOF(2)
LINE INPUT #2, h$
PRINT #3, h$
WEND
CLOSE 2
CLOSE 3
OPEN "listing" FOR INPUT AS #1
 WHILE NOT EOF(1)
FOR x = 1 TO 9
M$(x) = ""
NEXT
LINE INPUT #1, File$
Tel = 1
WHILE INSTR(File$, "|") > 0
M$(Tel) = MID$(File$, 1, INSTR(File$, "|") - 1)
Tel = Tel + 1
File$ = MID$(File$, INSTR(File$, "|") + 1)
WEND
M$(Tel) = File$
 ' All vars are in use now where Tel is the max
OPEN "bat" FOR INPUT AS #2
OPEN "go.bat" FOR APPEND AS #3
LINE INPUT #2, h$
WHILE INSTR(h$, "!!!") > 0
Etc
 
tricky one - i have not found a real problem - here are some tips that might help you.
First of all you have two WHILE statements and only one WEND also try specifying a variable for the NEXT statement. Although you do not have to in qb i always do
try:
FOR x = 1 TO 9
M$(x) = ""
NEXT x

 
Qbasicking,

Thank you for your input. I got it working by increasing the Dim var. to 10 (Dim M$ (10) at the beginning. This I did for Tel can become 10 (Tel =Tel+1) but I only needed nine var's. Once again thanks.

Joe50
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top