6 Debugging COBOL Programs

ART for Batch supports user COBOL program in runb/runbexci debugging for Micro Focus COBOL and COBOL-IT COBOL.

  • Debugging with Micro Focus COBOL
  • Debugging with COBOL-IT COBOL (using deet tool)

You can configure all the jobs and programs that you want to debug in the configuration file batchdebug.cfg. Only these jobs/programs configured in this file could be debugged. See Configuring for Debugging in Configuration File for more information.

To support COBOL debug, all COBOL programs must be compiled to output with debug information. In particualr, for Micro Focus COBOL, .idy file must exist.

6.1 Debugging with Micro Focus COBOL

Follow the steps below to debug with Micro Focus COBOL.

  1. Create or modify batchdebug.cfg configuration file at ${JESROOT}. See Configuring for Debugging in Configuration File for more information.
  2. Start anim in a new terminal and the anim remains in waiting state.
  3. Submit your job. It makes Animator attach to the started COBOL program.
  4. Debug your COBOL programs.

Note:

At the end of debug session, you may need to detach Animator from the program that you just debug.

6.2 Debugging with COBOL-IT COBOL

Do the following steps to debug with COBOL-IT COBOL.

  1. Create or modify batchdebug.cfg configuration file at ${JESROOT}. See Configuring for Debugging in Configuration File for more information.
  2. Submit your job. It hangs before COBOL program actually runs, waiting you to start debug session.
  3. Use vncserver to start a VNC environment. In VNC xterm, start debug session with command deet -p your DEBUGID. It starts a Deet graphic UI and makes Deet attach to the COBOL program.
  4. Debug this COBOL program in Deet graphic UI.

    Note:

    At the end of debug session, you may need to detach Deet from the program that you just debug.
    For more information about Deet graphic UI, see COBOL-IT COBOL documentation.

6.3 Configuring for Debugging in Configuration File

Whenever you launch runb or runbexci to start a COBOL application program, ART for Batch checks configuration file batchdebug.cfg at ${JESROOT} to determine whether to enable COBOL debug; therefore, to enable it, you should set this configuration file at the very beginning. Only the programs with the DEBUGID that you configure in batchdebug.cfg can be debugged.

The format of batchdebug.cfg is:

COBOL; DEBUGID;UserID;JobName;Program

Table 6-1 Debug Configuration Parameters

Field Name Type Value Description
COBOL Fix string Mandatory A fix string for identifying usage for COBOL debug.
DEBUGID X(40) or 1 ~ 999999999 Mandatory For Micro Focus COBOL application programs, DEBUGID is a string that is required for enabling animation in COBOL. It is a character string of up to 40 characters. The string can have alphanumeric characters and underscore.

For COBOL-IT COBOL application programs, DEBUGID is a number ranging from 1 to 999999999.

UserID X(30) Mandatory ART for Batch user ID who is to be diagnosed. Usually it is Oracle Tuxedo user name. * means all users.
JobName X(32) Mandatory Job name which is to be diagnosed. * means all jobs.
Program X(30) Mandatory COBOL program name which is to be diagnosed. It must be the entry COBOL program name. * means all programs..

Here are some examples.

  • Listing 1 and Listing 2 are examples for debugging all programs in job JOBA submitted by user A.
  • Listing 3 and Listing 4 are examples for debugging program1 in all jobs.

Listing 1 Debugging All Programs in One Job (Micro Focus COBOL)

COBOL;debugid1;A;JOBA;*

Listing 2 Debugging All Programs in One Job (COBOL-IT COBOL)

COBOL;101; A; JOBA;*

Listing 3 Debugging One Program in All Jobs (Micro Focus COBOL)

COBOL;debugid2;*;*;program1

Listing 4 Debugging One Program in All Jobs (COBOL-IT COBOL)

COBOL;102;*;*;program1