Automic Workload Automation

Expand all | Collapse all

To get the Job stats based on OH, AH and JPP Tables

  • 1.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 04, 2018 08:11 AM
    Hi,

    I would like to query UC4 tables to get stats of all jobs that runs at specific time slot (to be decided). Requirement is to retrieve JOB NAME, CHAIN NAME (Chain to which the batch corresponds to), Job's START TIME, Job's END TIME. I mapped OH Table ID (Column = oh_idnr) JPP table ID (JPP_OH_IDNR) and AH table ID. But I'm able to get only CHAIN's START TIME and END TIME whereas unable to retrieve individual jobs timestamp. 

    Can someone help me ?


  • 2.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 04, 2018 10:03 AM
    Hi

    What do you mean by "at specific time slot (to be decided). " ?

    historical runs?
    current runs?
    future runs?
    only defined runs?



  • 3.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 04, 2018 11:34 AM
    Hi

    nofollow" href="https://community.automic.com/profile/9499/Sudharson%20Narayanamoorthy">Sudharson Narayanamoorthy"

    It's probably something that you can use the DB Reporting Tool for.

    It allows you to create reports based on given rules that you can freely set.

    Best regards,
    Antoine



  • 4.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 05, 2018 12:49 AM
    What do you mean by "at specific time slot (to be decided). " ?

    To get the stats for jobs that runs from 07:00 pm BKK to 08:00 am BKK


  • 5.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 05, 2018 12:54 AM
    Hi Antoine_Sauteron,

    Yea. I'm aware of that. However, here the requirement given is to populate the stats into a temp table (Stats for jobs that runs from 07:00 pm BKK to 08:00 am BKK). Based on that, some custom reports to be run and provided to business. 

    I use the below query temporarily to extract the details. I still need the Chain name to which each job corresponds to. If I join JPP table, I'm not able to get individual job's runtime (Start TIme, Activation Time and End Time).

    SELECT OH.OH_NAME BATCH, 
           TO_CHAR(AH.AH_TIMESTAMP1,'DD-MON-YYYY HH24:MI:SS') ACTIVATION_TIME,
           TO_CHAR(AH.AH_TIMESTAMP2,'DD-MON-YYYY HH24:MI:SS') START_TIME,
           TO_CHAR(AH.AH_TIMESTAMP4,'DD-MON-YYYY HH24:MI:SS') END_TIME
      FROM UC4.OH OH,
           UC4.AH AH 
     where OH.oh_client = '1002'
       AND OH.oh_otype = 'JOBS'
       AND OH.OH_IDNR = AH.AH_OH_IDNR
       AND ah.ah_timestamp2 BETWEEN to_date(to_char(sysdate-1,'DD-MON-YYYY') || ' 19:00:00','DD-MON-YYYY HH24:MI:SS') and to_date(to_char(sysdate, 'DD-MON-YYYY') ||' 08:00:00','DD-MON-YYYY HH24:MI:SS')
       ; 


  • 6.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 05, 2018 06:48 PM
    Looking at this query, why do you even need OH? AH has client, type and name.

    I'm not sure what "chain" is, are you looking for the Activator or the parent?


  • 7.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 08, 2018 04:40 AM
    SudharsonNarayanamoorthy603801, maybe that can help:

    SELECT ah2.ah_name         AS "Workflow"
         , ah1.ah_name      AS "Task"
         , ah1.ah_runtime   AS "Runtime in seconds"
         , ah1.AH_STATUS    AS "Status"
         , MSGTX.MSGTX_TEXT AS "Status-text"
         , TO_CHAR(ah1.ah_timestamp1, 'DD-MON-YYYY HH24:MI:SS') AS "Activation time"
         , TO_CHAR(ah1.ah_timestamp2, 'DD-MON-YYYY HH24:MI:SS') AS "Start time"
         , TO_CHAR(ah1.ah_timestamp4, 'DD-MON-YYYY HH24:MI:SS') AS "End time"
    FROM uc4.ah ah1
         , uc4.ah ah2
         , uc4.msgtx
    WHERE ah1.ah_client = '22'
         AND ah1.ah_otype = 'JOBS'
         AND ah2.ah_otype = 'JOBP'
         AND ah1.AH_ParentAct = ah2.ah_idnr
         AND ah1.AH_STATUS = MSGTX.MSGTX_MSG_IDNR
            AND MSGTX.MSGTX_MSGL_SHORT = 'E'
            AND ah1.ah_timestamp2 BETWEEN to_date(to_char(sysdate-1,'DD-MON-YYYY')
              || ' 19:00:00','DD-MON-YYYY HH24:MI:SS')
              AND to_date(to_char(sysdate, 'DD-MON-YYYY')
              ||' 08:00:00','DD-MON-YYYY HH24:MI:SS')
    ORDER BY 1, 6
    ;

    As SamahSohrab607228 said, OH is not necessary. I make a join on MSGTX as you get only status-numbers in AH. You need MSGTX to translate them to status text. If the number is ok for you, you can leave that part away.


  • 8.  RE: To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 29, 2020 02:57 AM
    Hi, 

    how can i get a list of the active workflows from sysdate-1 (23.00 o'clock) until today (06.00 o'clock)?
    I need the following informations: 
    Startdate and time
    Workflow name
    title 
    runtime

    Do you have an idea?


    Thanks in advance.


  • 9.  To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 08, 2018 12:07 PM
    Hi ClausJambrich602320,
    Thanks much for the feedback. Query you provided was much helpful.
    I will use it as a template for future development.


  • 10.  RE: To get the Job stats based on OH, AH and JPP Tables

    Posted Jan 30, 2020 03:12 PM
    I use 
    SELECT ah_alias as Job
    ,convert ( date, ah_timestamp1) Act_Date
    ,convert ( time, ah_timestamp1) Act_Time
    ,convert ( date, ah_timestamp2) Start_Date
    ,convert ( time, ah_timestamp2) Start_Time
    ,convert ( date, ah_timestamp4) End_Date
    ,convert ( time, ah_timestamp4) End_Time
    ,DATEDIFF(second, ah_timestamp2, ah_timestamp4) as Sec_Dur
    ,ah_title as Title
    ,ah_idnr as Runid
    ,ah_otype as Type
    ,ah_status as Status
    ,ah_RetCode as RC
    ,m.msgtx_text as Status_text
    ,ah_hostdst as Host
    FROM ah a, msgtx m
    WHERE ah_client = ?
    and (ah_hostdst in (?) or ? IS NULL)
    and (ah_status in (?) or ? IS NULL)
    and (ah_otype IN (?) or ? IS NULL)
    and m.msgtx_msgl_short = ?
    and CASE
    WHEN 'ACTIVATION' = ? THEN ah_timestamp1
    WHEN 'START' = ? THEN ah_timestamp2
    ELSE ah_timestamp4
    END between ? and ?
    and m.msgtx_msg_idnr = a.ah_status
    and (ah_otype = 'JOBS')
    and (convert( time, ah_timestamp3) between '00:00:00.0000000' and '07:00:00.0000000')
    and ah_alias <> 'JOBP.DSMIGN.WORKFLOW'
    and ah_alias <> 'JOBS.UNIX.DSMIGN'
    and ah_alias <> 'JOBS.GENERIC.CHECK.FILE'
    and ah_alias <> 'SCRI.GET_STEPS'
    and ah_alias not like 'CALL.ALERT%'
    order by ah_alias, ah_otype, ah_status, ah_timestamp2
    ;