Skip to Content
author's profile photo Former Member
Former Member

Write to spool even when job abends?

There's got to be a way to do this, but I can't seem to find it. I have several background jobs, each of which writes some diagnostic information to the spool. That diagnostic information would be most useful in cases where the job terminates unsuccessfully. But, in those cases, the spool is never saved, and all that information is lost.

I know I can write to the job log instead of the spool, but is there a way other than the log to obtain\show that information? Assume that my program is robust enough to capture all error conditions before terminating.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2004 at 11:40 AM

    Hello Chris,

    I'm sure you might be knowing this, but shall post it here anyways, just in case it skipped your mind.

    When you run a background job, the job will abend when either of the following types of message are issued in the program:

    1. Warning Message ( Type W )

    2. Error Message ( Type E )

    3. Abend Message ( Type A )

    4. Short Dump Message ( Type X )

    In case of either an Abend Message or a Short Dump Message, the entire spool list is erased and thereafter unavailable.

    However, in case of either an error message or a warning message, the contents of the spool till the point where the message has occurred are retained.

    So, in your case, I suspect that there are some abend messages in the program, issued upon erroneous conditions. If you could change them to ERROR messages (or WARNING messages as you deem appropriate), the spool list is not destroyed.

    For your further understanding, I have included the following code snippet.


    do 10 times.

    write : / sy-index.

    case sy-index.

    when 3.

    message s702(bctrain).

    when 5.

    message i702(bctrain).

    when 7.

    message w702(bctrain). " or message e702(bctrain).




    The above program, when scheduled as a background job will get abended, but will retail the spool list :








    After 7, the warning message abends the job and no other numbers are printed.

    Hope this explanation would help you overcome your problem.


    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.