Pedr026

PROG007

Jun 19th, 2018
613
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.        IDENTIFICATION DIVISION.
  2.        PROGRAM-ID. PROG007.
  3.        AUTHOR.    PEDRO.
  4.       *
  5.        ENVIRONMENT DIVISION.
  6.        CONFIGURATION SECTION.
  7.        SPECIAL-NAMES.
  8.            DECIMAL-POINT IS COMMA.
  9.        INPUT-OUTPUT SECTION.
  10.        FILE-CONTROL.
  11.            SELECT CADCLI ASSIGN TO DISK.
  12.            SELECT ALTCLI ASSIGN TO DISK.
  13.            SELECT CADCLIN ASSIGN TO DISK.
  14.       *
  15.        DATA DIVISION.
  16.        FILE SECTION.
  17.        FD CADCLI
  18.           LABEL RECORD IS STANDARD
  19.           RECORD CONTAINS 92 CHARACTERS
  20.           DATA RECORD IS WS-REG-CADCLI
  21.           VALUE OF FILE-ID "C:\IDECobol\cadcli.txt".
  22.        01 WS-REG-CADCLI.
  23.         05 WS-CHAVE-CADCLI.
  24.          10 WS-CADCLI-AGENCIA PIC 9(05).
  25.          10 WS-CADCLI-NUMERO-CONTA PIC 9(10).
  26.         05 WS-CADCLI-NOME-CLIENTE PIC X(40).
  27.         05 WS-CADCLI-TELEFONE PIC 9(08).
  28.         05 WS-CADCLI-SALDO-ATUAL PIC S9(11)V99.
  29.         05 WS-DATA-GRAVACAO.
  30.          10 WS-CADCLI-ANO-GRAVACAO PIC 9(04).
  31.          10 WS-CADCLI-MES-GRAVACAO PIC 9(02).
  32.          10 WS-CADCLI-DIA-GRAVACAO PIC 9(02).
  33.         05 WS-CADCLI-HORA-GRAVACAO PIC 9(08).
  34.        FD ALTCLI
  35.          LABEL RECORD IS STANDARD
  36.          RECORD CONTAINS 76 CHARACTERS
  37.          DATA RECORD IS WS-REGISTRO-ALTCLI
  38.          VALUE OF FILE-ID "C:\IDECobol\altcli.txt".
  39.        01 WS-REGISTRO-ALTCLI.
  40.         05 WS-CHAVE-ALTCLI.
  41.          10 WS-ALTCLI-AGENCIA PIC 9(05).
  42.          10 WS-ALTCLI-NUMERO-CONTA PIC 9(10).
  43.         05 WS-ALTCLI-NOME-CLIENTE PIC X(40).
  44.         05 WS-ALTCLI-TELEFONE PIC 9(08).
  45.         05 WS-ALTCLI-RENDA-MENSAL PIC S9(11)V99.
  46.        FD CADCLIN
  47.           LABEL RECORD IS STANDARD
  48.           RECORD CONTAINS 105 CHARACTERS
  49.           DATA RECORD IS WS-REGISTRO-CADCLIN
  50.           VALUE OF FILE-ID "C:\IDECobol\cadclin.txt".
  51.        01 WS-REGISTRO-CADCLIN.
  52.         05 WS-CADCLIN-AGENCIA PIC 9(05).         
  53.         05 WS-CADCLIN-NUMERO-CONTA PIC 9(10).          
  54.         05 WS-CADCLIN-NOME-CLIENTE PIC X(40).
  55.         05 WS-CADCLIN-TELEFONE PIC 9(08).
  56.         05 WS-CADCLIN-RENDA-MENSAL PIC S9(11)V99.
  57.         05 WS-CADCLIN-SALDO-ATUAL PIC S9(11)V99.
  58.         05 WS-CADCLIN-DATA-GRAVACAO.
  59.          10 WS-CADCLIN-ANO-GRAVACAO PIC 9(04).
  60.          10 WS-CADCLIN-MES-GRAVACAO PIC 9(02).
  61.          10 WS-CADCLIN-DIA-GRAVACAO PIC 9(02).
  62.         05 WS-CADCLIN-HORA-GRAVACAO PIC 9(08).
  63.        WORKING-STORAGE SECTION.
  64.        01 WS-HORA.
  65.         05 WS-HRA PIC 9(02) VALUE ZEROS.
  66.         05 WS-MIN PIC 9(02) VALUE ZEROS.
  67.         05 WS-SEC PIC 9(02) VALUE ZEROS.
  68.         05 WS-CSE PIC 9(02) VALUE ZEROS.
  69.        01 WS-DATA.
  70.         05 WS-ANO PIC 9(02) VALUE ZEROS.
  71.         05 WS-MES PIC 9(02) VALUE ZEROS.
  72.         05 WS-DIA PIC 9(02) VALUE ZEROS.
  73.       *
  74.        PROCEDURE DIVISION.
  75.        010-INICIO.
  76.            ACCEPT WS-DATA FROM DATE.
  77.            ACCEPT WS-HORA FROM TIME.
  78.            OPEN INPUT CADCLI.
  79.            OPEN INPUT ALTCLI.
  80.            OPEN OUTPUT CADCLIN.
  81.            PERFORM 030-LER-CADCLI.
  82.            PERFORM 040-LER-ALTCLI.
  83.            PERFORM 020-COMPARA UNTIL WS-CHAVE-CADCLI = HIGH-VALUE
  84.                    AND WS-CHAVE-ALTCLI = HIGH-VALUE.
  85.        020-COMPARA.
  86.            IF WS-CHAVE-CADCLI EQUAL WS-CHAVE-ALTCLI
  87.             MOVE WS-ALTCLI-AGENCIA TO WS-CADCLIN-AGENCIA
  88.             MOVE WS-ALTCLI-NUMERO-CONTA TO WS-CADCLIN-NUMERO-CONTA
  89.             MOVE WS-ALTCLI-NOME-CLIENTE TO WS-CADCLIN-NOME-CLIENTE 
  90.             MOVE WS-ALTCLI-TELEFONE TO WS-CADCLIN-TELEFONE
  91.             MOVE WS-ALTCLI-RENDA-MENSAL TO WS-CADCLIN-RENDA-MENSAL
  92.             MOVE WS-CADCLI-SALDO-ATUAL TO WS-CADCLIN-SALDO-ATUAL
  93.             MOVE WS-ANO TO WS-CADCLIN-ANO-GRAVACAO
  94.             MOVE WS-MES TO WS-CADCLIN-MES-GRAVACAO
  95.             MOVE WS-DIA TO WS-CADCLIN-DIA-GRAVACAO
  96.             MOVE WS-HORA TO WS-CADCLIN-HORA-GRAVACAO
  97.             WRITE WS-REGISTRO-CADCLIN
  98.             PERFORM 030-LER-CADCLI
  99.             PERFORM 040-LER-ALTCLI
  100.            ELSE
  101.             IF WS-CHAVE-CADCLI > WS-CHAVE-ALTCLI
  102.             MOVE WS-ALTCLI-AGENCIA TO WS-CADCLIN-AGENCIA
  103.             MOVE WS-ALTCLI-NUMERO-CONTA TO WS-CADCLIN-NUMERO-CONTA
  104.             MOVE WS-ALTCLI-NOME-CLIENTE TO WS-CADCLIN-NOME-CLIENTE 
  105.             MOVE WS-ALTCLI-TELEFONE TO WS-CADCLIN-TELEFONE
  106.             MOVE WS-ALTCLI-RENDA-MENSAL TO WS-CADCLIN-RENDA-MENSAL
  107.             MOVE ZEROS TO WS-CADCLIN-SALDO-ATUAL
  108.             MOVE WS-ANO TO WS-CADCLIN-ANO-GRAVACAO
  109.             MOVE WS-MES TO WS-CADCLIN-MES-GRAVACAO
  110.             MOVE WS-DIA TO WS-CADCLIN-DIA-GRAVACAO
  111.             MOVE WS-HORA TO WS-CADCLIN-HORA-GRAVACAO
  112.              WRITE WS-REGISTRO-CADCLIN
  113.              PERFORM 040-LER-ALTCLI
  114.             ELSE
  115.              PERFORM 030-LER-CADCLI.
  116.        030-LER-CADCLI.
  117.            READ CADCLI AT END MOVE HIGH-VALUE TO WS-CHAVE-CADCLI.
  118.        040-LER-ALTCLI.
  119.            READ ALTCLI AT END MOVE HIGH-VALUE TO WS-CHAVE-ALTCLI.
  120.        090-FIM.
  121.            CLOSE CADCLI.
  122.            CLOSE ALTCLI.
  123.            CLOSE CADCLIN.
  124.        STOPRUN.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×