0
respostas

Tentei fazer sem sozinho

      ******************************************************************
      * AREA DE COMENTARIO - REMARKS
      * Author: RENILSON BINHO
      * Date: 04/01/2021
      * OBJETIVO: RECEBER VENDAS NO MES
      * RETORNAR FECHAMENTO DE VENDA DE TODOS OS MESES
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PROGFECHAMENTODOMES.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
           DECIMAL-POINT IS COMMA.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WRK-MESES-EXTENSO.
           02 FILLERS PIC X(3) VALUE 'JAN'.
           02 FILLERS PIC X(3) VALUE 'FEV'.
           02 FILLERS PIC X(3) VALUE 'MAR'.
           02 FILLERS PIC X(3) VALUE 'ABR'.
           02 FILLERS PIC X(3) VALUE 'MAI'.
           02 FILLERS PIC X(3) VALUE 'JUN'.
           02 FILLERS PIC X(3) VALUE 'JUL'.
           02 FILLERS PIC X(3) VALUE 'AGO'.
           02 FILLERS PIC X(3) VALUE 'SET'.
           02 FILLERS PIC X(3) VALUE 'OUT'.
           02 FILLERS PIC X(3) VALUE 'NOV'.
           02 FILLERS PIC X(3) VALUE 'DEZ'.

       01 WRK-MESES REDEFINES WRK-MESES-EXTENSO.
           02 WRK-MES PIC X(03) OCCURS 12 TIMES.

       77 WRK-VENDA PIC 9(5)V99 VALUE ZEROS.

       01 WRK-ACUMULOS.
           02 WRK-ACUM PIC 9(7)V99 OCCURS 12 TIMES.

       77 WRK-ACUM-ED PIC $Z.ZZZ.ZZ9,99.

       77 WRK-NUM-MES PIC 99 VALUE ZEROS.

       77 WRK-CONT PIC 99 VALUES ZEROS.

       PROCEDURE DIVISION.

       0001-PRINCIPAL.
           PERFORM 0100-INICIAR.
           IF WRK-NUM-MES NOT EQUALS 99
      * EXECULTA 0200-PROCESSAR ATE QUE WRK-NUM-MES = 99
               PERFORM 0200-PROCESSAR UNTIL WRK-NUM-MES = 99
           END-IF.
           DISPLAY ''.
           DISPLAY '---------------------------------'.
           PERFORM 0300-FINALIZAR.
           STOP RUN.

       0100-INICIAR.
           DISPLAY 'VALOR DA VENDA...'
           ACCEPT WRK-VENDA.
           DISPLAY 'NUMERO DO MES DA VENDA...'
           ACCEPT WRK-NUM-MES.


       0200-PROCESSAR.
           COMPUTE WRK-ACUM(WRK-NUM-MES) = WRK-ACUM(WRK-NUM-MES) 
           + WRK-VENDA.
           PERFORM 0100-INICIAR.

       0300-FINALIZAR.
           PERFORM VARYING WRK-CONT FROM 1 BY 1 UNTIL WRK-CONT > 12
               MOVE WRK-ACUM(WRK-CONT) TO WRK-ACUM-ED
               DISPLAY 'TOTAL DE VENDAS ' WRK-MES(WRK-CONT) ': '
               WRK-ACUM-ED
           END-PERFORM.
       END PROGRAM PROGFECHAMENTODOMES.