Topic
  • 10 replies
  • Latest Post - ‏2019-03-15T05:10:09Z by Sergey Chebotarev
Sergey Chebotarev
Sergey Chebotarev
19 Posts

Pinned topic Debugging code

‏2019-03-07T12:35:20Z |

Good day. I have the source code for an RPG program. I want to run this code in debug mode to execute step-by-step instructions in the editor. Tell me, what actions need to do this?

 

I tried to do the following. For the source code executed Compile(G) > Compile (Prompt) > CRTBNDRPG.... Completed setup for compilation (command CRTBNDRPG PGM(CSN/HW01R) SRCFILE(CSNEDU/RPGSRC) SRCMBR(HW01R) DBGVIEW(*ALL) turned out). Executed this command and as a result received the program. Then in the Remote Systems I opened the library with the received program, clicked the right mouse button and chose Debug As > Interactive. As a result, a window appeared. I clicked YES and got another window in which the following was said: "You do not have access to the STRDBGSVR command from the *LIBL library.". However, I can execute such a command in the 5250 emulator.

 

P.S. In the emulator 5250 I can run the program in debug mode.

  • SFerrell
    SFerrell
    11 Posts
    ACCEPTED ANSWER

    Re: Debugging code

    ‏2019-03-07T13:08:32Z  

    Hi Sergey,

     

    The interactive debugger is designed for input screens that require data, and it requires you to first run the STRDBGSVR command on a green screen to form a link for the interactive screens (on the IBM i) to be displayed.. If your program has passed in data, you should run debug in batch, or use the SEP  type of debug. Using batch you can define the parameters you wish to pass, and store them in a configuration for repeated calls. Now as you debug, the program will step into the program. Using SEP, you can launch the screens (or application) from your 5250 Emulator and the break points will display in RDi.

     

    There are labs available that step you through the debug process, or some videos that are helpful.

     

    Here's an example of one in a series by our friend Charlie. https://www.youtube.com/watch?v=roesIrpiIAs

     

    Here's the link to the hands on labs. https://www.ibm.com/developerworks/community/wikis/home/wiki/W5655eb35823a_4511_8970_3f665cc5d557/page/Hands-on%20Labs?lang=en 

     

    Hope this helps!

  • SFerrell
    SFerrell
    11 Posts
    ACCEPTED ANSWER

    Re: Debugging code

    ‏2019-03-14T10:54:11Z  

    Good day. There is another question about debugging.
    If the code includes the inclusion of code from another source (compiler directive /COPY), then when debugging, I do not see the code included by the directive and, accordingly, I can not debug it.
    Is it possible to make settings to solve this problem?

    Hi Sergey,

     

    You can open the source using the right-click menu hovering over the /copy directive and set a break point, or you can step INTO the code using the F5 function key while debugging. This will bring you into the /copy or /include file while executing the subroutine or procedure.

    Using F6 you can step OVER that code and not go back in (unless you have a break point set already).

     

    Here's a link to help you with compile options that allow you to include the source.

    https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasc/bndsc.htm

     

    Hope this helps!

     

    Updated on 2019-03-14T11:16:58Z at 2019-03-14T11:16:58Z by SFerrell
  • barbara_morris
    barbara_morris
    28 Posts
    ACCEPTED ANSWER

    Re: Debugging code

    ‏2019-03-14T14:41:11Z  

    Did as you advised. Such a command was obtained: CRTBNDRPG PGM (CSNEDU / MAIN) SRCFILE (CSNEDU / DEBUGTEST) SRCMBR (MAIN) OPTION (* SHOWCPY) DBGVIEW (* ALL). However, the debugger still does not show the code included by the directive ...

    Hi Sergey, to debug the code in a /COPY file, you'll have to use the listing view. Compile with DBGVIEW(*LIST) or DBGVIEW(*ALL).

     

    If you compile with DBGVIEW(*ALL), you can switch to the listing view by right-clicking in the debug editor and choosing Show View->Show *LISTING.

  • SFerrell
    SFerrell
    11 Posts

    Re: Debugging code

    ‏2019-03-07T13:08:32Z  

    Hi Sergey,

     

    The interactive debugger is designed for input screens that require data, and it requires you to first run the STRDBGSVR command on a green screen to form a link for the interactive screens (on the IBM i) to be displayed.. If your program has passed in data, you should run debug in batch, or use the SEP  type of debug. Using batch you can define the parameters you wish to pass, and store them in a configuration for repeated calls. Now as you debug, the program will step into the program. Using SEP, you can launch the screens (or application) from your 5250 Emulator and the break points will display in RDi.

     

    There are labs available that step you through the debug process, or some videos that are helpful.

     

    Here's an example of one in a series by our friend Charlie. https://www.youtube.com/watch?v=roesIrpiIAs

     

    Here's the link to the hands on labs. https://www.ibm.com/developerworks/community/wikis/home/wiki/W5655eb35823a_4511_8970_3f665cc5d557/page/Hands-on%20Labs?lang=en 

     

    Hope this helps!

  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-11T07:45:29Z  

     

    SFerrell, thanks for the reply. I learned a lot of interesting from practical laboratory classes. Especially pleased with the presence of the IBM learning server. I did not know about him. But the problem with debugging the code did not dare ... I just want to say that I work not on the IBM learning server, but on the server of my employer.

     

    Following lab session 4, clause 2.2, I tried to set the Service Entry breakpoint. As a result, I received an informational message: "IBM i Debug Server has not been started yet". Clicking on this window YES received an error message. It states the following: "You are not authorized to access the STRDBGSVR command from the * LIBL library." Now made a request to the administrator to obtain access to run this command.

     

    I hope they will give me access and this will solve the problem of debugging. Thank you again!

  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-14T05:29:42Z  

    I got access to the STRDBGSVR command and debugging the code in RDi earned.
    Thank you for your help!

  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-14T09:13:16Z  

    Good day. There is another question about debugging.
    If the code includes the inclusion of code from another source (compiler directive /COPY), then when debugging, I do not see the code included by the directive and, accordingly, I can not debug it.
    Is it possible to make settings to solve this problem?

    Updated on 2019-03-14T09:13:36Z at 2019-03-14T09:13:36Z by Sergey Chebotarev
  • SFerrell
    SFerrell
    11 Posts

    Re: Debugging code

    ‏2019-03-14T10:54:11Z  

    Good day. There is another question about debugging.
    If the code includes the inclusion of code from another source (compiler directive /COPY), then when debugging, I do not see the code included by the directive and, accordingly, I can not debug it.
    Is it possible to make settings to solve this problem?

    Hi Sergey,

     

    You can open the source using the right-click menu hovering over the /copy directive and set a break point, or you can step INTO the code using the F5 function key while debugging. This will bring you into the /copy or /include file while executing the subroutine or procedure.

    Using F6 you can step OVER that code and not go back in (unless you have a break point set already).

     

    Here's a link to help you with compile options that allow you to include the source.

    https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasc/bndsc.htm

     

    Hope this helps!

     

    Updated on 2019-03-14T11:16:58Z at 2019-03-14T11:16:58Z by SFerrell
  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-14T12:49:38Z  

    SFerrell, thanks for the help. I created a test program from 2 source files (MAIN and INCLUDE). In the first file with the / COPY directive, I added the code from the second file. Then I compiled the first file and launched it in the debugger. In it, I saw the / COPY directive and when the execution of the code reached it, I pressed the F5 key. However, the debugger did not open the second file with the source code, but remained on the current line. Next, I pressed the F5 key as many times as there were lines of code in the second file. After that, the debugger continued moving along the code of the first file.

    As I understand it, in order to see the code connected by the / COPY directive, you need to correctly configure the compilation. But there are a lot of options and I can not figure them out. I ask for your help in this matter.

    P.S. The compile command is as follows CRTBNDRPG PGM (CSNEDU/MAIN) SRCFILE (CSNEDU/DEBUGTEST) SRCMBR (MAIN) DBGVIEW (*ALL)

    Updated on 2019-03-14T13:46:31Z at 2019-03-14T13:46:31Z by Sergey Chebotarev
  • SFerrell
    SFerrell
    11 Posts

    Re: Debugging code

    ‏2019-03-14T13:56:12Z  

    SFerrell, thanks for the help. I created a test program from 2 source files (MAIN and INCLUDE). In the first file with the / COPY directive, I added the code from the second file. Then I compiled the first file and launched it in the debugger. In it, I saw the / COPY directive and when the execution of the code reached it, I pressed the F5 key. However, the debugger did not open the second file with the source code, but remained on the current line. Next, I pressed the F5 key as many times as there were lines of code in the second file. After that, the debugger continued moving along the code of the first file.

    As I understand it, in order to see the code connected by the / COPY directive, you need to correctly configure the compilation. But there are a lot of options and I can not figure them out. I ask for your help in this matter.

    P.S. The compile command is as follows CRTBNDRPG PGM (CSNEDU/MAIN) SRCFILE (CSNEDU/DEBUGTEST) SRCMBR (MAIN) DBGVIEW (*ALL)

    Hi Sergey,

     

    The compiler option you want is the *SHOWCOPY. You can select it and press ADD to include it on the compile command.

     

     

    Updated on 2019-03-14T13:57:17Z at 2019-03-14T13:57:17Z by SFerrell
  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-14T14:01:26Z  

    Did as you advised. Such a command was obtained: CRTBNDRPG PGM (CSNEDU / MAIN) SRCFILE (CSNEDU / DEBUGTEST) SRCMBR (MAIN) OPTION (* SHOWCPY) DBGVIEW (* ALL). However, the debugger still does not show the code included by the directive ...

  • barbara_morris
    barbara_morris
    28 Posts

    Re: Debugging code

    ‏2019-03-14T14:41:11Z  

    Did as you advised. Such a command was obtained: CRTBNDRPG PGM (CSNEDU / MAIN) SRCFILE (CSNEDU / DEBUGTEST) SRCMBR (MAIN) OPTION (* SHOWCPY) DBGVIEW (* ALL). However, the debugger still does not show the code included by the directive ...

    Hi Sergey, to debug the code in a /COPY file, you'll have to use the listing view. Compile with DBGVIEW(*LIST) or DBGVIEW(*ALL).

     

    If you compile with DBGVIEW(*ALL), you can switch to the listing view by right-clicking in the debug editor and choosing Show View->Show *LISTING.

  • Sergey Chebotarev
    Sergey Chebotarev
    19 Posts

    Re: Debugging code

    ‏2019-03-15T05:10:09Z  

    barbara_morris, thank you very much! Everything worked out!
    Tell me, is it possible to get a code in RDi from the source code with the /COPY directives, where the contents of the files specified in the directives will be already included in the text of this code?