forked from alura-cursos/cursoopencobol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperform-until.cbl
50 lines (43 loc) · 1.53 KB
/
perform-until.cbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
IDENTIFICATION DIVISION.
PROGRAM-ID. PRGCOB17.
******************************************************
*** AREA DE COMENTARIOS - REMARKS
*** OBJETIVO DO PROGRAMA = PERFORM COM REPETICOES CONTROLADAS
*** POR SAIDA FORCADA (UNTIL)
*** AUTOR: IVAN
*** DATA : XX/XX/20XX
******************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WRK-VENDAS PIC 9(06)V99 VALUE ZEROS.
77 WRK-QT PIC 9(02) VALUE ZEROS.
77 WRK-MEDIA PIC 9(06)V99 VALUE ZEROS.
77 WRK-ACUM PIC 9(07)V99 VALUE ZEROS.
PROCEDURE DIVISION.
0001-PRINCIPAL.
PERFORM 0100-INICIALIZAR
IF WRK-VENDAS GREATER 0
PERFORM 0200-PROCESSAR UNTIL WRK-VENDAS = 0
END-IF
PERFORM 0300-FINALIZAR
STOP RUN
.
0100-INICIALIZAR.
DISPLAY 'DIGITE O NUMERO..... : '
ACCEPT WRK-VENDAS
.
0200-PROCESSAR.
ADD 1 TO WRK-QT
ADD WRK-VENDAS TO WRK-ACUM
PERFORM 0100-INICIALIZAR
.
0300-FINALIZAR.
DISPLAY '---------------------'
DISPLAY 'TOTAL DAS VENDAS ' WRK-ACUM
DISPLAY 'QUANTIDADE DE VENDAS ' WRK-QT
DISPLAY ' FIM DE PROCESSAMENTO '
.