Outputting Job Logs and messages to a file. - IBM AS400

This is a discussion on Outputting Job Logs and messages to a file. - IBM AS400 ; I have a CL program that runs every night and copies one file to another. Users need to verify that the copy completed successfully, among other things. When I DSPJOBLOG to a file, I do not see the completion message ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Outputting Job Logs and messages to a file.

  1. Outputting Job Logs and messages to a file.

    I have a CL program that runs every night and copies one file to
    another. Users need to verify that the copy completed successfully,
    among other things. When I DSPJOBLOG to a file, I do not see the
    completion message for the copy, i.e. 3 records copied to mylib/
    myfile. I would like to output the jobjog and the message file to a
    log file that the user could display every morning. Any info is
    always appreciated.

    Thad Rizzi


  2. Re: Outputting Job Logs and messages to a file.

    On May 24, 5:11 pm, Thad Rizzi wrote:
    > I have a CL program that runs every night and copies one file to
    > another. Users need to verify that the copy completed successfully,
    > among other things. When I DSPJOBLOG to a file, I do not see the
    > completion message for the copy, i.e. 3 records copied to mylib/
    > myfile. I would like to output the jobjog and the message file to a
    > log file that the user could display every morning. Any info is
    > always appreciated.
    >
    > Thad Rizzi


    should work. what does the code look like? here is my version:
    CRTPF FILE(QTEMP/COPYCOMSRC) RCDLEN(80)
    CPYF FROMFILE(COMSRC) TOFILE(QTEMP/COPYCOMSRC) +
    MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(qgpl/JOBLOG)



  3. Re: Outputting Job Logs and messages to a file.

    On May 24, 2:36 pm, Steve Richter wrote:
    > On May 24, 5:11 pm, Thad Rizzi wrote:
    >
    > > I have a CL program that runs every night and copies one file to
    > > another. Users need to verify that the copy completed successfully,
    > > among other things. When I DSPJOBLOG to a file, I do not see the
    > > completion message for the copy, i.e. 3 records copied to mylib/
    > > myfile. I would like to output the jobjog and the message file to a
    > > log file that the user could display every morning. Any info is
    > > always appreciated.

    >
    > > Thad Rizzi

    >
    > should work. what does the code look like? here is my version:
    > CRTPF FILE(QTEMP/COPYCOMSRC) RCDLEN(80)
    > CPYF FROMFILE(COMSRC) TOFILE(QTEMP/COPYCOMSRC) +
    > MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    > DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(qgpl/JOBLOG)


    Right it does work but I do not get the completion message for the
    copy. Really if I can just get that to a file with a date time stamp
    I'd be good. The message I want but don't see in the outfile is:

    CPC2955 0 &7 records copied from member &3.

    If I monitored that message could I output it?


  4. Re: Outputting Job Logs and messages to a file.

    On May 24, 2:36 pm, Steve Richter wrote:
    > On May 24, 5:11 pm, Thad Rizzi wrote:
    >
    > > I have a CL program that runs every night and copies one file to
    > > another. Users need to verify that the copy completed successfully,
    > > among other things. When I DSPJOBLOG to a file, I do not see the
    > > completion message for the copy, i.e. 3 records copied to mylib/
    > > myfile. I would like to output the jobjog and the message file to a
    > > log file that the user could display every morning. Any info is
    > > always appreciated.

    >
    > > Thad Rizzi

    >
    > should work. what does the code look like? here is my version:
    > CRTPF FILE(QTEMP/COPYCOMSRC) RCDLEN(80)
    > CPYF FROMFILE(COMSRC) TOFILE(QTEMP/COPYCOMSRC) +
    > MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    > DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(qgpl/JOBLOG)


    Hold on. I do get the mesasage but not the text. Need the text for
    the end user.


  5. Re: Outputting Job Logs and messages to a file.

    I think RCVMSG and SNDUSRMSG might do the trick.


  6. Re: Outputting Job Logs and messages to a file.

    On May 24, 10:43 pm, Thad Rizzi wrote:
    > On May 24, 2:36 pm, Steve Richter wrote:
    >
    >
    >
    >
    >
    > > On May 24, 5:11 pm, Thad Rizzi wrote:

    >
    > > > I have a CL program that runs every night and copies one file to
    > > > another. Users need to verify that the copy completed successfully,
    > > > among other things. When I DSPJOBLOG to a file, I do not see the
    > > > completion message for the copy, i.e. 3 records copied to mylib/
    > > > myfile. I would like to output the jobjog and the message file to a
    > > > log file that the user could display every morning. Any info is
    > > > always appreciated.

    >
    > > > Thad Rizzi

    >
    > > should work. what does the code look like? here is my version:
    > > CRTPF FILE(QTEMP/COPYCOMSRC) RCDLEN(80)
    > > CPYF FROMFILE(COMSRC) TOFILE(QTEMP/COPYCOMSRC) +
    > > MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    > > DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(qgpl/JOBLOG)

    >
    > Hold on. I do get the mesasage but not the text. Need the text for
    > the end user.- Hide quoted text -
    >
    > - Show quoted text -


    Maybe you can put chgjob log(4 0 *seclvl) just before the copy then
    chgjob log(4 0 *nolist) just after it. Or maybe some other
    combination. I think you need *seclvl to get full details.

    HTH
    Jonathan


  7. Re: Outputting Job Logs and messages to a file.

    On May 25, 4:25 am, Jonathan Bailey wrote:
    > On May 24, 10:43 pm, Thad Rizzi wrote:
    >
    >
    >
    >
    >
    > > On May 24, 2:36 pm, Steve Richter wrote:

    >
    > > > On May 24, 5:11 pm, Thad Rizzi wrote:

    >
    > > > > I have a CL program that runs every night and copies one file to
    > > > > another. Users need to verify that the copy completed successfully,
    > > > > among other things. When I DSPJOBLOG to a file, I do not see the
    > > > > completion message for the copy, i.e. 3 records copied to mylib/
    > > > > myfile. I would like to output the jobjog and the message file to a
    > > > > log file that the user could display every morning. Any info is
    > > > > always appreciated.

    >
    > > > > Thad Rizzi

    >
    > > > should work. what does the code look like? here is my version:
    > > > CRTPF FILE(QTEMP/COPYCOMSRC) RCDLEN(80)
    > > > CPYF FROMFILE(COMSRC) TOFILE(QTEMP/COPYCOMSRC) +
    > > > MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    > > > DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(qgpl/JOBLOG)

    >
    > > Hold on. I do get the mesasage but not the text. Need the text for
    > > the end user.- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Maybe you can put chgjob log(4 0 *seclvl) just before the copy then
    > chgjob log(4 0 *nolist) just after it. Or maybe some other
    > combination. I think you need *seclvl to get full details.
    >
    > HTH
    > Jonathan- Hide quoted text -
    >
    > - Show quoted text -


    Thanks for the suggestion. I can see the text message in my job log.
    With a DSPJOBLOG to a file it doesn't get the text just the components
    of the message. Basically I just want to write this message to a log
    to show that every night records were copied. Seems like this should
    not be difficult. I think I am missing something obvious.


  8. Re: Outputting Job Logs and messages to a file.

    Use the data from the QMHMDT field from the OUTFILE from DSPJOBLOG as
    input for the MSGDTA() on a RTVMSGD. The output to the MSG() on that
    RTVMSGD request can then be posted.
    FWiW just adjusting the program to post a completion when it does not
    fail, and not producing any joblog output in that case may be a
    reasonable alternative to all the additional work; i.e. post a received
    escape and leave the joblog as a record, but just like normal LOG(4 0
    *SECLVL) with a completion, there is no output since the request
    completed without error.

    Regards, Chuck
    -- All comments provided "as is" with no warranties of any kind
    whatsoever and may not represent positions, strategies, nor views of my
    employer

    Thad Rizzi wrote:
    > On May 25, 4:25 am, Jonathan Bailey wrote:
    > Thanks for the suggestion. I can see the text message in my job log.
    > With a DSPJOBLOG to a file it doesn't get the text just the components
    > of the message. Basically I just want to write this message to a log
    > to show that every night records were copied. Seems like this should
    > not be difficult. I think I am missing something obvious.
    >


  9. Re: Outputting Job Logs and messages to a file.

    On May 25, 11:13 am, CRPence wrote:
    > Use the data from the QMHMDT field from the OUTFILE from DSPJOBLOG as
    > input for the MSGDTA() on a RTVMSGD. The output to the MSG() on that
    > RTVMSGD request can then be posted.
    > FWiW just adjusting the program to post a completion when it does not
    > fail, and not producing any joblog output in that case may be a
    > reasonable alternative to all the additional work; i.e. post a received
    > escape and leave the joblog as a record, but just like normal LOG(4 0
    > *SECLVL) with a completion, there is no output since the request
    > completed without error.
    >
    > Regards, Chuck
    > -- All comments provided "as is" with no warranties of any kind
    > whatsoever and may not represent positions, strategies, nor views of my
    > employer



    Thanks. I will definitely check that out. I am playing with
    different options now. Alert for either success or failure and what
    not. I would like a log with the date and the records copied either
    way.


  10. Re: Outputting Job Logs and messages to a file.

    The QGYOLJBL API might be of some use. Or you could monitor for a
    failed a copy and use RTVMBRD (or SQL) to get the number of records if
    the copy succeeds.


  11. Re: Outputting Job Logs and messages to a file.

    Is it limiting you to a "primary" output file (whatever that means)?
    >From the DSPJOBLOG help text...


    *OUTFILE
    The output is directed to the database file specified
    in the OUTFILE parameter. This option can only be used
    if the JOB parameter specifies the special value
    asterisk (*). Using this option only allows a primary
    output file to be produced.

    If you specify OUTPUT(*PRINT) to create a spooled file then CPYSPLF
    that to a physical file you might get what you're looking for. For
    that matter though you could adjust the log level (as previously
    suggested) on your SBMJOB command (or in the job description) and just
    have the operator review the spooled file rather than a physical
    file. I hate it when I make the ADMINISTRATIVE decision to
    force a joblog only to find that a programmer has nullified that with
    a CHGJOB...*NOLIST inside a program.


    Another possiblity is the PRINT parameter of the CPYF command.
    Probably not practical for large files but your example is only 7
    records.


+ Reply to Thread