Chris’s post about SLIP made me think about CICS storage checking and CSFE. As this blog is supposed to be for people with all levels of CICS skills, I thought I’d try and write something for beginners about CICS storage checking.
Note for Chris: Yes, it is called “storage” not “memory”!
For CICS task lifetime related storage, CICS puts some eyecatchers on the start and end of the buffer that it obtains for you. These are called storage crumple zones. If you look at some CICS storage using a tool like CEDF, you can see these at the bounds of the area obtained for your user storage. For example:
15014A80 000010 E4F0F0F1 F6F8F0F0 838983A2 979385A7 U0016800cicsplex
15014A90 000020 00000000 00000000 E4F0F0F1 F6F8F0F0 ........U0016800
In the above example U0016800 is the crumple zone. The U means this is user key storage, (you can also get a C for CICS key storage). The number after the U is the task number that owns the storage. Task number 16800 in this example. Notice that there are two occurrances of the U0016800 string – a leading and a trailing crumple zone. In this example I used EXEC CICS GETMAIN to obtain 8 bytes of storage (CICS rounded it up to 16).
When CICS obtains storage for your task – either directly because you’ve issued an EXEC CICS GETMAIN or indirectly e.g. task working storage – then CICS will setup the storage crumple zones.
When the storage is freed – again either directly because you’ve issued an EXEC CICS FREEMAIN or indirectly e.g. when your task ends, then CICS checks the crumple zones associated with the storage. If the crumple zones are not correct, then a storage violation is detected.
So if my program wrote more than 16 bytes worth of data to the piece of storage above, the trailing crumple zone would be changed. However the overwrite could occur in my program at any time, yet the error might only be detected when the task ends.
When CICS does detect the storage violation, the CICS sysprog, will then typically need to try and figure out which CICS application programmer to harass. However in order to do this, the sysprog needs some evidence as to which program is likely to be at fault. The task that suffered the violation might be the victim of another tasks errant program. If the task was long running, and the storage violation was detected at end of task, then there may be a significant amount of code or other tasks that could have run.
This is where the CSFE transaction may be able to help. For reproducable storage violations – typically on a test system – you can use the storage violation trap function of the CSFE.
Using CSFE DEBUG,CHKSTSK=CURRENT will cause similar storage checking that occurs when user storage is freed to occur after every CICS trace record is produced. So as long as your CICS is running with CICS internal trace active and the tasks are invoking CICS functions that cause trace enties to be written, then CSFE has something to work with.
When the storage violation trap is active, then when the CICS trace program writes a trace record to the internal trace table, the CICS storage manager domain will be called to check that the storage crumple zones of the current task are intact. If they are, processing will continue as normal. However if not, the storage violation trap will be tripped, and you will then get a dump.
Then armed with the handy dump and IPCS (or your other favourite dump debugging aid) you can then examine the trace to determine which programs were in control and what commands they were issuing. This should hopefully help narrow down the culprit and identify which program, and possibly even sections of code in the program deserve a close inspection.
There are other CICS facilities e.g. storage protection, transaction isolation, re-entrant program protection and EXEC command storage checking that can help with resolving storage overlays in CICS, so all is not lost if CSFE doesn’t deliver the goods. However when you do have a situation where it can be used, it can be invaluable.
Recent Comments