Sie sind auf Seite 1von 22

Unit 6.

Using the ILE Source Debugger

Copyright IBM Corp. 1996, 2000

6-1

Unit Objectives - Debugging


After completing this unit, you should be able to:
Describe the benefits of source view and listing view debugging Use compile options to specify desired level of debugging Use the source debugger to use:

breakpoints display and change values of program variables step through the execution of an RPG IV program
Use the watch feature of the ILE Debugger
OL866000

Copyright IBM Corp. 1996, 2000 6-2

Source View Debugger


OS/400 debugger for ILE programs View source on display in debug mode:

Set breakpoints by cursor position Step through source statements Display / change values of program variables Watch the value of a variable change as program executes

Includes debug commands :

Display or change values of variables, structures and expressions Set a watch for a variable Search for strings in source code Set up shorthand notation to reduce keying Navigate through the source code
OL866105

Copyright IBM Corp. 1996, 2000 6-3

Copyright IBM Corp. 1996, 2000

6-4

OL866110

Using the ILE Debugger


1. STRDBG PGM(RPG4PGM) .... UPDPROD(*NO/*YES)
View source Set breakpoints

2. CALL PGM(RPG4PGM)
View source, set/clear breakpoints, display/change variables, etc.

3. ENDDBG 4. Correct source, recompile 5. Test


Copyright IBM Corp. 1996, 2000 6-5

6. Repeat process until satisfied


OL866115

Example of Source Debugging


Display Module Source Program: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ITEMLIST Library: E E OL86V3LIB Module: ITEMLIST

FItem_PF IF FItemList O

K Disk Printer Oflind(*In88) NOT *In99 Heading *In99 = *ON

C If ** Headings on first page C Write C Eval C Endif C C ** Page overflow C C C Read If Write Eval Endif

Item_PF *In88 Heading *In88 = *Off

C If ** End of file reached C Write C C C C C Else Eval Eval Write Endif

*InLR Footing

TotQtyAvl = ItmQtyOH + ItmQt *In43 = (TotQtyAvl < 15) Detail

Debug . . . _________________________________________________________ _______________________________________________________________________ F3=End program F6=Add/Clear breakpoint F10=Step F11=Display variable F12=Resume F17=Watch variable F18=Work with watch F24=More keys
OL866120

Copyright IBM Corp. 1996, 2000

6-6

Copyright IBM Corp. 1996, 2000

6-7

OL866125

Copyright IBM Corp. 1996, 2000

6-8

OL866130

Watching a Variable
Display Module Source Program: 1 2 3 4 5 6 7 8 9 10 11 12 13 DEBUGDEMO Library: ** Declare variables D Count S D Sum S OL86V3LIB Module: DEBUGDEMO

3P 0 Inz(1) 5P 0

** Loop 5 times and accumulate C Dow Count <= 5 C Eval Sum = Sum + Count C Eval Count = Count + 1 C Enddo ** End program - what are the values of Sum and Count ? C Eval *InLR = *ON C Return Bottom

Debug . . . watch sum_______________________________________________ ______________________________________________________________________ F3=End program F6=Add/Clear breakpoint F10=Step F11=Display variable F12=Resume F17=Watch variable F18=Work with watch F24=More keys

OL866132

Copyright IBM Corp. 1996, 2000

6-9

Copyright IBM Corp. 1996, 2000

6-10

OL866135

Copyright IBM Corp. 1996, 2000

6-11

OL866140

Copyright IBM Corp. 1996, 2000

6-12

OL866145

Changing Debugger View


Display Module Source :........................................................................... : Select View : : : : Current View . . . : ILE RPG Source View : : : : Type option, press Enter. : : 1=Select : : : : Opt View : : 1 ILE RPG Listing View : : ILE RPG Source View : : ILE RPG Copy View : : : : Bottom: : F12=Cancel : : : :..........................................................................: Debug . . . ___________________________________________________________ _______________________________________________________________________ F3=End program F12=Resume F6=Add/Clear breakpoint F10=Step F13=Work with module breakpoints F11=Display variable F24=More keys
OL866150

Copyright IBM Corp. 1996, 2000 6-13

Source Debugger Summary


Source View debugging Simple setting of breakpoints Simple display of variable values Navigation commands Step option Evaluation of Expressions BIFs can be used with Debugger
OL866155

Copyright IBM Corp. 1996, 2000 6-14

Tools
DEBUG on H-spec DUMP opcode STRSRVJOB Joblog
OL866200

Copyright IBM Corp. 1996, 2000 6-15

Debug and Dump


H D D D D D D D D C C C C C C C :
Copyright IBM Corp. 1996, 2000 6-16

DEBUG(*YES) DaMoYr Date Field1 Field2 Amount Amount2 Name Class

S S S S S S S S

6 INZ(120697) 6 0 INZ 8 INZ 8 INZ 6 2 INZ(-123.58) 7 3 INZ(9457.323) 15 INZ( RPG IV Workshop ) 6 MOVE DaMoYr MOVEL (P) Date MOVEL Name MOVEL Amount MOVE Amount Eval Dump *InLR = *ON Date Field1 Class Field2 Amount2

OL866205

Sample DUMP Listing (1/2)


ILE RPG/400 FORMATTED DUMP Module Name. . . . . . . . . . . . . . : Optimization Level . . . . . . . . . . : Halt Indicators: H1 0 H2 0 H3 0 H4 Command/Function Key Indicators: KA 0 KB 0 KC 0 KD KK 0 KL 0 KM 0 KN KV 0 KW 0 KX 0 KY Control Level Indicators: L1 0 L2 0 L3 0 L4 Overflow Indicators: OA 0 OB 0 OC 0 OD External Indicators: U1 0 U2 0 U3 0 U4 General Indicators: 01 0 02 0 03 0 04 11 0 12 0 13 0 14 21 0 22 0 23 0 24 : : Internal Indicators: LR 1 MR 0 RT 0 1P NAME AMOUNT AMOUNT2 CLASS DAMOYR DATE FIELD1 FIELD2 NAME 0 0 0 0 0 0 0 0 0 0 MOVEX *NONE H5 0 KE 0 KP 0 L5 0 OE 0 U5 0 05 0 15 0 25 0 H6 0 KF 0 KQ 0 L6 0 OF 0 U6 0 06 0 16 0 26 0 H7 0 KG 0 KR 0 L7 0 OG 0 U7 0 07 0 17 0 27 0

H8 KH KS

L8 OV U8 08 18 28

0 VALUE -0123.58 0012358D X -9012.358 9012358D X RPG IV D9D7C740C9E5 X 120697 F1F2F0F6F9F7 X 120697. 0120697F X 120697 F1F2F0F6F9F74040 X 01235Q F0F1F2F3F5D84040 X RPG IV Workshop D9D7C740C9E540E6969992A2889697 X
OL866210

ATTRIBUTES PACKED(6,2) PACKED(7,3) CHAR(6) CHAR(6) PACKED(6,0) CHAR(8) CHAR(8) CHAR(15) VALUE IN HEX

Copyright IBM Corp. 1996, 2000

6-17

STRSRVJOB

STRSRVJOB

TRCJOB *ON/*OFF/*END
OL866215

Copyright IBM Corp. 1996, 2000 6-18

Using the Joblog as a Debugging Tool (1/2)

1.

Display Program Messages

Job 025627/RJSLANEY/QPADEV0005 started on 05/03/00 at 14:37:26 in subsystem Error message CPF4101 appeared during OPEN for file BFDSUBST (C S D F). 2. Additional Message Information RNQ1216 Inquiry 07/28/97 Severity . . . . . . . : Time sent . . . . . . : 99 14:

Message ID . . . . . . : Message type . . . . . : Date sent . . . . . . :

Message . . . . : Error message CPF4101 appeared during OPEN for file BFDSUBST (C S D F). Cause . . . . . : RPG procedure BFRSUBST in program OL86V3LIB/BFRSUBST received the message CPF4101 while performing an implicit OPEN operation file BFDSUBST. Recovery . . . : Check the job log for a complete description of message CPF4101, and contact the person responsible for program maintenance. file has a device type of SPECIAL, there may be no message in the joblog Possible choices for replying to message . . . . . . . . . . . . . . . D -- Obtain RPG formatted printout of system storage. S -- Obtain printout of system storage. F -- Obtain full formatted printout of system storage.

Copyright IBM Corp. 1996, 2000 6-19

OL866220

Using the Joblog as a Debugging Tool (2/2)

3. Joblog 4>> CALL OL86V3LIB/BFRSUBST File BFDSUBST in library *LIBL not found or inline data file missing. Error message CPF4101 appeared during OPEN for file BFDSUBST. Function check. RNX1216 unmonitored by BFRSUBST at statement 0001000001, instruction X 0 0 0 0 . Error message CPF4101 appeared during OPEN for file BFDSUBST (C S D F). Error message CPF4101 appeared during OPEN for file BFDSUBST (C S D F).
OL866225

Copyright IBM Corp. 1996, 2000 6-20

Copyright IBM Corp. 1996, 2000

6-21

OL86610L

Unit Summary
Having completed this unit, you should be able to:
Describe the benefits of source view and listing view debugging Use compile options to specify desired level of debugging Use the source debugger to use:

breakpoints display and change values of program variables step through the execution of an RPG IV program
Use the watch feature of the ILE Debugger
Copyright IBM Corp. 1996, 2000 6-22
OL866999

Das könnte Ihnen auch gefallen