No announcement yet.

Debugging CGI jobs through Green Screen

  • Filter
  • Time
  • Show
Clear All
new posts

  • Debugging CGI jobs through Green Screen

    I'm having a problem with a program and I'd like to debug the server job. The manual suggests it is diffucult to debug a program using the green screen. I don't use RDI so I was wandering if you could give me any suggestions on debugging using the green screen. My problem is when I use the apply sorters parm in vvout. I'm Firebug says the SQL error is 42703, so I'd like to see what the server job is adding to my sql to cause this error.


  • #2
    I have a pretty good method for debugging CGI jobs through the green screen. The trick of course is debugging the right job. Here's what I do:

    1) do a WRKACTJOB and position to the CGI jobs in your Valence server instance under the QHTTPSVR subsystem (the CGI jobs usually have PGM-QZSRCGI in the function column but depending on your OS level it might be something else)
    2) press F10 to reset the server statistics, wait a few seconds then press F5 and see what CGI job has the highest CPU percentage
    3) if no jobs used any CPU it probably means no one is using your server instance but you so if that's the case go to your browser and do something against that server instance to force it to call anything on the back end so it will use some CPU
    4) the job with the highest CPU percentage is the job I call the "preferred" job by the Apache server and the highest probability for debug success is with this job
    5) do an 5 on the preferred CGI job (Work with Job)
    6) at the top of the screen you will see something like: "Job: VALENCE30 User: QTMHHTTP Number: 319791"
    7) start a service job using the values at the top of the screen in reverse order, like: STRSRVJOB 319791/QTMHHTTP/VALENCE30
    8) then do your STRDBG command on whatever program you want and set your breakpoints
    9) go to your browser and do whatever you need to in your app to call the RPG program being debugged
    10) if you did all this right, your green screen session will break at your first debug breakpoint and you can go from there
    11) if for some reason you can't get your program to break on the preferred job you may have to just keep trying different CGI jobs until you hit on the right one, but usually this works
    12) while you are debugging, your front-end will timeout because it's not getting a response within the timeout period from the RPG but that usually doesn't matter
    13) when you are done be sure to do an ENDDBG and ENDSRVJOB on your green screen session


    • #3
      Thanks Richard.


      • #4
        Alternately, check the Errors program. The failed statement should be logged in there.