|
>>----- Original Message ----- >>From: "Gary Kuznitz" <docfxit@theoffice.la> >>Subject: No output when tracing a PGM with ZTRCPGM >> >> Hi, I'm trying to trace a program. I can't seem to get any output from the trace. >> >> The steps I am using is: >> >> 1. STRDBG >> 2. ADDBRKPNT >> 3. Run to where I want the trace to start. >> 4. CMD 21 to get to a command line >> 5. Addlible TTE >> 6. ZTRCPGM set(*on) pgm( program to trace ) >> 7. CMD 12 to get back to the debug. >> 8. Run the program to the end of where I want to trace. >> 9. ZTRCPGM set(*off) >> 10. End program I am debugging. >> 11. Look at file qtemp/qatrcpgm. >> >> The file has been created but it is always empty. Does anyone know what I >> am doing wrong? >> >> Thank you, >> >> Gary Kuznitz Gary: What kind of program are you trying to debug? Is it an ILE program? You can't trace an ILE program. Here is a snippet from the help text for ADDTRC: o You cannot use this command to trace bound programs. And why are you using trace? For the most part, I quit using trace for debugging when IBM introduced the source-level debuggers... And what is ZTRCPGM? Sounds like a user-written command to me. 1) If you are using OPM RPG (Original Program Model - RPG400), then try using STRISDB to debug your programs. IMO it is ten times more productive than using STRDBG, ADDBKP, DSPPGMVAR, ADDTRC, DSPTRCDTA and all that other nasty stuff. I haven't used any of these commands in years. (Footnote: I actually used trace last night on an OPM program for the first time in at least 5 years) Also, If you need to debug a batch program, you can also use STRISDB to start a service job to debug a currently running job, or you can use STRSRVJOB to start servicing a job and STRISDB to attach to it and debug it. Here is an example of using STRISDB: STRISDB PGM(P47131) UPDPROD(*YES) + INVPGM(*CMD) CMD(CALL PGM(P47131) + PARM(P47131 XX0001 ' ' ' ' '00000010' 'SO' + '00001')) As you see, you can invoke the program while starting the debugger. In this case, I am calling the program P47131 by using INVPGM(*CMD) and specifying the command to execute in order to call the program. After running this command interactively, the debugger displays a panel with a view of the source code for the program. Find the place where you want to start debugging and press F6 to set a break point. THEN, press F17 (Run) and the program will run to the break point and stop. Next, press F5 to single-step thru the code. Press help on the debugger's command line for the commands available. Here are the essentials for the STRISDB command line: DSP xxx : display variable xxx DSPHEX xxx : display variable xxx in hex CHG xxx '1' : change the value of variable xxx to '1' (apostrophes needed for character values) T or TOP : Goto the top of the source listing BOT or BOTTOM : Goto the bottom of the source listing FIND XX : Find the string xx or XX or Xx or xX (not case sensitive) BREAK 1000 WHEN xxx = 'A' : Sets a conditional breakpoint at line 1000 F5 : Single step F9 : Retrieve previous command position cursor, press F13 : Run to the executable line that the cursor is on, then stop position cursor, press F11 : Shows contents of variable that cursor is positioned upon F16 : Repeat previous find F17 : Run to next breakpoint or end of program, whichever comes first 2) If you are using ILE RPG (Integrated Language Environment - RPGLE, RPGIV) then compile your program using DBGVIEW(*ALL) so that you can select the view of the source that you want to see when you start the debugger. Then: a) With ILE programs, the STRDBG debugger works differently. Enter STRDBG PGM(XXXX) UPDPROD(*YES) and the debugger will present you with a source view similar to that of STRISDB. You can select other source views by pressing F15 and selecting a different source view. b) Find the place where you want to start, press F6 to set a beginning break point. c) Press F12 to exit the debugger d) Call your program as you would normally do (interactively), and it will stop at the break point that you set. e) THEN press F10 to step thru the program (F12 will Resume execution until it hits another breakpoint or the program ends, whichever comes first) Again, press F1 for help on the debugger's command line. Here are the essentials for the STRDBG command line: EVAL xxx : display the contents of xxx EVAL xxx = '1' : change the value of xxx to '1' TOP : Goto the top of the source listing BOTTOM : Goto the bottom of the source listing FIND XX : Find the string xx or XX or Xx or xX (not case sensitive) F9 : Retrieve previous command F10 : Single-step F12 : Resume (Run) (or exit, depending upon the context where used) F16 : Repeat previous find command Hope this helps! Steve Landess Austin, Texas (512) 423-0935
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.