The error is IGYPS2074-S "CADFINAL" was defined as a type that was invalid in this context. The statement was discarded.
COBOL]
IDENTIFICATION DIVISION.
PROGRAM-ID. BLNCLN.
*
*
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. DECIMAL-POINT IS COMMA.
*
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CADASTRO ASSIGN TO CADASTRO.
SELECT ATUALIZA ASSIGN TO ATUALIZA.
SELECT CADFINAL ASSIGN TO CADFINAL.
*
*
DATA DIVISION.
*
FILE SECTION.
FD CADASTRO
RECORDING MODE IS F.
01 REG-CADASTRO PIC X(300).
* 10 CD-EMP-COD PIC 9(11).
* 10 CD-DATA-INI PIC 9(06).
* 10 CD-DATA-FIM PIC 9(08).
* 10 CD-PLANO-DSCT PIC 9(09).
* 10 CD-PLANO-CNSM PIC 9(09).
* 10 CD-PLANO-TRFS PIC 9(09).
* 10 CD-EMP-NOME PIC X(40).
* 10 CD-EMP-END PIC X(60).
* 10 CD-EMP-CEP PIC 9(08).
* 10 CD-EMP-CITY PIC X(20).
* 10 CD-EMP-UF PIC X(02).
* 10 FILLER PIC X(116).
*
FD ATUALIZA
RECORDING MODE IS F.
01 REG-ATUALIZA PIC X(200).
* 10 AT-FLAG PIC X(01).
* 10 AT-EMP-COD PIC X(11).
* 10 AT-EMP-NOME PIC X(40).
* 10 AT-EMP-END PIC X(60).
* 10 AT-EMP-CEP PIC 9(08).
* 10 AT-EMP-CITY PIC X(20).
* 10 AT-EMP-UF PIC X(02).
* 10 FILLER PIC X(58).
*
FD CADFINAL
RECORDING MODE IS F.
01 REG-CADFINAL PIC X(300).
* 10 CF-EMP-COD PIC 9(11).
* 10 CF-DATA-INI PIC 9(06).
* 10 CF-DATA-FIM PIC 9(06).
* 10 CF-PLANO-DSCT PIC 9(09).
* 10 CF-PLANO-CNSM PIC 9(09).
* 10 CF-PLANO-TRFS PIC 9(09).
* 10 CF-EMP-NOME PIC X(40).
* 10 CF-EMP-END PIC X(60).
* 10 CF-EMP-CEP PIC 9(08).
* 10 CF-EMP-CITY PIC X(20).
* 10 CF-EMP-UF PIC X(02).
* 10 FILLER PIC X(116).
*
WORKING-STORAGE SECTION.
*
01 WS-CADASTRO.
10 CD-EMP-CODE PIC 9(11).
10 CD-DATA-INI PIC 9(06).
10 CD-DATA-FIM PIC 9(08).
10 CD-PLANO-DSCT PIC 9(09).
10 CD-PLANO-CNSM PIC 9(09).
10 CD-PLANO-TRFS PIC 9(09).
10 CD-EMP-NOME PIC X(40).
10 CD-EMP-END PIC X(60).
10 CD-EMP-CEP PIC 9(08).
10 CD-EMP-CITY PIC X(20).
10 CD-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
01 WS-ATUALIZA.
10 AT-FLAG PIC X(01).
10 AT-EMP-CODE PIC X(11).
10 AT-EMP-NOME PIC X(40).
10 AT-EMP-END PIC X(60).
10 AT-EMP-CEP PIC 9(08).
10 AT-EMP-CITY PIC X(20).
10 AT-EMP-UF PIC X(02).
10 FILLER PIC X(58).
*
01 WS-CADFINAL.
10 CF-EMP-CODE PIC 9(11).
10 CF-DATA-INI PIC 9(06).
10 CF-DATA-FIM PIC 9(06).
10 CF-PLANO-DSCT PIC 9(09).
10 CF-PLANO-CNSM PIC 9(09).
10 CF-PLANO-TRFS PIC 9(09).
10 CF-EMP-NOME PIC X(40).
10 CF-EMP-END PIC X(60).
10 CF-EMP-CEP PIC 9(08).
10 CF-EMP-CITY PIC X(20).
10 CF-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
01 AUX-CADASTRO.
10 AX-EMP-CODE PIC 9(11).
10 AX-DATA-INI PIC 9(08).
10 AX-DATA-FIM PIC 9(06).
10 AX-PLANO-DSCT PIC 9(09).
10 AX-PLANO-CNSM PIC 9(09).
10 AX-PLANO-TRFS PIC 9(09).
10 AX-EMP-NOME PIC X(40).
10 AX-EMP-END PIC X(60).
10 AX-EMP-CEP PIC 9(08).
10 AX-EMP-CITY PIC X(20).
10 AX-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
PROCEDURE DIVISION.
*
0000-MAIN.
PERFORM 1000-OPEN
PERFORM 2000-READ
PERFORM 3000-PERFORM
PERFORM 5000-FINAL
STOP RUN
.
*
1000-OPEN.
PERFORM 1300-OPEN-CADASTRO
PERFORM 1400-OPEN-ATUALIZA
PERFORM 1500-OPEN-CADFINAL
.
*
1300-OPEN-CADASTRO.
OPEN INPUT CADASTRO
.
*
1400-OPEN-ATUALIZA.
OPEN INPUT ATUALIZA
.
*
1500-OPEN-CADFINAL.
OPEN OUTPUT CADFINAL
.
*
2000-READ.
READ CADASTRO INTO WS-CADASTRO
READ ATUALIZA INTO WS-ATUALIZA
.
*
3000-PERFORM.
IF AT-EMP-CODE <= CD-EMP-CODE
EVALUATE TRUE
WHEN AT-FLAG = 'A'
MOVE WS-CADASTRO TO AUX-CADASTRO
MOVE AT-EMP-CODE TO AX-EMP-CODE
MOVE AT-EMP-NOME TO AX-EMP-NOME
MOVE AT-EMP-END TO AX-EMP-END
MOVE AT-EMP-CEP TO AX-EMP-CEP
MOVE AT-EMP-CITY TO AX-EMP-CITY
MOVE AT-EMP-UF TO AX-EMP-UF
WRITE CADFINAL FROM AUX-CADASTRO
WHEN AT-FLAG = 'D'
WRITE CADFINAL FROM AUX-CADASTRO
WHEN AT-FLAG = 'I'
WRITE CADFINAL FROM AUX-ATUALIZA
END-EVALUATE
ELSE
WRITE WS-CADASTRO
MOVE REG-CADASTRO TO AUX-CADASTRO
MOVE AT-EMP-CODE TO AX-EMP-CODE
MOVE AT-EMP-NOME TO AX-EMP-NOME
MOVE AT-EMP-END TO AX-EMP-END
MOVE AT-EMP-CEP TO AX-EMP-CEP
MOVE AT-EMP-CITY TO AX-EMP-CITY
MOVE AT-EMP-UF TO AX-EMP-UF
WRITE CADFINAL
END-IF
.
5000-FINAL.
CLOSE CADASTRO
CLOSE ATUALIZA
CLOSE CADFINAL
.
PROGRAM-ID. BLNCLN.
*
*
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. DECIMAL-POINT IS COMMA.
*
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CADASTRO ASSIGN TO CADASTRO.
SELECT ATUALIZA ASSIGN TO ATUALIZA.
SELECT CADFINAL ASSIGN TO CADFINAL.
*
*
DATA DIVISION.
*
FILE SECTION.
FD CADASTRO
RECORDING MODE IS F.
01 REG-CADASTRO PIC X(300).
* 10 CD-EMP-COD PIC 9(11).
* 10 CD-DATA-INI PIC 9(06).
* 10 CD-DATA-FIM PIC 9(08).
* 10 CD-PLANO-DSCT PIC 9(09).
* 10 CD-PLANO-CNSM PIC 9(09).
* 10 CD-PLANO-TRFS PIC 9(09).
* 10 CD-EMP-NOME PIC X(40).
* 10 CD-EMP-END PIC X(60).
* 10 CD-EMP-CEP PIC 9(08).
* 10 CD-EMP-CITY PIC X(20).
* 10 CD-EMP-UF PIC X(02).
* 10 FILLER PIC X(116).
*
FD ATUALIZA
RECORDING MODE IS F.
01 REG-ATUALIZA PIC X(200).
* 10 AT-FLAG PIC X(01).
* 10 AT-EMP-COD PIC X(11).
* 10 AT-EMP-NOME PIC X(40).
* 10 AT-EMP-END PIC X(60).
* 10 AT-EMP-CEP PIC 9(08).
* 10 AT-EMP-CITY PIC X(20).
* 10 AT-EMP-UF PIC X(02).
* 10 FILLER PIC X(58).
*
FD CADFINAL
RECORDING MODE IS F.
01 REG-CADFINAL PIC X(300).
* 10 CF-EMP-COD PIC 9(11).
* 10 CF-DATA-INI PIC 9(06).
* 10 CF-DATA-FIM PIC 9(06).
* 10 CF-PLANO-DSCT PIC 9(09).
* 10 CF-PLANO-CNSM PIC 9(09).
* 10 CF-PLANO-TRFS PIC 9(09).
* 10 CF-EMP-NOME PIC X(40).
* 10 CF-EMP-END PIC X(60).
* 10 CF-EMP-CEP PIC 9(08).
* 10 CF-EMP-CITY PIC X(20).
* 10 CF-EMP-UF PIC X(02).
* 10 FILLER PIC X(116).
*
WORKING-STORAGE SECTION.
*
01 WS-CADASTRO.
10 CD-EMP-CODE PIC 9(11).
10 CD-DATA-INI PIC 9(06).
10 CD-DATA-FIM PIC 9(08).
10 CD-PLANO-DSCT PIC 9(09).
10 CD-PLANO-CNSM PIC 9(09).
10 CD-PLANO-TRFS PIC 9(09).
10 CD-EMP-NOME PIC X(40).
10 CD-EMP-END PIC X(60).
10 CD-EMP-CEP PIC 9(08).
10 CD-EMP-CITY PIC X(20).
10 CD-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
01 WS-ATUALIZA.
10 AT-FLAG PIC X(01).
10 AT-EMP-CODE PIC X(11).
10 AT-EMP-NOME PIC X(40).
10 AT-EMP-END PIC X(60).
10 AT-EMP-CEP PIC 9(08).
10 AT-EMP-CITY PIC X(20).
10 AT-EMP-UF PIC X(02).
10 FILLER PIC X(58).
*
01 WS-CADFINAL.
10 CF-EMP-CODE PIC 9(11).
10 CF-DATA-INI PIC 9(06).
10 CF-DATA-FIM PIC 9(06).
10 CF-PLANO-DSCT PIC 9(09).
10 CF-PLANO-CNSM PIC 9(09).
10 CF-PLANO-TRFS PIC 9(09).
10 CF-EMP-NOME PIC X(40).
10 CF-EMP-END PIC X(60).
10 CF-EMP-CEP PIC 9(08).
10 CF-EMP-CITY PIC X(20).
10 CF-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
01 AUX-CADASTRO.
10 AX-EMP-CODE PIC 9(11).
10 AX-DATA-INI PIC 9(08).
10 AX-DATA-FIM PIC 9(06).
10 AX-PLANO-DSCT PIC 9(09).
10 AX-PLANO-CNSM PIC 9(09).
10 AX-PLANO-TRFS PIC 9(09).
10 AX-EMP-NOME PIC X(40).
10 AX-EMP-END PIC X(60).
10 AX-EMP-CEP PIC 9(08).
10 AX-EMP-CITY PIC X(20).
10 AX-EMP-UF PIC X(02).
10 FILLER PIC X(116).
*
PROCEDURE DIVISION.
*
0000-MAIN.
PERFORM 1000-OPEN
PERFORM 2000-READ
PERFORM 3000-PERFORM
PERFORM 5000-FINAL
STOP RUN
.
*
1000-OPEN.
PERFORM 1300-OPEN-CADASTRO
PERFORM 1400-OPEN-ATUALIZA
PERFORM 1500-OPEN-CADFINAL
.
*
1300-OPEN-CADASTRO.
OPEN INPUT CADASTRO
.
*
1400-OPEN-ATUALIZA.
OPEN INPUT ATUALIZA
.
*
1500-OPEN-CADFINAL.
OPEN OUTPUT CADFINAL
.
*
2000-READ.
READ CADASTRO INTO WS-CADASTRO
READ ATUALIZA INTO WS-ATUALIZA
.
*
3000-PERFORM.
IF AT-EMP-CODE <= CD-EMP-CODE
EVALUATE TRUE
WHEN AT-FLAG = 'A'
MOVE WS-CADASTRO TO AUX-CADASTRO
MOVE AT-EMP-CODE TO AX-EMP-CODE
MOVE AT-EMP-NOME TO AX-EMP-NOME
MOVE AT-EMP-END TO AX-EMP-END
MOVE AT-EMP-CEP TO AX-EMP-CEP
MOVE AT-EMP-CITY TO AX-EMP-CITY
MOVE AT-EMP-UF TO AX-EMP-UF
WRITE CADFINAL FROM AUX-CADASTRO
WHEN AT-FLAG = 'D'
WRITE CADFINAL FROM AUX-CADASTRO
WHEN AT-FLAG = 'I'
WRITE CADFINAL FROM AUX-ATUALIZA
END-EVALUATE
ELSE
WRITE WS-CADASTRO
MOVE REG-CADASTRO TO AUX-CADASTRO
MOVE AT-EMP-CODE TO AX-EMP-CODE
MOVE AT-EMP-NOME TO AX-EMP-NOME
MOVE AT-EMP-END TO AX-EMP-END
MOVE AT-EMP-CEP TO AX-EMP-CEP
MOVE AT-EMP-CITY TO AX-EMP-CITY
MOVE AT-EMP-UF TO AX-EMP-UF
WRITE CADFINAL
END-IF
.
5000-FINAL.
CLOSE CADASTRO
CLOSE ATUALIZA
CLOSE CADFINAL
.
The Sysprint is too big, so i'll show just the error part
==000161==> IGYPS2074-S "CADFINAL" was defined as a type that was invalid in thi
statement was discarded.
000162 1 WHEN AT-FLAG = 'D'
000163 2 WRITE CADFINAL FROM AUX-CADASTRO
==000163==> IGYPS2074-S "CADFINAL" was defined as a type that was invalid in thi
statement was discarded.
PP 5655-G53 IBM Enterprise COBOL for z/OS 3.3.1 BLNCLN Date 10
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6---
000164 1 WHEN AT-FLAG = 'I'
000165 2 WRITE CADFINAL FROM AUX-ATUALIZA
==000165==> IGYPS2074-S "CADFINAL" was defined as a type that was invalid in thi
statement was discarded.
==000165==> IGYPS2121-S "AUX-ATUALIZA" was not defined as a data-name. The stat
discarded.
statement was discarded.
000162 1 WHEN AT-FLAG = 'D'
000163 2 WRITE CADFINAL FROM AUX-CADASTRO
==000163==> IGYPS2074-S "CADFINAL" was defined as a type that was invalid in thi
statement was discarded.
PP 5655-G53 IBM Enterprise COBOL for z/OS 3.3.1 BLNCLN Date 10
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6---
000164 1 WHEN AT-FLAG = 'I'
000165 2 WRITE CADFINAL FROM AUX-ATUALIZA
==000165==> IGYPS2074-S "CADFINAL" was defined as a type that was invalid in thi
statement was discarded.
==000165==> IGYPS2121-S "AUX-ATUALIZA" was not defined as a data-name. The stat
discarded.