Inline COBOL Error Display Utility

Learn how to quickly debug compile time errors

Reduce the time you spend correcting syntax errors when compiling your source code. IBM® software engineers Satish Basavanneppa and Sriram Lakshmanan show you how to set up and use the Inline COBOL Error Display Utility, which is meant for all mainframe COBOL developers looking for faster debugging of compile time errors.

Satish Basavanneppa, Software Engineer, IBM

Satish Basavanneppa works as a Software Engineer for IBM. Satish did his graduation in India and has been working in mainframe technologies for the past one and a half years. He has experience in COBOL, CICS(R) DB2(R) JCL, and VSAM. He also takes interest in developing tools using REXX. You can reach him at basatish@in.ibm.com.



Sriram Lakshmanan, Software Engineer, IBM

Sriram Lakshmanan works as a Software Engineer for IBM. Sriram did his post graduation in India and has been working in mainframe technologies for the past three and a half years. He has experience in COBOL, CICS, DB2, JCL, and VSAM. He has interest in REXX/ISPF and lectures and trains IBM Global Services India employees using REXX/ISPF. You can reach him at sriramla@in.ibm.com.



24 February 2005

Introduction

The Inline COBOL Error Display Utility is a REXX-based tool for faster debugging while coding COBOL programs. The tool helps reduce the time it takes to search for error messages inside a joblog and to locate corresponding position within the source code.

You normally spend more than 60 percent of your development time compiling source code and correcting the syntax errors. This tool hastens the process of clean-compile by displaying all the compile time errors in the source code editor itself, making the debugging easier.

Pre-requisites

For this utility to work as documented, the COBOL compiler option settings must include SOURCE and FLAG. The expected options are: SOURCE and FLAG (I, I). If the options are not matching, a warning displays at the top, and the code might not behave as expected.

The Inline COBOL Error Display Utility reads the joblog directly from the spool. During this process, the maximum number of lines that the spool reads can be limited by local settings. If the entire joblog isn't read due to settings, the tool will not behave as expected. You can overcome this limitation by copying the joblog to a dataset and provide the dataset name as input to the tool.


What the tool does

This utility does not compile the code by itself; it relies on the shop-specific compiler. Once you compile the code and errors or warnings (if any) are written to the joblog, the normal process is to switch back and forth between spool and source code to identify the exact location of the errors. As COBOL programmers know, this is not an easy process, especially during initial development when there are potentially many syntax errors in the code. (Ever forget a dot at the end of a paragraph and get hundreds of errors because of that?!)

This is where this utility comes in handy. Just run this edit macro on the source code, and you'll see all the compiler errors exactly at the source code location. You can correct all syntax errors in a single shot, minimizing the number of times you compile the code. The tool increases productivity by reducing the time it takes to get a clean compile.

Advantages

Many COBOL developers who use this tool have noted the following powerful advantages:

  • It helps reduce development time because of faster debugging.
  • It's efficient in eliminating warning messages. A clean compile can contain warning and informational messages that are easy to overlook. The tool gives the following messages:
    • Severe
    • Error
    • Warning
    • Informational
    This allows you to catch any unexpected run-time errors due to neglect of warnings, such as Numeric field truncation during development.
  • It locates errors quickly using predefined labels for errors, warnings, and so on. The messages display (with a label) at the exact source line where the error occurs. It consolidates the messages at the top for easy reference. You can also control the level of messages to display at the top by user setup. See the Using the tool section for details.
  • It eliminates the need to look through the joblog. Switching between multiple screens in ISPF can be annoying when information from one screen is required in another. It would be easy if all the required information to correct the program displays in one place. This utility does the same with precision.

Initial setup

The Inline COBOL Error Display Utility is a REXX-based edit macro. To set it up:

  1. Upload the source to a mainframe (in text format) with LRECL=80, RECFM=FB.
  2. Copy the REXX source as a member of a PDS concatenated to SYSEXEC / SYSPROC. Name the member as SHOWMSG. Also copy the panel named SHWMSGPL to a PDS concatenated to ISPPLIB.
  3. Before using the tool, compile the COBOL program using the standard compiler in your shop.

Using the tool

You can try two ways of running this edit macro:

  • SHOWMSG <jobname> <jobid>

    JobName and JobId refer to the Job name and Job ID of the submitted compiler job.
  • SHOWMSG <joblog dataset name>

    Joblog dataset refers to a dataset containing joblog output. This corresponds to the case where joblog has been copied from spool to a dataset. For example, "XDC" option in SDSF.

