IDENTIFICATION DIVISION.
       PROGRAM-ID.    CWCAD2.
       AUTHOR.        COBOLware Services Ltda.
       DATE-WRITTEN.  99/99/9999.
       SECURITY.      *************************************************
                      *                                               *
                      *  Exemplo de modulo validador                  *
                      *                                               *
                      *************************************************
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES. DECIMAL-POINT IS COMMA.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

       DATA DIVISION.
       FILE SECTION.

       WORKING-STORAGE SECTION.

       77  TECLA                      PIC  9(002). COPY CWKEYS.

       LINKAGE SECTION.

       01  ERRO                       PIC  9(001).

       01  DADOS                      PIC X(2000).
       01  TELA-CHAVE REDEFINES DADOS.
           05 FileName-CODIGO         PIC  9(005).
       01  TELA-DADOS REDEFINES DADOS.
           05 FileName-DESCRICAO      PIC  X(030).
           05 FileName-PRECO          PIC  9(008)V99.
           05 CWRADIO OCCURS 3        PIC  X(001).
           05 CWCHECK OCCURS 3        PIC  X(001).

       01  FIELD                      PIC  X(030).
       01  SUBSCRIPT                  PIC  9(003).

       PROCEDURE DIVISION USING ERRO DADOS FIELD SUBSCRIPT.

       000-INICIO.

           MOVE 0 TO ERRO
           ACCEPT TECLA FROM ESCAPE KEY

           EVALUATE FIELD
               WHEN "FILENAME-DESCRICAO"
                    IF   FileName-DESCRICAO = SPACES
                         EXEC COBOLware Send
                              Message "Falta descrição"
                         END-EXEC
                         MOVE 1 TO ERRO
                    END-IF
               WHEN "FILENAME-PRECO"
                    IF   FileName-PRECO = 0
                         EXEC COBOLware Send
                              Message "Falta preço"
                         END-EXEC
                         MOVE 1 TO ERRO
                    END-IF
               WHEN "CWRADIO"
                    IF   SUBSCRIPT = 3
                    AND (CWRADIO (1) NOT = '1')
                    AND (CWRADIO (2) NOT = '1')
                    AND (CWRADIO (3) NOT = '1')
                         EXEC COBOLware Send
                              Message "Falta tipo"
                         END-EXEC
                         MOVE 1 TO ERRO
                    END-IF
           END-EVALUATE.

       000-99-FIM. GOBACK.

       END PROGRAM CWCAD2.