Naming CSECTs for Z Abend Investigator

To facilitate source code information, Z Abend Investigator must be able to match CSECT names with the compiler listings or side files provided.

For this to be possible, all CSECTs must be named. Whereas the names of CSECTs in programs written in most high-level languages are automatically assigned, special requirements apply to programs written in C. Failure to follow these requirements prevents source code information from being determined for these types of programs.

CSECT naming requirements for C programs

To enable automatic source support for C programs from the HFZLC or HFZLANGX concatenation, it is a requirement that CSECTs are named using the following #pragma statement:
#pragma csect(code,"csect_name")

Where, if a PDS or PDSE is used, csect_name matches the member name of the compiler listing or LANGX file. This enables the side file search to automatically locate compiler listings.

To handle cases where C programs were not compiled with the #pragma csect option, two sample EXECs are provided in data set HFZ.SHFZSAM1 to facilitate source provision:
HFZSCLST

This EXEC can be used to process C compiler listings to extract the C function names from the PPA1 and build an index of function names and their matching listing data set.

HFZSCPRO

This EXEC is a Z Abend Investigator listing exit. It scans the index file created by HFZSCLST and returns the name of the matching listing data set for a given function.

Figure 1. Extracting function names from C programs that were not compiled with #pragma csect

Diagram showing how to enable source support for C programs that were not compiled with the #pragma csect option. The HFZSCLST EXEC processes C compiler listings to extract the C function names from the PPA1 and build an index of function names and their matching listing data set. If a side file is not found during analysis Z Abend Investigator can run the HFZSCPRO listing exit. It scans the index file created by HFZSCLST and returns the name of the matching listing data set for a given function.