One other option is SHOWMSG SETUP. When using SETUP as an argument, a panel displays where you can set the error level limit for display at the top of the source code. By default, this utility displays all messages -- severe, error, warning, and informational -- at the exact location of the source code. All these messages display at the top of the source code for quick reference. Use the SETUP option to control the severity of the messages to display at the top. Note: This doesn?t control the messages that display at the exact location of the source code.

To use the tool:

  1. Compile the source module. In this case, it's TST1.
  2. Obtain the jobname and jobid for the compile job.
    Figure 1. Jobname and jobid
    Jobname and jobid
  3. Enter the command {<Toolname> <jobname> <jobid>} in the edit screen of the source.
    Figure 2.
  4. This source has a single error and three warnings.
    Figure 3. Error and warnings
    Error and warnings
  5. To reach the location of the error, use the LOCATE command followed by the label given in the report at the top.
    Figure 4. Find location of error
    Find location of error
  6. The following screen shows the corresponding error.
    Figure 5. Error
    Error
  7. If you need to find the location of a warning message, use the LOCATE command again with the corresponding label.
    Figure 6. Find location of warning message
    Find location of warning message
    Figure 7. Warning message
    Warning message
  8. To find the location of the next warning message, use LOCATE with the next label.
    Figure 8. Find location of next warning message
    Find location of next warning message
    Figure 9. Warning message
    Warning message
  9. To set up different error levels:
    1. Enter the command {<ToolName> Setup}.
      Figure 10. Setting up different error levels
      Setting up different error levels
    2. You should see the following screen:
      Figure 11. Error level setup
      Error level setup
    3. Update the error level.
      Figure 12. Update error level
      Update error level
    4. Confirmation is received at the top right corner.
      Figure 13. Confirmation
      Confirmation
    5. Check the errors with the tool command. This time, only errors with severity ?E and ?S display at the top.
      Figure 14. Check errors using tool command
      Check errors using tool command
      Figure 15. Errors
      Errors
  10. The following screen shows the message that displays if you use different compiler options. In this case, FLAG (I, E) is used instead of FLAG (I, I).
    Figure 16. Using compiler options
    Using compiler options

Troubleshooting

You might get the following return codes:

  • RC=16 if the tool doesn't execute with proper arguments.
  • RC=12 if translator or -compiler errors were found.
  • RC=8 if compile errors were found with degree of severe or error.
  • RC=4 for compile time warnings.
  • In case of no errors, return code is 0.

For the labels used (.TXXX where T ? type, XXX ? sequence starting from AAA through ZZZ):

  • In case of pre-compiler errors, the type is P, or sequence is from .PAAA through .PZZZ in sequential order.
  • In case of compiler errors, the type is E, or sequence is from .EAAA through .EZZZ in sequential order.
  • In case of compiler warnings, the type is W, or sequence is from .WAAA through .WZZZ in sequential order.
  • If warning and error messages appear at the same place, then only an error label is provided (since error is considered of higher significance).
  • If multiple errors or warnings occur at the same place, then a single label is provided for ease of use.

Productivity improvement

Table 1 below illustrates the results found when testing the tool against the current manual method. This is an indicative measurement and might vary from user to user based on level of expertise.

Table 1. Testing results
#ParameterManual effortTool timePercentage of time saved
1.Time taken to debug 200 errors4 hours1 hour75 percent
2.Time taken to debug 100 errors2 hours45 minutes62.5 percent
3.Time taken to debug 50 errors1 hour30 minutes50 percent
4.Time taken to debug 20 errors30 minutes15 minutes50 percent
Figure 17. Productivity improvement
graph

Conclusion

Our current project members use this tool and have found it to be quite useful. They recommend the following:

  • Make it independent of compiler options.
  • Invoke the compiler from the tool itself instead of doing it outside.
  • Display the translator errors at the correct places.

In subsequent releases, the tool author plans to add these features to make this an even more robust, powerful, and useful tool.

Resources

  • Visit the Virtual Innovation Center for Hardware for AIX development support. This is the primary source for all pSeries AIX development.
  • Want more? The developerWorks eServer zone hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials on the eServer brand.
  • Browse for books on these and other technical topics.
  • Get involved in the developerWorks community by participating in developerWorks blogs.
  • The IBM developerWorks team hosts hundreds of technical briefings around the world which you can attend at no charge.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Information management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=56692
ArticleTitle=Inline COBOL Error Display Utility
publish-date=02242005