Debug an AS/400 program called from Java

85 pts.
Tags:
AS/400 debugging
AS/400 development
Java
Hi, Is there any way i can hold an AS400 job triggered from java. I need to debug a program which is interactively called from java.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

You should be able to start ISDB for your program :-

STRISDB PGM(YOURLIB/YOURPGM) UPDPROD(*YES) INVPGM(*NO)

The interactive debugger should startup when your program gets called.

Regards,

Martin Gilbert.

Discuss This Question: 14  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ARJEN
    Is there anyway i can do this with Strdbg?
    85 pointsBadges:
    report
  • Gilly400
    Hi, Sure :- STRDBG PGM(YOURLIB/YOURPGM) MAXTRC(1) UPDPROD(*YES) ADDTRC Should cause your program to stop at the first executable statement. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • ARJEN
    I tried it but its not working. I think what you said will work if i call up the program interactively from the same session in which im doing the debug. But since im calling the RPG program from java side its not stopping even if i use strdbg on my program. Is there any way in which i can trap the job when it is submitted from java and then do a STRSRVJOB on this job and then debug it as we do for batch debugging?
    85 pointsBadges:
    report
  • Cwc
    Is there any way in which i can trap the job when it is submitted from java and then do a STRSRVJOB on this job and then debug it as we do for batch debugging? I think you should be able to do that; I've done so before with .Net web services that originate from outside the i and call an OS/400 program or stored procedure. The hard part is finding the specific job that the system will use to process the request to run the program. Many of these are QZDASOINIT jobs which run in the QUSRWRK subsystem, for example. If you could find the right job, perhaps through trial and error by seeing which job gets your request when you run it the first time, you could try initiating a STRSRVJOB on that job, running STRDBG for the program you want to debug, and then running your Java application. But I am not familiar with where Java processes run -- which subsystem and job names, etc. Hopefully, some other readers will be... Or, what about just calling your program by itself from a regular interactive session (after setting up via STRDBG), and passing it the same parameters that the Java class does? If so, then you should be able to achieve the same thing.
    4,290 pointsBadges:
    report
  • ARJEN
    Ya what you said is right. I did this and was able to trap the job which is the QZDASOINIT which is a Prestart job. I did a STRSRVJOB on this job and also did a STRDBG on the actual program which i wanted to debug and which is called by java. But after i released the breakpoint from java it just got executed fully. It dint stop at the breakpoint set in my RPG program. I dont understand why.
    85 pointsBadges:
    report
  • graybeard52
    From the RSE screen, right-click either the source member of the object. Select "Set service entry point". Modify the name of the user if needed, or *ALL. Let the pgm run normally. When the AS400 program loads, the GUI debugger pops up automatically. Have fun !
    3,115 pointsBadges:
    report
  • ARJEN
    Actually im using green screens for my AS400 program development and testing and not RSE. How can i do the same on green screen?
    85 pointsBadges:
    report
  • graybeard52
    Use Gilly400's method. But - you are "modern" enough to use Java to run RPG pgms, but you want to stick with a green screen for debug ? Doesn't make sense to me.
    3,115 pointsBadges:
    report
  • Cwc
    Regarding why your program didn't stop at the breakpoint -- are you sure you're servicing the right QZDASOINIT job? There are usually several of these that are active simultaneously, and although you can service any one of them and start the debug command, if the program being debugged is never called by the job you're servicing, it won't break. So, you'll want to look at the job log to make sure that it's servicing your request at that particular time. It can be hard to get the timing right, depending on how many other incoming requests your system is handling. Any one of those jobs could get the call to service your request, and it may not necessarily be the same one each time.
    4,290 pointsBadges:
    report
  • ARJEN
    Im sure im servicing the right job because the moment i release the breakpoint from my java screen after starting the service job and doing the strdbg on my program, if i hold the particular QZDASOINIT i can see my java screen hanging. So im sure that im servicing the right QZDASOINIT job. And are you sure that this is the job which i should service or will this QZDASOINIT job submit any other job which should be the right one to service? Please help on this.
    85 pointsBadges:
    report
  • Cwc
    Unfortunately, I don't have enough familiarity with how Java requests are handled on the i, so I don't know whether another job would be running the program you want to debug. Have you tried just doing a straight call to the program, after setting it up for debug? Can you pass the same parameters that the Java application does?
    4,290 pointsBadges:
    report
  • Cwc
    I ran across this great writeup from Partner/400 on green screen debugging which explains the use of service entry points on page 2. It sounds like setting up a service entry point would allow you to find the exact job that processes your request, after which you can then start servicing and debugging it. http://www.ibmsystemsmag.com/i5/enewsletterexclusive/18805p1.aspx And as the article mentions, using WDSC is a much better and easier way of debugging and setting service entry points. They've done a writeup on that as well. http://www.ibmsystemsmag.com/i5/enewsletterexclusive/18995p1.aspx
    4,290 pointsBadges:
    report
  • ARJEN
    Hi all, Actually i could not try this out for some days as i was caught in some other work. But as soon as i found your post i just gave it a try. I still get some problem, this time when i give the sbreak command on the debug line, which is giving me a syntax error. The format which i typed is: sbreak 49 (where 49 is the line no at the left most column of the screen which the debugger refers to in the program) Now this seems to be the best solution of all, n i think im now caught just 1 step away from getting the desired result. Anyways thanks Cwc for providing me the link to this information.
    85 pointsBadges:
    report
  • ARJEN
    Hey guys, Finally it has worked for me. Its not through the SEP method but through the conventional method of identifying the job and holding it. I will try on the other thing as well and let you all know if that works. This is what i did to make the java to AS400 debugging work: 1) In the java application after the connection is established to the AS400 system, set a breakpoint before the actual program to be debugged is called. 2) When the java program stops at this breakpoint, get the job named QZRCSRVS in your AS400 system. This is a Prestart job which is used by the AS400 system for a remote proram call. (There are different types of PJs for different purposes. For eg, the QZDASOINIT job which most of them refer to is a PJ which is used for direct file updations on an AS400 s/m by a java application and not for program calls. You can know more about PJs from the ibm site at this link: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaii/rzaiimstprestrtjob.htm Trap your exact QZRCSRVS job which your java program has called. Again if you are using a java IDE, you can watch in the 'Variables' window for getting the job string directly (We are using jt400.jar for AS400 connectivity. If you are using this you can check in the Command Call object to get the actual job string in the 'Variables' window) before the program is called with which you can actually do a STRSRVJOB directly without the need to identify the exact job from your AS400 system. You can get the job string in the needed form (job number/user/job name). 3) Do a STRSRVJOB with the obtained job string. 4) Do STRDBG on the actual program and set the breakpoint. 5) Release the breakpoint from the java application and the program will stop at the desired breakpoint. :) Again thank you all for providing all the suggestions throughout.
    85 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following