Debugging a Batch Job

530 pts.
Tags:
AS/400
COBOL/400 Debugging
Hi,

I was debugging a COBOL/400 batch job.

I am proceeding as per the below steps:
1. SBMJOB ... HOLD(*YES)
2. STRSRVJOB JOB(jobnbr/user/jobnam)
3. STRDBG When source is displayed, press F12
4. RLSJOB JOB(jobnbr/user/jobnam) When Start Serviced Job display appears, press F10
5. When command entry display is shown, DSPMODSRC When source is displayed, set a breakpoint, then press F12 When command entry display is shown, press F12
6. When Start Serviced Job display reappears, press Enter Program will stop at breakpoint, and can be debugged interactively
7. After serviced job ends ENDDBG ENDSRVJOB

In step 3  i.e while executing STRDBG command i am receiving the following error:

Command is not allowed while serviced job is not active.
The status of the job is 'held'.

Please let me know how to proceed. Is there any another way of debugging  a batch job.

Regards,
M


Software/Hardware used:
AS/400, COBOL/400

Answer Wiki

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

Once I release the Service Job. It says, “Serviced job has completed. Debug commands are not allowed”.

Discuss This Question: 9  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
  • TomLiotta
    You didn't say what the error message ID is, so I have to guess that it's CPF1938. The STRDBG command doesn't throw that message ID, so you probably tried to run a debug command before you released the job. Maybe you tried to set a breakpoint. You can't do that until after you release the job. The only command you can run is STRDBG, then you must release or start the job, and then you can set a breakpoint or display a variable. Personally, I would use a more modern debug function rather than trying to use STRSRVJOB through a terminal interface. -- Tom
    125,585 pointsBadges:
    report
  • mvrkrishna
    Hi Tom,

    Please tell me about the modern debug function.

    Regards,
    M
    530 pointsBadges:
    report
  • TomLiotta
    Please show the STRDBG command that you used. Did you exit the debug display with F12, and not F3? Also, did you set any breakpoints after the DSPMODSRC display opened?   The debugger that I use most is the System i5 Debugger. It's okay once you give yourself some practice.   The next levels of the debugger are nicer, but might need more practice. WDSC or RDi both include debugging facilities. You can also examine debugging through iSeries Navigator-> Databases-> Run SQL scripts... Start the SQL window, and select Run-> Debugger. It's intended for debugging your remote SQL requests, but it can be used however you see fit.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    BTW, you can make STRSRVJOB a little easier by using the SBREAK debug command to set a service entry point. See the SBREAK help on a debug command line for basic details. -- Tom
    125,585 pointsBadges:
    report
  • mvrkrishna
    1. SBMJOB ... HOLD(*YES)
    2. STRSRVJOB JOB(jobnbr/user/jobnam)
    3. RLSJOB JOB(jobnbr/user/jobnam) When Start Serviced Job display appears, press F10
    4. STRDBG When source is displayed, When source is displayed, set a breakpoint, press F12
    5. Call the program.

    Please let me know whether the above procedure correct or wrong? And, please correct me if I am wrong.
    530 pointsBadges:
    report
  • TomLiotta
    Please go back to your original question and note that STRDBG is step 3, and RLSJOB is step 4. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Also, you won't CALL the program. The SBMJOB command will call the program. -- Tom
    125,585 pointsBadges:
    report
  • WoodEngineer
    6,345 pointsBadges:
    report
  • TomLiotta
    A better green-screen debug method id described in Debugging RPG IV Programs - The Green-Screen Way. The article generally describes STRDBG. But at the end, it covers the use of Service Entry Points (SEPs) and how the debug batch jobs with them. I recommend learning this method and using it. -- Tom
    125,585 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