ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Capturing job log information on a text file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Capturing job log information on a text file

    Hello.
    First of all, I am not a programmer, so what I'm looking for is some sort of guidance with a project I have.
    I know AS/400 from a user/administrative perspective but I have been asked to come up with a way to export the start and end times of jobs running in QBATCH subsystem to a flat file that then can be exported to a document such as a spreasheet. This is to reflect the times both start, end and the obtain the elapsed time for a series of jobs that run in a daily basis.

    Since I have no prior programming experience on RPG or COBOL or the sort, I have no clue on how to do this (well, so maybe someone can start by recommending me to study programming in this environment but I would like to take that approach only if necessary)
    I have tools such as the entire IBM ISeries Access for Windows kit (That comes with a green screen 5250 emulator and Windows Navigator interface) but cannot seem to find a way to do that here.
    If I could only find a way to capture the start and end times of jobs (from job log) and export that information to a file, that's basically all I need.

    Any one has any idea? Maybe someone can even refer me to a proper forum.
    Thanks a lot for any help.....In advance.

    Regards,
    Oscar

  • #2
    Re: Capturing job log information on a text file

    Try reading the QHST logs from QSYS, and look for messages CPF1124 and CPF1164 (start and end of jobs), write this out to an outfile.
    Additional information can be gained by calling API's for the job/number/user as pulled from the CPF messages.

    We have a bit of code somewhere . . . it's a bit messy though, will see about tidying it up.

    GC
    Greg Craill: "Life's hard - Get a helmet !!"

    Comment


    • #3
      Re: Capturing job log information on a text file

      thanks Gcraill.
      Now, how can I read the QHST logs from QSYS?
      I have tried displaying the messages by submitting the command: WRKMSGQ MSGQ(QHST) and see what's inside but I get the following:

      Message . . . . : Function not allowed for system log message queue QHST.
      Cause . . . . . : The system log message queue can only be displayed or sent
      a message. It cannot be wrapped if it becomes full.
      Recovery . . . : To display a log message queue, use the Display Log
      (DSPLOG) command. To send a message to a log message queue, use either the
      Send Program Message (SNDPGMMSG) command, the Send Message (SNDMSG) command,
      or the QMHSNDM program.


      When I submit the command DSPLOG , the press F4 I see log is showing QHST as per default. If I press enter and leave the rest of parameters as per default, I can see the job start (message ID CPF1124) and end time (Message ID CPF1164) , but how can I get this info in such way that I can capture it and send it to a file?
      I already knew how to get to this point, by displaying the user messages or even in QSYSOPR (System request option 6) but I need this to be exported in text format.

      Anyhow, I have to admit that I am not very 'versed' in much more than operational commands so even though I understand where you want me to get this information from, I can't still figure out how to send it to, let's say a file, and how to capture it automatically in plain text that later I can export to Excel.

      You mentioned there's some code somewhere, is there something I can use?
      Thanks again!

      Regards,

      Moris.

      Comment


      • #4
        Re: Capturing job log information on a text file

        A messy way... but after DSPLOG to a print, you can then CPYSPLF the print to a file and SQL out the records you don't want. Then transfer the file to PC.

        You might also be able to do it through Navigator.
        Regards

        Kit
        http://www.ecofitonline.com
        DeskfIT - ChangefIT - XrefIT
        ___________________________________
        There are only 3 kinds of people -
        Those that can count and those that can't.

        Comment


        • #5
          Re: Capturing job log information on a text file

          kitvb1,
          have you attempted to do anything similar through Navigator? I was actually hoping someone would give me some light over the Windows tool.
          Thanks.

          Comment


          • #6
            Re: Capturing job log information on a text file

            Hi morisn,

            I'm afraid not... but one can access the DSPLOG(QHST) from navigator. Which means (to my warped logic) that there must be an .exe, .dll, etc., that runs it.

            'fraid you gonna have to play with it yourself 'cos I don't know much about the PC side. Maybe one of your techies?

            Because DSPLOG doesn't give the option to output to an outfile (even with Navigator), gcrail's solution using an API would most likely be the best bet.
            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: Capturing job log information on a text file

              Originally posted by kitvb1 View Post
              ...
              Because DSPLOG doesn't give the option to output to an outfile (even with Navigator), gcrail's solution using an API would most likely be the best bet.
              Hello,

              there is no problem to have the DSPLOG as Outputfile.
              Just use
              PHP Code:
                           OVRDBF     FILE(QPDSPLOGTOFILE(QTEMP/LISTSLVLCHK(*NO)
                           
              DSPLOG     PERIOD((000001 &TTMMJJ) (235959 &TTMMJJ)) +
                                        
              OUTPUT(*PRINT) MSGID(CPF1124 CPF1164)
                           
              DLTOVR     FILE(QPDSPLOG
              in an CL and it will work.
              The Outputfile is just one big string for each record and should be separated in an extra PGM (RPG?), but this is not so complicated.
              Have done this several times.

              kuempi

              Comment


              • #8
                Re: Capturing job log information on a text file

                Another option is to activate job accounting as the job date and time is available in job accounting.
                Look here to set up job accounting.
                Philippe

                Comment


                • #9
                  Re: Capturing job log information on a text file

                  Originally posted by Mercury View Post
                  Another option is to activate job accounting as the job date and time is available in job accounting.
                  Look here to set up job accounting.
                  This was listed as V5R4 - is it also available at V5R3 ?

                  In order to have this info available for reporting you do not want to do continuous DSPJRN to get the results, so would have to DSPJRN the relevant information to an outfile anyway to run reports over. May a well go the QHST route as you are not introducing another layer of journaling to use up system resource.

                  Not that I am guru at this stuff - just my initial thoughts . . .

                  But thanks for the read Philippe - I didn't know that was even an option !
                  GC
                  Greg Craill: "Life's hard - Get a helmet !!"

                  Comment


                  • #10
                    Re: Capturing job log information on a text file

                    Originally posted by Greg
                    is it also available at V5R3 ?
                    Yes indeed ! Look here.
                    Philippe

                    Comment

                    Working...
                    X