ICD™, the Interactive COBOL Debugger, provides an efficient, easy-to-use means of debugging your Unisys ClearPath COBOL74 applications. ICD allows you to track program execution, query data field values, and debug COPY libraries and bound code ( see the separate ICD + Binder Manual ) , all without requiring any source code modifications.
With ICD you can drastically cut debugging time by monitoring and controlling your program’s execution interactively from a terminal. If you need to quickly find and resolve problems in your code, ICD is your productivity tool.
Your COBOL program has an error. Finding and correcting it is time consuming if you use conventional debugging techniques like:
ICD helps you track down and correct bugs in your COBOL programs. Here is what you can do with ICD:
When you first run your program ICD™ gets control before any statements are executed and waits for you to enter a command. ICD™ commands allow you to examine variables and set their values, display your source and set break points.
A break point is any sequence number or paragraph name where you want your program to pause so that you can enter ICD commands. Once you have established your break points, you then continue execution of your program.
You now can examine variable values, change them if you desire, and either continue execution of the program or end it. In short, you can interactively monitor and control your program from a terminal while examining or modifying variables in the process.
Your program executes until either a break point is encountered or an exception condition arises. At this point, ICD takes control and prompts you for more command input.
BREAK < sequence number or Paragraph name>
BREAK allows you to display, set or clear break points. A break point is a particular line number or paragraph name where you want to suspend execution.
CONTINUE < optional count>
Allows your program to continue execution until a break point is reached. If you include the< optional count> your program will execute that number of statements and then return control back to you.
< null input >
Allows stepping through your program one statement at a time. Simply hit XMT to step to the next statement.
DISPLAY < data-name or expression>, ...
Shows the current value of < data-name or expression> .
EXAMINE < group data-name>
Displays each elementary item within a group item.
FIND < prefix string>
Shows the name of the variables in your program that begin with this< prefix string>.
HELP < optional command name>
Lists the various ICD commands or gives a brief description of a particular command.
LIST < optional seqno-range>, ...
Lists lines from your COBOL source file. By itself, LIST prints a small "window" of source lines around the line where you are currently stopped.
PLAYBACK < file title>
Executes ICD commands stored in a file. The file is normally the output from a RECORD command.
RECORD < file title>
Lets you save a copy of your ICD session in a disk file.
SET < data-name> = < expression>
Changes the contents of< data-name > to < expression>.
WHERE
Shows the sequence number of the line where you are currently stopped.
This example shows how ICD might be used in a typical situation. The example is extremely simple but it does illustrate two important features of ICD - the ability to recover from a fault and the ability to examine variables. This second feature means that when you do get an error, you do not have to insert any PRINT statements into your program before starting to debug.
In the following example, commands that you type are underlined in bold. Some clarifying comments are included and they follow the "%". You would not actually type these.
LOAD DEMO/EXAMPLE #WORKFILE DEMO/EXAMPLE: COBOL, 36 RECORDS, SAVED LIST 1400 IDENTIFICATION DIVISION. 1600 ENVIRONMENT DIVISION. 1800 DATA DIVISION. 2000 WORKING-STORAGE SECTION. 2200 77 WS-INDEX PICTURE 9(4) COMP. 2300 2400 01 WS-TABLE. 2500 03 WS-ENTRY OCCURS 5 TIMES. 2600 05 WS-NUMBER PICTURE 9(4). 2700 2800 PROCEDURE DIVISION. 3000 MAIN-PROGRAM. 3200 * The table only has five entries, but 3300 * the PERFORM will attempt to move 3400 * something into the 6th entry ... 3500 3600 PERFORM LOAD-TABLE-ENTRY 3700 VARYING WS-INDEX FROM 1 BY 1 3800 UNTIL (WS-INDEX > 6). 3900 STOP RUN. 4000 4100 LOAD-TABLE-ENTRY. 4200 MOVE WS-INDEX TO WS-NUMBER (WS-INDEX). 4300 4400 END-OF-JOB. 4500 RUN #COMPILING 4047 #RUNNING 4048 #4048 INVALID INDEX @ (004300)* #F-DS @ 004300, 009:0007:3.
This type of error is a very common one. Typically, your next step is to insert some PRINT statements in your program and rerun. If you are a "wizard", you might consider getting a program dump. In any case, at this point you do not have much information to help you in your debugging.
Before continuing let's mention a few things about the debugging strategy we will use.
The session begins with verification of as many lines as seem reasonable to assure that there are no obvious logic errors. With this step you execute your program, line by line, while examining variables. Then, after assuring yourself that there are no obvious mistakes, execution proceeds.
With ICD™
100 $SET ICD COMPILE WITH ICDCOBOL #UPDATING #COMPILING 4049 #ET=10.5 PT=1.0 IO=1.1 RUN #RUNNING 4050 ?# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Interactive COBOL Debugger % Version 20.2 (10/01/2007) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Auto-source file established: (DEMO)CANDE/TEXT420 ON DISK. Entering breakpoint at line 3600 =>003600 PERFORM LOAD-TABLE-ENTRY ICD> DISPLAY WS-INDEX %CHECK A VARIABLE WS-INDEX = 0 ICD> CONTINUE+1 %ONE MORE STMT Entering breakpoint at line 4200 =>4200 MOVE WS-INDEX TO WS-NUMBER (WS-INDEX). ICD> DISPLAY WS-INDEX %CHECK THE INDEX AGAIN WS-INDEX = 1 (0001) %NOW WE'VE DONE ONE STMT %AND HAVE A VALUE ICD> B 4200 %PUT IN A BREAK POINT 1 BREAKS were set ICD> CONTINUE %LET IT CONTINUE Continuing Entering breakpoint at line 4200 =>004200 MOVE WS-INDEX TO WS-NUMBER ICD> DISPLAY WS-INDEX %CHECK THE INDEX NOW WS-INDEX = 2 (0002) %THE INDEX VALUE LOOKS OK SO FAR ICD> BREAK - 4200 %SO DELETE BREAK 1 BREAKS were reset ICD> CONTINUE %AND LET IT GO Continuing Your program had a fatal error (Invalid Index) at line number 4300 You may not continue your program from this point You may, however, DISPLAY variables ICD> DISPLAY WS-INDEX %IS IT CORRECT? WS-INDEX = 6 %TRY TO USE THE INDEX VALUE ICD> SET WS-NUMBER(WS-INDEX) = 1 subscript 1 out of range - declared as 5 %THERE'S THE PROBLEM! and ICD % even tells you why the value is wrong
ICD™ plus XGEN™ -- ICD+ is built on the solid foundation and proven debugging technology of ICD - the leader in ClearPath debugging since 1984. To understand ICD+ you should first be familiar with ICD. ICD+ adds XGEN debugging as an enhancement to ICD functionality. (See below for an explanation of XGEN )
ICD+ is an efficient, easy-to-use source level COBOL debugger, allowing XGEN™ programmers to interactively debug their programs.
Using ICD+ you can step through your code at run-time at either the XGEN™ statement level (4GL) or the COBOL statement level (3GL).
ICD+ ™ allows you to interactively control program execution from a terminal. You set breakpoints, view source statements and examine variables in either XGEN™ or COBOL mode. Inspect or modifj data structures using source level COBOL/XGEN™ names and PICTURES.
Normal ICD debugging allows you to pause during execution at COBOL statements. XGEN debugging operates at a higher level and allows pausing at XGEN source (sometimes called "specification" or "spec") statements. These are the XGEN statements you used to generate your program.
XGEN™ is a powerful, multi-platform, database-independent 4GL (Fourth Generaton language) that makes COBOL programmers more efficient because details such as error handling, opening and closing of files and interfacing to databases are handled for you. The XGEN language was designed to allow minimal changes to your COBOL source.
You can find more information about XGEN by going to the Idea Integration web site and following the Legacy Solutions link. Under "related Resource" (you may have to scroll down to see it ) on the right side of the screen click "Download Brochure" to see a short description of XGEN and other tools.
Our Millennium Language Extensions (MLE) consist of two parts : compiler aided date windowing and the full ANSI 85 COBOL Standard Date Intrinsic functions. ICD Group's Millennium Language Extensions continue our commitment to providing tools to help Unisys ClearPath COBOL programmers in the development, debugging and maintenance areas.
The Millennium Language Date Windowing Extensions provide support for automated date windowing in the ClearPath COBOL74 compiler. These extensions give application developers a mechanism to indicate to the compiler that dates should be windowed. Millennium Language Extensions allow customers to change application data definitions to indicate which data items represent windowed dates. With MLE the compiler can automatically implement windowing with minimal user changes to the program logic.
Date windowing involves a 2-digit year and a Window Base. Dates greater than or equal to the Window Base are treated as dates in this century. Dates less than the window base are in the next century. Although a window base is two digits it is often expressed as a complete date, like 1975.
Assume your window Base is 1975. Then when windowing is in effect, any 2-digit year greater or equal to 75 will be treated as in this century, i.e., 82 would, in comparisons with another date or number, be treated as 1982. Any 2-digit year less than 75 will be treated as in the next century, i.e., 72 would, in comparisons with another date or number, be treated as 2072.
With the MLE you can define a Window Base at compile-time or have the run-time MLE library use its default value.
You indicate during compiling which data are to be treated as dates by using our
DATE clause extension :
77 START-DATE PIC X(8) DATE YYYYMMDD .
These variables can be automatically windowed in IF statements. You indicate date
variables by adding a DATE clause to the record description entry for a variable.
(See "Specifying Date Variables" in the
ICD MLE : Compiler-Aided Windowed Date Compare Manual for a full discussion.)
The Window Base is the lowest year within this century for comparison purposes. For example, if the Window Base is 1975 then any 2 digit year greater then or equal to 75 will be treated as being in the 1900s. Years less than 75 will be treated as being in the 2000s.
At compile-time you can specify the Window Base that you want to use with the
WINDOW = < window base >
compiler control option (see the section on " Compiler Control Options ($ cards) " in the ICD MLE : Compiler-Aided Windowed Date Compare Manual ).
This information is passed to the MLE library at program start-up.
If your compiled program contains any windowed comparisons it will call the run-time MLE library to handle the compare part of any IFs that involve date variables. If the compiled program did not specify a Window Base then the MLE library uses a default value.
You have the option to have the MLE library override the Window Base specified at compile-time. You can use this to implement a "sliding window." Each year you can increase the Window Base that the library uses by one. You could also have different windows by having your programs call different versions of the library.
Although these standard COBOL85 functions were part of our Millennium Language Extensions (MLE) they can be used independently and are described here.
ICD Group has been providing patches to the Unisys COBOL74/68 compiler since 1984 to implement our interactive debugging product, ICD. Building on this knowledge of the COBOL compiler we have added the COBOL85 date manipulation functions to the ClearPath COBOL 74 compiler. These date functions were particularly applicable during Year 2000 modifications. Together with date windowing they are part of our MLE™ package.
Our work was motivated by George Gray's article in the November, 1997, issue of Unisphere, "2200 COBOL and the Year 2000." That article discussed 2200 COBOL modifications to the ACCEPT verb to allow programmers to retrieve a four-digit year when requesting dates. We have implemented these same extensions with our ICD™ C85 Date extensions. They allow you to have dates returned in either Julian (YYYYDDD) format or StandardDate (YYYYMMDD) format.
Other changes mentioned in the article, and implemented in our version, incorporate all the COBOL85 functions that involve date manipulation.
Whether or not you are dealing with Year 2000 issues, these functions are important when you want to do computations using dates. When you need to do date arithmetic these functions will do the work and take care of leap year and leap century considerations.
To get the Julian representation of today's date :
ACCEPT identifier-1 FROM DAY YYYYDDD
To get the Gregorian representation of today's date :
ACCEPT identifier-1 FROM DATE YYYYMMDD
These C85 standard date functions have been added to COBOL74:
INTEGER-OF-DATE INTEGER-OF-DAY DAY-OF-INTEGER DATE-OF-INTEGER DAY-OF-WEEK CURRENT-DATE
The date functions added by ICD Group are summarized in Table 1.
| Function Name | Function Type | Argument Type | Value Returned |
|---|---|---|---|
| CURRENT-DATE | Alphanumeric | None | Current date and time and difference from Greenwich Mean Time |
| DATE-OF-INTEGER | Integer | Integer | Standard date equivalent (YYYYMMDD) of integer date |
| DAY-OF-INTEGER | Integer | Integer | Julian date equivalent (YYYDDD) of integer date |
| INTEGER-OF-DATE | Integer | Integer | Integer date equivalent of standard date (YYYYMMDD) |
| INTEGER-OF-DAY | Integer | Integer | Integer date equivalent of Julian date (YYYYDDD) |
| DAY-OF-WEEK | Integer | Integer | Integer day equivalent of the day of the week where Sunday =0 through Saturday = 6 |
It is not immediately obvious from reading the COBOL85 manual how you would want to use these date functions. However, the beauty of the functions is that they allow you to do date arithmetic, date differences and date comparisons simply and cleanly.
All date arithmetic and comparisons are done using an "integer date" form -- an integer representation of a date. There are two functions that allow you to get dates into this form. They differ only in the form of the date that they accept. INTEGER-OF-DAY accepts dates in the form YYYYDDD. INTEGER-OF-DATE accepts dates in the form YYYYMMDD. (You can get today's date in either of these forms by using the modifications to the ACCEPT verb or CURRENT-DATE function described elsewhere in this document.)
After you have done the arithmetic that you need there are two functions available to convert the "integer date" form back into an "external" date. DAY OF INTEGER converts "integer date" form back to a Julian day with four-digit year (YYYYDDD) and DATE-OF-INTEGER converts back to a standard date (YYYYMMDD).
There are the four steps you need to follow to use these functions.
Since these functions and their syntax are copied from the COBOL85 standards the code you write will not have to be changed when you convert to COBOL85.
ICD COBOL85 is in development. Please contact us if you are interested in this product.