Page 1 of 1

noob_seeking_help(syntax error)

Posted: Tue Oct 11, 2016 11:37 pm
by azure8bit
I keep getting a syntax error line 48 on my "READ type$, size, rate, charter, revenue."I am sure it is something simple. I can't figure it out and it's driving me crazy. Any help would be appreciated.

My code:

Code: Select all


'************Mainline*********
cls
gosub InitializeVariable
gosub printheadings
gosub ProcessDetail
gosub printtotals
end

'**************************SET UP CONSTANTS***************************
InitializeVariable:
PAGE.HEADING$ = "                    REPORT TITLE                 PAGE ##"
DETAIL.HEAD.1$ = "type          size      rate      charter    revenue"
DETAIL.type$ = "  \            \ SUBTOTAL          ###        $#####.## "
DETAIL.TOTAL$ = "   \TOTAL REVENUE FOR HOURS CHARTERED\  ###.#"
a1$ = "\            \###       ###        ###        $#####.##"
rt$ = "                  Report Total       ##,###"

RETURN

'**********************READ IN VARIABLE INFORMATION FROM DATA STATEMENTS***********************
PrintHeadings:
PAGE = PAGE + 1
PRINT USING PAGE.HEADING$;Page
PRINT
PRINT DETAIL.HEAD.1$
PRINT

RETURN

'******************Process Detail*********************
processdetail:
gosub readdata
do until Type$ = "EOD"
    gosub printdetail
    gosub calcsubtotal
    typesave$ = TYPE$
    gosub readdata
    if TypeSave$ <> Type$ then
        gosub printsubtotals
    end if
loop

return

'***********************  READ COURSE DATA  *******************************

ReadData:
READ type$, size, rate, charter, revenue
RETURN


'*******************DATA STATEMENTS*************************

DATA RANGER,22,95.00,24
DATA RANGER,22,69.00,12
DATA WAVELENGTH,24,69.00,6
DATA WAVELENGTH,24,69.00,12
DATA CATALINA,27,160.00,24
DATA CATALINA,27,99.00,6
DATA CATALINA,30,190.00,12
DATA CATALINA,30,225.00,24
DATA CORONADO,32,230.00,24
DATA HOBIE,33,192.00,33
DATA HOBIE,33,235.00,24
DATA HOBIE,33,137.00,6
DATA HOBIE,33,235.00,24
DATA C & C,34,290.00,24
DATA C & C,34,175.00,6
DATA CATALINA,36,185.00,6
DATA CATALINA,36,320.00,24
DATA HANS CHRISTIAN,38,250.00,6
DATA EXCALIBER,45,550.00,24
DATA EXCALIBER,45,295.00,6
DATA EOD,0,0,0

'*******************PrintDetail**************************
PrintDetail:
REVENUE = RATE * CHARTER
print using a1$; type$, size,rate,charter,revenue
RETURN

'*******************Calc SubTotal************************

CalcSubTotal:
calsubchar = calsubchar + CHARTER
tot.revenue = tot.revenue + REVENUE


return

'*********************PRINT SUBTOTALS**************
PrintSubtotals:
PRINT
PRINT USING DETAIL.type$;typesave$,calsubchar,tot.revenue
print

chartot = chartot + calsubchar
calsubchar = 0
LINECT = LINECT + 3
typesave$ = TYPE$
RETURN

'*******************Print Totals****************************
PrintTotals:
print using Rt$;CharTot
RETURN





Re: noob_seeking_help(syntax error)

Posted: Wed Oct 12, 2016 8:35 pm
by burger2227
READ can only read 4 data values, not 5. The decimal point is not a data separator in your data.
You need to either remove one numerical variable or add a numerical one to each DATA line.

So why doesn't it just read the next DATA line? Because it is a STRING value for a number so it errors.
Otherwise it would eventually run out of data.

PRINT USING can use $$ instead of just $ to place the $ immediately in front of the numbers.

Re: noob_seeking_help(syntax error)

Posted: Thu Oct 13, 2016 3:16 am
by azure8bit
That solved it! Thank you :D