I received a cobol cics program for maintenance and found an EXEC CICS RECEIVE that seems unnecessary. The program receives a communications area via PROCEDURE USING. It executes an EXEC CICS RECEIVE command whose existence seems unnecessary to me. Just below this command it destroys the content of the variable used in INTO.
Another question:
The program is only executed through a LINK command executed by another program. So I ask what this RECEIVE command receives?
Below is the code snippet in question.
PROCEDURE DIVISION USING DFHCOMMAREA. <------------------------------ USING in te PROCEDURE DIVISION
/
*----------------------------------------------------------------*
0000-PRINCIPAL SECTION.
*----------------------------------------------------------------*
/
PERFORM 1000-INICIALIZA.
/
PERFORM 2000-PROCESSA UNTIL WS-IDY EQUAL 100 OR
WS-EIBR EQUAL 20.
/
IF WS-IDZ EQUAL 100 OR
WS-EIBR NOT EQUAL 20
PERFORM 2500-PROCESSA UNTIL
WS-EIBR EQUAL 20
END-IF.
/
PERFORM 9000-FINALIZA.
/
*--------------------*
0000-99-FIM. EXIT.
*--------------------*
*
*----------------------------------------------------------------*
1000-INICIALIZA SECTION.
*----------------------------------------------------------------*
/
EXEC CICS RECEIVE <------- command that seems to be unnecessary
INTO (W096-COMMAREA)
LENGTH (WS-LGT-COM)
NOHANDLE
END-EXEC.
/
IF EIBCALEN NOT GREATER ZEROS
MOVE ZEROS TO O-096-OPERATIONSTATUS
O-096-QTD-OCORRENCIA
MOVE 3 TO O-096-OPERATIONSTATUSMESSAGE(01:01)
MOVE WS-MSG01 TO O-096-OPERATIONSTATUSMESSAGE(02:79)
PERFORM 9999-FINALIZA
END-IF.
/
MOVE DFHCOMMAREA(01:59) TO IN-ENTRA-JAVA-096(01:59). <-------------- Here the content of W096-COMMAREA is destroyed
/
MOVE SPACE TO WS-SEL-NIS
WS-SEL-PGM
WS-SEL-DTA
WS-SEL-HRA
WS-SEL-TRM
WS-SEL-PV.
/
PERFORM 1100-VALIDA-INPUT.
PERFORM 1200-INITIALIZE-OUTPUT.
/
MOVE IN-ENTRA-JAVA-096 TO WS-ENTRA-JAVA-096-O.
/
MOVE ZEROS TO WS-RIDFLD.
/
EXEC CICS STARTBR DATASET(WS-FDSERR)
RIDFLD (WS-RIDFLD)
Cheers
Arí Ricardo
São Paulo - Brazil