Re: dubbuging that script
- From: epc8@xxxxxxxx
- Date: 27 Feb 2006 15:57:12 -0800
gianluigi beuzard wrote:
## Could some people help me debbuging the DATA DIVISION of that gaz bill ?
IDENTIFICATION DIVISION.
PROGRAM-ID. FACTURE GAZ.
FACTURE-GAZ is safer here
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. CPU1.
OBJECT-COMPUTER. CPU1.
you may need
SPECIAL-NAMES.
CURRENCY SIGN IS "E".
here to match your PIC below
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NW-FACT PIC X.
88 FOK VALUES "O", "o".
88 FKO VALUES "N", "n".
77 NM PIC X(16).
77 CONS PIC 9(3)V99; COMP 3.
COMP-3
88 T1 VALUES 1.00 THRU 19.99.
88 T2 VALUES 20.00 THRU 49.99.
88 T3 VALUES 50.00 THRU 999.00.
What good does T1 through T3 do?????
01 VOL.
02 C1 PIC 99V99.
02 C2 PIC 99V99.
02 C3 PIC 9(3)V99.
77 TOT PIC 9(6)V9(3); COMP 3.
COMP-3
77 TOT-ED PIC E(5)9.9(3).
77 TVA PIC 9(5)V9(3); COMP 3.
COMP-3
77 CONS-ED PIC *(5)9.99.
77 CPT PIC 99; COMP 0; VALUE 30.
even if you change it to COMP-0 that serves no purpose.
just make it DISPLAY.
PROCEDURE DIVISION.
*structure
PROG.
PERFORM D-PROG.
PERFORM FACT UNTIL FKO.
PERFORM F-PROG.
why not
STOP RUN.
FACT.
PERFORM D-FACT.
unknown label
PERFORM CONS UNTIL CONS > 0.
PERFORM I-FACT.
WHY???????????
PERFORM A21.
PERFORM A22.
PERFORM A23.
PERFORM F-FACT.
*traitement
D-PROG.
DISPLAY "nom client ?".
ACCEPT NW-FACT.
F-FACT.
duplicate label, maybe you want
D-FACT.
DISPLAY "CONSOMMATION ?".
ACCEPT CONS.
CONS.
DISPLAY "Reintro consommation".
ACCEPT CONS.
I-FACT.
EXIT.
A21.
MOVE CONS TO C1.
A22.
MOVE 20 TO C1.
SUBTRACT C1 FROM CONS GIVING C2.
and what if C2 goes negative?
A23.
MOVE 20 TO C1.
MOVE 30 TO C2.
SUBTRACT C1, C2 FROM CONS GIVING C3.
and what if C3 goes negative?
F-FACT.
MOVE CONS TO CONS-ED.
DISPLAY (1,1) ERASE.
DISPLAY "NOM : ", NW-FACT, " CONSOMMATION : ", CONS-ED.
DISPLAY (5,1) "LOCATION DU COMPTEUR".
DISPLAY (5,20) CPT.
DISPLAY (7,1) "TARIF 1 ", C1, " m3 . .45E".
MULTIPLY .45 BY C1.
DISPLAY (7,20) C1.
C1 is not an EDITED field
DISPLAY (8,1) "TARIF 2 ", C2, " m3 . .55E".
MULTIPLY .55 BY C2.
DISPLAY (8,20) C2.
C2 is not an EDITED field
MULTIPLY .7 BY C3.
DISPLAY (9,1) "TARIF 3 ", C3, " m3 . .7E".
DISPLAY (9,20) C3.
C3 is not an EDITED field
ADD C1, C2, C3 TO TOT.
TOT is unintialized. Do you want to set it to ZERO first????
MOVE TOT TO TOT-ED.
DISPLAY (11,1) "TOTAL DES CONSOMMATIONS : ", TOT-ED.
MULTIPLY .14 BY TOT GIVING TVA.
MOVE TVA TO TOT-ED.
DISPLAY (12,1) "TVA SUR LES CONSOMMATIONS : ", TOT-ED.
DISPLAY (14,1) "A PAYER : ".
ADD TVA TO TOT GIVING TOT-ED.
Do you really want to do this? I am not sure you can do arithmetic on
an EDITED field.
So how about
ADD TVA TO TOT.
MOVE TOT TO TOT-ED.
DISPLAY (14,20) TOT-ED.
DISPLAY (17,1) "NOUVELLE FACTURE (O/N) ?".
ACCEPT (17,20) NW-FACT.
F-PROG.
EXIT.
[horrible error casecade snipped]
-- Elliot
note: The student still has plenty of work to do here. I've just
applied a dose of the old red pencil.
.
- References:
- dubbuging that script
- From: gianluigi beuzard
- dubbuging that script
- Prev by Date: Reasonably priced COBOL products (was: Where I can Download Netexpress ?
- Next by Date: Re: Selecting common records from two files.
- Previous by thread: Re: dubbuging that script
- Index(es):
Relevant Pages
|