Skip to main content

Problem:

This example illustrates how to use two related call-by-name routines CBL_EXIT_PROC and CBL_GET_EXIT_INFO.

Resolution:

INTRODUCTION

==========

This example illustrates how to use two related call-by-name routines CBL_EXIT_PROC and CBL_GET_EXIT_INFO. These routines permit the consolidation of error reporting within a single application procedure. This example also illustrates how to use the x'F5' call-by-number routine.

SOURCE FILES:

=========

Program Files     Description

----------------     -----------------------------------------------------------

Quitter.cbl          Example program illustrating the use of CBL_EXIT_PROC and

                           CBL_GET_EXIT_INFO.

OPERATION:

========

The Quitter.cbl program illustrates all the various formats of the stop run and goback statements that specify a return value. It also illustrates moves to the RETURN-CODE special register. It tests a command line parameter (specified by Animate (menu) Settings... (button)). The default setting is "1". Set a Breakpoint at the initial statement of the exit procedure (paragraph cblexitproc). You can Run or Animate the Quitter.cbl program.

If you Run the Quitter.cbl program the Animator will stop at the Breakpoint and you can then step through the exit procedure. The Animator will not display a Windows MessageBox and will have stopped when you step through the exit statement of the exit procedure.

If you Animate and step through the Quitter.cbl program, the IDE will display a Windows MessageBox showing you the Return-Code value and notifying you that a "Stop Run" has

occurred. Click OK (button), click Animate (menu) and click Stop Animating (button). The Animator will then show you the exit procedure code with the initial statement highlighted. You can now step through the statements within the procedure. When you step through the exit program statement of the exit procedure the Animator will stop.

REFERENCES:

========

call-by-name routines

---------------------

Net Express Help: Open Net Express Help. Click Find (tab). Type "library routines" in text window 1, click "... Routines" in text window 2, click "Alphabetical list of libray routines" in text window 3 and click Display (button). You can locate and click CBL_EXIT_PROC and CBL_GET_EXIT_INFO in this list for the details on each routine.

call-by-number routines

-----------------------

Net Express Help: Open Net Express Help. Click Find (tab). Type "x"F5"" in text window 1, select X"F5" library routine in text window 3, and click Display (button).

==========================================================

Keywords: demonstration, sample, example, demo, quitter.zip

demo.ex

demo.me

demo.ne

demo.se

Attachments:

Quitter.zip

Old KB# 4016