C.3 ladebug debugger (tru64 unix) – Compaq COBOL AAQ2G1FTK User Manual

Page 568

Advertising
background image

Programming Productivity Tools
C.2 Debugging Tools for Compaq COBOL Programs

Example C–1 Source Code Used in the Sample Debug Sessions

module TESTA

1: IDENTIFICATION DIVISION.
2: PROGRAM-ID.

TESTA.

3: DATA DIVISION.
4: WORKING-STORAGE SECTION.
5:

01

TESTA-DATA

GLOBAL.

6:

02

LET-CNT

PIC 9(2)V9(2).

7:

02

IN-WORD

PIC X(20).

8:

02

DISP-COUNT

PIC 9(2).

10: BEGINIT.
11:

DISPLAY "ENTER WORD:".

12:

MOVE SPACES TO IN-WORD.

13:

ACCEPT IN-WORD.

14:

CALL "TESTB" USING IN-WORD LET-CNT.

15:

PERFORM SHOW-IT.

16:

STOP RUN.

18:

DISPLAY IN-WORD.

19:

MOVE LET-CNT TO DISP-COUNT.

20:

DISPLAY DISP-COUNT " CHARACTERS".

22: PROGRAM-ID.

TESTB

INITIAL.

23: DATA DIVISION.
25:

01

SUB-1

PIC 9(2) COMP.

26:

01

SUB-2

PIC S9(2)

COMP-3.

27:

01

HOLD-WORD.

28:

03

HOLD-CHAR PIC X OCCURS 20 TIMES.

29:

01

HOLD-CHARS-REHOLD-WORD.

30:

03

CHARS PIC X(20).

32:

01

TEMP-WORD.

33:

03

TEMP-CHAR

PIC X OCCURS 20 TIMES.

34:

01

TEMP-CHARS REDEFINES TEMP-WORD.

35:

03

CHARS PIC X(20).

36:

01

CHARCT

PIC 99V99.

38: STARTUP.
39:

IF TEMP-WORD = SPACES

40:

MOVE 0 TO CHARCT

41:

EXIT PROGRAM.

42:

MOVE SPACES TO HOLD-WORD.

43:

PERFORM LOOK-BACK

VARYING SUB-1 FROM 20 BY -1

44:

UNTIL TEMP-CHAR (SUB-1) NOT = SPACE.

45:

MOVE SUB-1 TO CHARCT.

46:

PERFORM MOVE-IT

VARYING SUB-2 FROM 1 BY 1

UNTIL SUB-1 = 0.

47:

MOVE HOLD-WORD TO TEMP-WORD.

49:

MOVE TEMP-CHAR (SUB-1) TO HOLD-CHAR (SUB-2).

50:

SUBTRACT 1 FROM SUB-1.

51: LOOK-BACK.
52:

EXIT.

53: END PROGRAM TESTB.
54: END PROGRAM TESTA.

C.3 Ladebug Debugger (Tru64 UNIX)

The Ladebug Debugger is used to debug Compaq COBOL programs on the Tru64
UNIX operating system.

This section provides a representative debugging session that is designed to
demonstrate the use of debugger features. For complete reference information
on the Ladebug Debugger, you should refer to the Ladebug Debugger Manual in
the Tru64 UNIX operating system documentation set. Online help is immediately
available to you during a debugging session when you type

help

command at the

debugger prompt

(ladebug)

. Additional information about the flags shown in

C–4 Programming Productivity Tools

Advertising