Announcement

Collapse
No announcement yet.

Program code not executing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Program code not executing

    This is the whole program that the other code is from that does
    not execute.

    $compile exe
    $cpu 80386
    ' Name of Program Order.bas
    ' Date of Program 9/28/2005
    ' Function - Inputs Customer order to be printed to Invoice.
    NEWSTART:
    RESET
    ON ERROR GOTO NEWSTART
    DIM NA$(500)
    DIM AD$(500)
    DIM A2$(500)
    DIM CT$(500)
    DIM ST$(500)
    DIM ZP$(500)


    OPEN "INV.MST" FOR INPUT AS #7
    DO WHILE NOT EOF(7)
    LINE INPUT #7, NBR$
    NBR1$ = MID$(NBR$,2,6)
    NBR = VAL(NBR1$)
    LOOP


    OPEN "CUSTBASE.MST" FOR INPUT AS #1
    DO WHILE NOT EOF(1)
    LINE INPUT #1, REK$
    CUST$ = MID$(REK$,1,30) '1-30
    ADDR$ = MID$(REK$,31,30) '31-60
    ADD2$ = MID$(REK$,61,25) '61-90
    CITY$ = MID$(REK$,91,20) '91-110
    STAT$ = MID$(REK$,111,2) '111-112
    ZIP$ = MID$(REK$,113,10) '113-122
    CONT$ = MID$(REK$,123,30) '123-152
    PHON$ = MID$(REK$,153,12) '153-164
    CNDT$ = MID$(REK$,165,10) '165-174
    DISC$ = MID$(REK$,175,2) '175-176
    AC$ = MID$(REK$,177,4) '177-180
    MEMO$ = MID$(REK$,181,40) '181-220
    AC = VAL(AC$)
    NA$(AC)=CUST$
    AD$(AC)=ADDR$
    A2$(AC)=ADD2$
    CT$(AC)=CITY$
    ST$(AC)=STAT$
    ZP$(AC)=ZIP$
    LOOP

    close #1
    close #7
    CLS
    COLOR 15,1 '20 LINES
    ' 1 2 3 4 5 6 7
    ' 345678901234567890123456789012345678901234567890123456789012345678901234
    LOCATE 3, 3: PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ "
    LOCATE 4, 3: PRINT " ³ Cust# ____ Name ______________________________ Invioce# _____ ³ "
    LOCATE 5, 3: PRINT " ³ Addr1 ______________________________ Addr2 ________________________ ³ "
    LOCATE 6, 3: PRINT " ³ City ____________________ State __ Zip _____-____ ³ "
    LOCATE 7, 3: PRINT " ³ Date __/__/____ Book ___________________________________ Page __ ³ "
    LOCATE 8, 3: PRINT " ³ Qty |Card# |Verse| Price | Extention ³ "
    LOCATE 9 ,3: PRINT " ³------|----------------------------------- ----- -------- ----------- ³ "
    LOCATE 10,3: PRINT " 1³______|___________________________________|_____|________|___________ ³ "
    LOCATE 11,3: PRINT " 2³______|___________________________________|_____|________|___________ ³ "
    LOCATE 12,3: PRINT " 3³______|___________________________________|_____|________|___________ ³ "
    LOCATE 13,3: PRINT " 4³______|___________________________________|_____|________|___________ ³ "
    LOCATE 14,3: PRINT " 5³______|___________________________________|_____|________|___________ ³ "
    LOCATE 15,3: PRINT " 6³______|___________________________________|_____|________|___________ ³ "
    LOCATE 16,3: PRINT " 7³______|___________________________________|_____|________|___________ ³ "
    LOCATE 17,3: PRINT " 8³______|___________________________________|_____|________|___________ ³ "
    LOCATE 18,3: PRINT " 9³______|___________________________________|_____|________|___________ ³ "
    LOCATE 19,3: PRINT " ³______|___________________________________|_____|________|___________ ³ "
    LOCATE 20,3: PRINT " ³______|___________________________________|_____|________|___________ ³ "
    LOCATE 21,3: PRINT " ³______|___________________________________|_____|________|___________ ³ "
    LOCATE 22,3: PRINT " ³ ³ "
    LOCATE 23,3: PRINT " ³ Total-> ___________ | "
    LOCATE 24,3: PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
    LOCATE 25,3: PRINT " "
    LOCATE 3,13: INPUT,CUS$
    CUS = VAL(CUS$)
    IVS = NBR + 1
    LOCATE 3,23: PRINT NA$(CUS)
    LOCATE 4,13: PRINT AD$(CUS)
    LOCATE 4,50: PRINT A2$(CUS)
    LOCATE 3,68: PRINT IVS
    LOCATE 5,12: PRINT CT$(CUS)
    LOCATE 5,39: PRINT ST$(CUS)
    LOCATE 5,46: PRINT ZP$(CUS)
    LOCATE 6,12: INPUT,DAT$
    LOCATE 6,28: INPUT,BOOK$
    LOCATE 6,69: INPUT,PAG$

    CYCL:
    DEFINT A-Z
    DO
    DO
    A$=INKEY$
    LOOP WHILE A$=""
    IF LEN(A$)=2 THEN
    ZX = ASC(RIGHT$(A$,1))
    END IF
    IF ZX = 63 THEN
    GOSUB DISC1 'DISCOUNT
    END IF
    IF ZX = 63 THEN
    GOSUB SLST 'SALES TAX
    END IF
    IF ZX = 65 THEN
    GOSUB SLST 'SALES TAX
    END IF
    IF ZX = 27 THEN 'ESC KEY
    GOTO donegone
    END IF
    IF ZX = 59 THEN 'FIRST INPUT LINE F1
    gosub first
    END IF
    IF ZX = 60 THEN 'SECOND INPUT LINE F2
    GOSUB SECOND
    END IF
    IF ZX = 61 THEN 'THIRD INPUT LINE F3
    GOSUB THIRD
    END IF
    LOOP WHILE A$ <> CHR$(27) 'NOT ESC KEY


    donegone:
    END


    rem load 1st line
    first:
    LOCATE 9,6: INPUT,Q1
    LOCATE 9,13: INPUT,CD1$
    LOCATE 9,49: INPUT,VRS1$
    LOCATE 9,56: INPUT,PRIC1
    E1 = Q1 * .01
    EX1 = E1 * PRIC1
    LOCATE 9,66: PRINT USING$("######.##",EX1)
    TOTALA = TOTALA + EX1
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 2nd line
    second:
    LOCATE 10,6: INPUT,Q2
    LOCATE 10,13: INPUT,CD2$
    LOCATE 10,49: INPUT,VRC2$
    LOCATE 10,56: INPUT,PRIC2
    E2 = Q2 * .01
    EX2 = E2 * PRIC2
    LOCATE 10,66: PRINT USING$("######.##",EX2)
    TOTALA = TOTALA + EX2
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 3rd line
    third:
    LOCATE 11,6: INPUT,Q3
    LOCATE 11,13: INPUT,CD3$
    LOCATE 11,49: INPUT,VRC3$
    LOCATE 11,56: INPUT,PRIC3
    E3 = Q3 * .01
    EX3 = E3 * PRIC3
    LOCATE 11,66: PRINT USING$("######.##",EX3)
    TOTALA = TOTALA + EX3
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 4th line
    fourth:
    LOCATE 12,6: INPUT,Q4
    LOCATE 12,13: INPUT,CD4$
    LOCATE 12,49: INPUT,VRC4$
    LOCATE 12,56: INPUT,PRIC4
    E4 = Q4 * .01
    EX4 = E4 * PRIC4
    LOCATE 12,66: PRINT USING$("######.##",EX4)
    TOTALA = TOTALA + EX4
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 5th line
    fifth:
    LOCATE 13,6: INPUT,Q5
    LOCATE 13,13: INPUT,CD5$
    LOCATE 13,49: INPUT,VRC5$
    LOCATE 13,56: INPUT,PRIC5
    E5 = Q5 * .01
    EX5 = E5 * PRIC5
    LOCATE 13,66: PRINT USING$("######.##",EX5)
    TOTALA = TOTALA + EX5
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 6th line
    sixth:
    LOCATE 14,6: INPUT,Q6
    LOCATE 14,13: INPUT,CD6$
    LOCATE 14,49: INPUT,VRC6$
    LOCATE 14,56: INPUT,PRIC6
    E6 = Q6 * .01
    EX6 = E6 * PRIC6
    LOCATE 14,66: PRINT USING$("######.##",EX6)
    TOTALA = TOTALA + EX6
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 7th line
    seventh:
    LOCATE 15,6: INPUT,Q7
    LOCATE 15,13: INPUT,CD7$
    LOCATE 15,49: INPUT,VRC7$
    LOCATE 15,56: INPUT,PRIC7
    E7 = Q7 * .01
    EX7 = E7 * PRIC7
    LOCATE 15,66: PRINT USING$("######.##",EX7)
    TOTALA = TOTALA + EX7
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 8th line
    eighth:
    LOCATE 16,6: INPUT,Q8
    LOCATE 16,13: INPUT,CD8$
    LOCATE 16,49: INPUT,VRC8$
    LOCATE 16,56: INPUT,PRIC8
    E8 = Q8 * .01
    EX8 = E8 * PRIC8
    LOCATE 16,66: PRINT USING$("######.##",EX8)
    TOTALA = TOTALA + EX8
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return
    rem load 9th line
    nineth:
    LOCATE 17,6: INPUT,Q9
    LOCATE 17,13: INPUT,CD9$
    LOCATE 17,49: INPUT,VRC9$
    LOCATE 17,56: INPUT,PRIC9
    E9 = Q9 * .01
    EX9 = E9 * PRIC9
    LOCATE 17,66: PRINT USING$("######.##",EX9)
    TOTALA = TOTALA + EX9
    LOCATE 18,65: PRINT USING$("#######.##",TOTALA)
    return

    SLST:
    IF BALA = 0 THEN
    TAXA = TOTALA * .06
    TTOT = TOTALA + TAXA
    END IF
    IF BALA <> 0 THEN
    TAXA = BALA * .06
    TTOT = BALA + TAXA
    END IF
    LOCATE 21,55: PRINT " 6% TAX "
    LOCATE 21,65: PRINT USING$("#######.##",TAXA)
    LOCATE 22,65: PRINT USING$("#######.##",TTOT)
    open "INV.MST" FOR OUTPUT AS #6
    PRINT #6, using$("#####",IVS)

    RETURN

    DISC1:
    TOTALA = 1000.00
    LOCATE 22,30: INPUT "ENTER DISC.PCT. ",DXX
    PXX = DXX * .01 '<---does NOT execute this line in subroutine
    DSC = TOTALA * PXX
    bala = TOTALA - DSC
    LOCATE 22,30: PRINT " "
    LOCATE 20,15: PRINT using$("######.####",PXX)
    LOCATE 21,10: PRINT "PXX= ";PXX
    LOCATE 19,55: PRINT DXX;"% Disc"
    LOCATE 19,65: PRINT USING$("#######.##",DSC)
    LOCATE 20,65: print using$("#######.##",bala)
    return


    ------------------

  • #2
    Code:
    CYCL:
    DEFINT A-Z   <---- This line defines all variables to be integer variables
    DO                 which means the line that multiples * .01 means multiply by zero
    DO
    A$=INKEY$
    LOOP WHILE A$=""
    IF LEN(A$)=2 THEN
    ZX = ASC(RIGHT$(A$,1))
    END IF
    IF ZX = 63 THEN
    GOSUB DISC1 'DISCOUNT
    END IF
    KS

    ------------------

    Comment


    • #3
      Why does the ,06 in the sub SLST work if the integer is supposed
      to be zero???

      ------------------

      Comment


      • #4
        Sorry I was thinking about a different compiler that only allows integers.
        When you step through the code with the debugger what are does
        DXX and PXX show?
        KS

        P.S.
        When you mutliply your discount by .01 you are ending up with an amount less than one.
        If you enter 5.0 for a discount precent then multiply it by .01 you get .05, which rounds
        to 0, you will not get a 1 until you hit 51%.
        You need to check the help file and manuals about integers.
        ------------------


        [This message has been edited by keith shelton (edited November 07, 2005).]

        Comment

        Working...
        X