Preparing your program

One of the benefits of using this approach to create code coverage observations is that you can use the same load modules that you prepare for debugging your application with z/OS® Debugger. Programs written in COBOL, PL/I and C and compiled with certain compiler options are supported.

Code Coverage is supported for Enterprise COBOL for z/OS and OS/390® Version 3 and Enterprise COBOL for z/OS Version 4, 5, and above. The following compiler options are required to ensure that the SYSDEBUG side file or program object contains the program source:
  • Enterprise COBOL for z/OS and OS/390 Version 3 - TEST(SEPARATE) with NONE recommended but not required.
  • Enterprise COBOL for z/OS Version 4 - TEST(SEPARATE) with NOHOOK recommended but not required.
  • Enterprise COBOL for z/OS Version 5 and 6.1 - TEST(SOURCE), Version 6.2 and later - TEST(NOSEPARATE,SOURCE).
Code Coverage is supported for Enterprise PL/I for z/OS Version 4.2 and above in 31-bit mode. The following compiler options are required to ensure that the SYSDEBUG side file contains the complete expanded program source and statement table:
  • TEST(SEPARATE) - the ALL and NOHOOK sub-options are also recommended but not required.
  • GONUMBER(SEPARATE) - required to produce the statement table in the SYSDEBUG side file.
  • MACRO or PP(MACRO) - required if there are %INCLUDE statements in the source. Using the MACRO suboption CASE(ASIS) will leave the case of the source unchanged.
  • LISTVIEW(AFTERALL) - required if include files, EXEC CICS® commands, or SQL code are in the source.

Code Coverage is supported for IBM® z/OS XL C. The following compiler options and program preparation are required:

  • You must run the following 2-stage compile process.

    The first stage preprocesses the program, so the IBM z/OS Debugger has access to fully expanded source. The second stage compiles the program.

  • The first compile stage specifies compiler options PP(COMMENTS,NOLINES) to expand INCLUDEs and macros. The output is SYSUT10 DD. SYSUT10 DD is the expanded source file and is the input for the second compiler stage. Modify the SYSUT10 DD to enable z/OS Debugger, by saving it in a expanded source library and specify a member name that is equal to the primary entry point name or CSECT name of your application program.
  • For the second compiler stage, use the DEBUG(FORMAT(DWARF)) option to place the debug data in a separate file in one of these ways:

    Use DEBUG(FORMAT(DWARF),HOOK(LINE,NOBLOCK,PATH),SYMBOL,FILE(location)), or for better performance, use DEBUG(FORMAT(DWARF),NOHOOK,SYMBOL,FILE(location)).

  • You cannot use an .mdbg file.
  • You cannot use DEBUG(FORMAT(ISD)) or TEST.
  • You cannot perform source extraction of a source stored on an HFS or zFS file.

For a full description of the compilers and the options, see Preparing your program for debugging.