missing END in Public SUB Statement

Questions regarding syntax

missing END in Public SUB Statement

Postby GaryVass » Thu Jan 20, 2011 5:01 am

I am receiving an strange error message....

"syntax error: missing END in line 6 near position 1" with the following code:

Public Sub StockData(filename As String, REPORT As String, tDataTick As String)


I thought perhaps it was a missing "END IF" inside of the sub, but that was not it. I have tested it by putting an End Sub every few lines to see if the error would disappear, essentially moving some code into another sub routine. And yes, there is an "End Sub" statement at the end of the subroutine. The subroutine is about 20 pages long, so I did not post it all here, but can if needed.

I get the same error in the Linux and the Windows version of KBasic.

Any ideas?

Thanks in advance.
GaryVass
 
Posts: 65
Joined: Mon Nov 19, 2007 6:53 am

Re: missing END in Public SUB Statement

Postby berndnoetscher » Thu Jan 20, 2011 8:29 am

GaryVass wrote:I am receiving an strange error message....

"syntax error: missing END in line 6 near position 1" with the following code:

Public Sub StockData(filename As String, REPORT As String, tDataTick As String)


I thought perhaps it was a missing "END IF" inside of the sub, but that was not it. I have tested it by putting an End Sub every few lines to see if the error would disappear, essentially moving some code into another sub routine. And yes, there is an "End Sub" statement at the end of the subroutine. The subroutine is about 20 pages long, so I did not post it all here, but can if needed.

I get the same error in the Linux and the Windows version of KBasic.

Any ideas?

Thanks in advance.


Please post your complete code, I guess it could be a variable name collision with a keyword.
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am

Re: missing END in Public SUB Statement

Postby Henning » Thu Jan 20, 2011 5:51 pm

The subroutine is about 20 pages long


With a Sub that big, I would split it up, moving parts of the code to their own subs/functions.

/Henning
Henning
 
Posts: 262
Joined: Mon Feb 09, 2009 12:03 am
Location: Sweden

Re: missing END in Public SUB Statement

Postby berndnoetscher » Fri Jan 21, 2011 9:47 am

Thanks for posting the code.

Remove the Public and Private keywords in front of your subs and it will work.

Public Sub StockData -> Sub StockData and so on...


Those keywords are not allowed in veryoldbasic as you use it.
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am

Re: missing END in Public SUB Statement

Postby GaryVass » Wed Feb 02, 2011 4:53 pm

Bernd,

Ok, I removed the public / private statements (tried to remove the option veryoldbasic, and line numbers, but that caused problems also).

Now the sub seems to compile correctly but I get an error on a form that Kbasic apparently made itself???? It says "missing ( in line 6 main form"

I did try to delete the main form, and use frmMenu (and changed the code below) but the error remains.

Code below:


' --- Begin: Inserted by KBasic Atelier automatically ---


frmMenu = New frmMenu
frmMenu.Open()
Application.Run()

' --- End: Inserted by KBasic Atelier automatically ---
GaryVass
 
Posts: 65
Joined: Mon Nov 19, 2007 6:53 am

Re: missing END in Public SUB Statement

Postby berndnoetscher » Thu Feb 03, 2011 10:04 am

Hi,

please send me the new code again. :-)
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am


Return to Coding Questions

cron