Static corruptions are typically caused by invalid pointer arithmetic, uninitialized pointers, or differences in parameter passing between z/OS and distributed platforms. Three common types of static corruptions are:
To diagnose corruption of static variable contents during the debugging phase, compile the application code using -prefix stringrange,subscriptrange. This injects additional code that attempts to detect overwrites and raise appropriate conditions.
Diagnosing when the descriptor for a PL/I variable has been corrupted unintentionally can be difficult. PL/I variables such as structures, CONTROLLED variables, etc. cause the compiler to create hidden internal structures that describe several items such as the layout of the variable, how many generations of a CONTROLLED variable exist, current generation statistics, etc. If the code unintentionally corrupts one of these internal data structures, errors such as an unexpected SIGSEGV when accessing a built-in function, or an abend in a called procedure that relies upon the descriptor for processing can occur. As an advanced technique, use the -map and -exp options of the compiler listing to work out where the descriptors reside, and then either inject new code to monitor the descriptor(s) for changes or to identify what has possibly caused the corruption.
A descriptor is a hidden data structure embedded within the generated code. It describes the layout of the structure, the number of array elements, etc. used when calling subroutines or built-in functions, thus providing the shape and size of the data being passed. The descriptor does not show up on the ENTRY declaration, but it is an item passed as part of the calling convention for non-scalar items, and for arrays of scalar items. It is also passed for things like variables declared with CHAR(*).