0% found this document useful (0 votes)
134 views1 page

Cics Push-Pop

This document provides an example COBOL program that uses PUSH HANDLE and POP HANDLE to handle exceptions when receiving input. It defines variables, sends messages to clear the screen and position the cursor, receives input into variable A, and defines error handling paragraphs to display error messages if the length is invalid or a general error occurs. The program demonstrates using PUSH HANDLE and POP HANDLE around the RECEIVE statement to test receiving input that is longer than the defined length of 5 characters.

Uploaded by

Abi Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views1 page

Cics Push-Pop

This document provides an example COBOL program that uses PUSH HANDLE and POP HANDLE to handle exceptions when receiving input. It defines variables, sends messages to clear the screen and position the cursor, receives input into variable A, and defines error handling paragraphs to display error messages if the length is invalid or a general error occurs. The program demonstrates using PUSH HANDLE and POP HANDLE around the RECEIVE statement to test receiving input that is longer than the defined length of 5 characters.

Uploaded by

Abi Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//EXAMPLE USING PUSH HANDLE AND POP HANDLE

---------------------------------------------------------------

ID DIVISION.
PROGRAM-ID. SAMPGM39.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC 9(5).
77 LEN PIC S9(4) COMP.
77 MSG2 PIC X(20).
PROCEDURE DIVISION.
START-PARA.
EXEC CICS SEND CONTROL ERASE
END-EXEC.
MOVE 5 TO LEN.
EXEC CICS HANDLE CONDITION
LENGERR(LEN-PARA)
ERROR(GEN-PARA)
END-EXEC.
PERFORM PARA-1.
EXEC CICS SEND CONTROL CURSOR(350) END-EXEC.
EXEC CICS SEND
FROM(A)
LENGTH(LEN)
END-EXEC.
EXEC CICS RETURN END-EXEC.

PARA-1.
EXEC CICS PUSH HANDLE END-EXEC.
EXEC CICS RECEIVE
INTO(A)
LENGTH(LEN)
END-EXEC.
EXEC CICS POP HANDLE END-EXEC.

LEN-PARA.
MOVE 20 TO LEN.
MOVE 'INVALID LENGTH' TO MSG2.
EXEC CICS SEND
FROM(MSG2)
LENGTH(LEN)
ERASE
END-EXEC.
EXEC CICS RETURN END-EXEC.
GEN-PARA.
MOVE 20 TO LEN.
MOVE 'ERROR' TO MSG2.
EXEC CICS SEND
FROM(MSG2)
LENGTH(LEN)
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.

TRY THE ABOVE PGM WITH & WITHOUT PUSH & POP COMMANDS FOR THE INPUT MORE THAN 5
CHARACTERS.

You might also like