CICS has Handle, Ignore and Resp conditions for handling errors but under what scenarios we use these and what is the difference
between using these?
If all of them are for handling errors , then why do we have all of these, why cant we use any one of them?
-Rehman
"; ; ; ;
CICS Handle conditions should be avoided at all costs. They lead to unstructured complicated convoluted logic and code.
Handle conditions where required in the days before CICS had the RESP as part of it's repetoir.
Handle conditions cause the program to jump to the specified label when the condition occurs, and so is an implicit use of a "go to" statement.
Today CICS allows us to use the RESP as part of the EXEC CICS command which means we can evaluate the response immedietly after the exec CICS command has been executed and appropriate logic can be codded without a "go to". This means more structured and easier to use code.
e.g.
EXEC CICS
READ DATASET(ABCD)
...
...
RESP(W01-EIBRESP)
END-EXEC
EVALuate W01-EIBRESP
WHEN DFHRESP(NORMAL)
continue
WHEN DFHRESP(NOTFOUND)
perform not found logic
when other
perfom appropriate logic
End-Evaluate
If I was QA'ing your code and you used a Handle condition, your code would fail the QA and be returned to you to fix.