CICS storage violations can seem to be one of the most difficult problems to deal with when debugging. Storage violations can in the worst cases bring down CICS and can sometimes go undetected by CICS which could lead to problems in the future.Storage violations involving overwriting CICS control blocks or CICS storage will in most cases lead to CICS ‘falling over’. Storage violations of user storage areas can sometimes go undetected and may not cause a CICS failure.
By understanding how CICS detects storage violations, you can make the task of debugging a storage violation easier.
Introduction to Virtualization
When you request an area of storage in CICS, such as for the programmer’s commarea, CICS will add 16 bytes of storage to the area of storage. It adds 8 bytes at the start and 8 bytes at the end. CICS will then put a value in each of these areas. If the value changes then CICS will detect a storage violation. However, CICS will not necessarily detect the storage violation when it happens. This is because CICS will only check for a violation when the area of storage is freed up.So the storage violation could occur at the start of your program but not actually be detected until later.For example when the program terminates or calls another program.
- The most common reasons for storage violations are programming errors.
- Common reasons are different length DFHCOMMAREAs when your program calls or is invoked by another program, or subscript errors causing data to be stored beyond the end of storage area.
It is also possible that another program has overwritten your storage, your program may detect that it’s storage has been overwritten by another program. If you suspect that it is not your program that is at fault, try doing a CEMT new copy of your program.
As CICS has evolved new methods of protecting storage have been added to CICS. However many sites still do not take advantage of them this may be because some older software may require that the storage protection options be switched off.
If you switch on storage protection in CICS region, then you may find that you get a lot more storage violations in existing programs, this could be because the storage violations went undetected previously.