Page 1 of 1

why CICS COMMAND "RECEIVE" no Normal return?

PostPosted: Fri Aug 06, 2010 7:03 pm
by helen2000
Hi All,
for the following code, when I input "mpi0 abc", the program always perform show-cics-error instead of display "hello, world",
in other words, cics COMMAND "RECEIVE" didn't return Normal(0). I trace the code, I found RESP-CODE is
always 6 instead of 0, why? how to figure out? thanks,

 000017        01  RESP-CODE PIC S9(8) COMP.             
 000018        01  RCV-BUF PIC X(80).                   
 000019        01  RCV-LEN PIC S9(4) COMP VALUE 10.     
 000020        01  WK-INFO PIC X(40).                   
 000021       /----------------*                         




 000032                     EXEC CICS RECEIVE INTO (RCV-BUF)           
 000033                                     LENGTH (RCV-LEN)           
 000034                                     MAXLENGTH (80)             
 000035                                     RESP(RESP-CODE)             
 000036                     END-EXEC.                                   
 000037                     IF RESP-CODE NOT = DFHRESP(NORMAL)         
 000038                         PERFORM SHOW-CICS-ERROR                 
 000039                         EXEC  CICS  RETURN                     
 000040                         END-EXEC                               
 000041                     END-IF.                                     
 000042                     MOVE 'HELLO, WORLD' TO WK-INFO.             
 000043                     EXEC CICS SEND FROM (WK-INFO)               
 000044                                         LENGTH (12)             
 000045                                         ERASE                   
 000046                                         RESP (RESP-CODE)       
 000047                     END-EXEC.   

Re: why CICS COMMAND "RECEIVE" no Normal return?

PostPosted: Fri Aug 06, 2010 7:13 pm
by Robert Sample
Your code needs to be modified to handle the EOC. From the CICS Programming Guide:
4.3.7.1 Chaining input data

As noted earlier, some SNA devices segment long input messages for transmission. Each individual segment is called a request unit (RU), and the entire logical message is called a chain. CICS provides an option in the terminal definition, BUILDCHAIN, that governs who assembles the chain. If the BUILDCHAIN value for the terminal is YES, CICS assembles the chain and presents the entire message to the program in response to a single RECEIVE command. This choice ensures that the whole chain is complete and available before it is presented to the application.

If BUILDCHAIN=NO, the application assembles the chain. CICS provides one RU for each RECEIVE. The application can tell when it has received the last RU in the chain, because CICS raises the EOC (end-of-chain) condition at that time. CICS raises this condition even when there is only one RU in the chain, or when it assembles the chain, or when the input is from a terminal that does not support inbound chaining, like a 3270 display. An EOC condition is not considered an error; the CICS default action when it occurs is to ignore the condition.
So EOC (response code 6) is normal and should not be treated as an error.

Re: why CICS COMMAND "RECEIVE" no Normal return?

PostPosted: Fri Aug 06, 2010 7:36 pm
by helen2000
thank you, Mr. Robert,

I change the code as following, it works very well, thanks, again, Helen

.....
IF RESP-CODE NOT = DFHRESP(NORMAL)  and RESP-CODE NOT = 6       
000038                         PERFORM SHOW-CICS-ERROR                 
000039                         EXEC  CICS  RETURN                     
000040                         END-EXEC                               
000041                     END-IF.           
................

Re: why CICS COMMAND "RECEIVE" no Normal return?

PostPosted: Fri Aug 06, 2010 7:57 pm
by Robert Sample
Why not
IF  RESP-CODE NOT = DFHRESP(NORMAL) 
AND RESP-CODE NOT = DFHRESP(EOC)
    PERFORM SHOW-CICS-ERROR                 
    EXEC  CICS  RETURN                     
    END-EXEC                               
END-IF. 
to remove the spurious constant from the code?

Re: why CICS COMMAND "RECEIVE" no Normal return?

PostPosted: Fri Aug 06, 2010 9:04 pm
by helen2000
thank you so much! Robert, :D