Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IDENTIFICATION DIVISION.
- PROGRAM-ID. PROG007.
- AUTHOR. PEDRO.
- *
- ENVIRONMENT DIVISION.
- CONFIGURATION SECTION.
- SPECIAL-NAMES.
- DECIMAL-POINT IS COMMA.
- INPUT-OUTPUT SECTION.
- FILE-CONTROL.
- SELECT CADCLI ASSIGN TO DISK.
- SELECT ALTCLI ASSIGN TO DISK.
- SELECT CADCLIN ASSIGN TO DISK.
- *
- DATA DIVISION.
- FILE SECTION.
- FD CADCLI
- LABEL RECORD IS STANDARD
- RECORD CONTAINS 92 CHARACTERS
- DATA RECORD IS WS-REG-CADCLI
- VALUE OF FILE-ID "C:\IDECobol\cadcli.txt".
- 01 WS-REG-CADCLI.
- 05 WS-CHAVE-CADCLI.
- 10 WS-CADCLI-AGENCIA PIC 9(05).
- 10 WS-CADCLI-NUMERO-CONTA PIC 9(10).
- 05 WS-CADCLI-NOME-CLIENTE PIC X(40).
- 05 WS-CADCLI-TELEFONE PIC 9(08).
- 05 WS-CADCLI-SALDO-ATUAL PIC S9(11)V99.
- 05 WS-DATA-GRAVACAO.
- 10 WS-CADCLI-ANO-GRAVACAO PIC 9(04).
- 10 WS-CADCLI-MES-GRAVACAO PIC 9(02).
- 10 WS-CADCLI-DIA-GRAVACAO PIC 9(02).
- 05 WS-CADCLI-HORA-GRAVACAO PIC 9(08).
- FD ALTCLI
- LABEL RECORD IS STANDARD
- RECORD CONTAINS 76 CHARACTERS
- DATA RECORD IS WS-REGISTRO-ALTCLI
- VALUE OF FILE-ID "C:\IDECobol\altcli.txt".
- 01 WS-REGISTRO-ALTCLI.
- 05 WS-CHAVE-ALTCLI.
- 10 WS-ALTCLI-AGENCIA PIC 9(05).
- 10 WS-ALTCLI-NUMERO-CONTA PIC 9(10).
- 05 WS-ALTCLI-NOME-CLIENTE PIC X(40).
- 05 WS-ALTCLI-TELEFONE PIC 9(08).
- 05 WS-ALTCLI-RENDA-MENSAL PIC S9(11)V99.
- FD CADCLIN
- LABEL RECORD IS STANDARD
- RECORD CONTAINS 105 CHARACTERS
- DATA RECORD IS WS-REGISTRO-CADCLIN
- VALUE OF FILE-ID "C:\IDECobol\cadclin.txt".
- 01 WS-REGISTRO-CADCLIN.
- 05 WS-CADCLIN-AGENCIA PIC 9(05).
- 05 WS-CADCLIN-NUMERO-CONTA PIC 9(10).
- 05 WS-CADCLIN-NOME-CLIENTE PIC X(40).
- 05 WS-CADCLIN-TELEFONE PIC 9(08).
- 05 WS-CADCLIN-RENDA-MENSAL PIC S9(11)V99.
- 05 WS-CADCLIN-SALDO-ATUAL PIC S9(11)V99.
- 05 WS-CADCLIN-DATA-GRAVACAO.
- 10 WS-CADCLIN-ANO-GRAVACAO PIC 9(04).
- 10 WS-CADCLIN-MES-GRAVACAO PIC 9(02).
- 10 WS-CADCLIN-DIA-GRAVACAO PIC 9(02).
- 05 WS-CADCLIN-HORA-GRAVACAO PIC 9(08).
- WORKING-STORAGE SECTION.
- 01 WS-HORA.
- 05 WS-HRA PIC 9(02) VALUE ZEROS.
- 05 WS-MIN PIC 9(02) VALUE ZEROS.
- 05 WS-SEC PIC 9(02) VALUE ZEROS.
- 05 WS-CSE PIC 9(02) VALUE ZEROS.
- 01 WS-DATA.
- 05 WS-ANO PIC 9(02) VALUE ZEROS.
- 05 WS-MES PIC 9(02) VALUE ZEROS.
- 05 WS-DIA PIC 9(02) VALUE ZEROS.
- *
- PROCEDURE DIVISION.
- 010-INICIO.
- ACCEPT WS-DATA FROM DATE.
- ACCEPT WS-HORA FROM TIME.
- OPEN INPUT CADCLI.
- OPEN INPUT ALTCLI.
- OPEN OUTPUT CADCLIN.
- PERFORM 030-LER-CADCLI.
- PERFORM 040-LER-ALTCLI.
- PERFORM 020-COMPARA UNTIL WS-CHAVE-CADCLI = HIGH-VALUE
- AND WS-CHAVE-ALTCLI = HIGH-VALUE.
- 020-COMPARA.
- IF WS-CHAVE-CADCLI EQUAL WS-CHAVE-ALTCLI
- MOVE WS-ALTCLI-AGENCIA TO WS-CADCLIN-AGENCIA
- MOVE WS-ALTCLI-NUMERO-CONTA TO WS-CADCLIN-NUMERO-CONTA
- MOVE WS-ALTCLI-NOME-CLIENTE TO WS-CADCLIN-NOME-CLIENTE
- MOVE WS-ALTCLI-TELEFONE TO WS-CADCLIN-TELEFONE
- MOVE WS-ALTCLI-RENDA-MENSAL TO WS-CADCLIN-RENDA-MENSAL
- MOVE WS-CADCLI-SALDO-ATUAL TO WS-CADCLIN-SALDO-ATUAL
- MOVE WS-ANO TO WS-CADCLIN-ANO-GRAVACAO
- MOVE WS-MES TO WS-CADCLIN-MES-GRAVACAO
- MOVE WS-DIA TO WS-CADCLIN-DIA-GRAVACAO
- MOVE WS-HORA TO WS-CADCLIN-HORA-GRAVACAO
- WRITE WS-REGISTRO-CADCLIN
- PERFORM 030-LER-CADCLI
- PERFORM 040-LER-ALTCLI
- ELSE
- IF WS-CHAVE-CADCLI > WS-CHAVE-ALTCLI
- MOVE WS-ALTCLI-AGENCIA TO WS-CADCLIN-AGENCIA
- MOVE WS-ALTCLI-NUMERO-CONTA TO WS-CADCLIN-NUMERO-CONTA
- MOVE WS-ALTCLI-NOME-CLIENTE TO WS-CADCLIN-NOME-CLIENTE
- MOVE WS-ALTCLI-TELEFONE TO WS-CADCLIN-TELEFONE
- MOVE WS-ALTCLI-RENDA-MENSAL TO WS-CADCLIN-RENDA-MENSAL
- MOVE ZEROS TO WS-CADCLIN-SALDO-ATUAL
- MOVE WS-ANO TO WS-CADCLIN-ANO-GRAVACAO
- MOVE WS-MES TO WS-CADCLIN-MES-GRAVACAO
- MOVE WS-DIA TO WS-CADCLIN-DIA-GRAVACAO
- MOVE WS-HORA TO WS-CADCLIN-HORA-GRAVACAO
- WRITE WS-REGISTRO-CADCLIN
- PERFORM 040-LER-ALTCLI
- ELSE
- PERFORM 030-LER-CADCLI.
- 030-LER-CADCLI.
- READ CADCLI AT END MOVE HIGH-VALUE TO WS-CHAVE-CADCLI.
- 040-LER-ALTCLI.
- READ ALTCLI AT END MOVE HIGH-VALUE TO WS-CHAVE-ALTCLI.
- 090-FIM.
- CLOSE CADCLI.
- CLOSE ALTCLI.
- CLOSE CADCLIN.
- STOPRUN.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement