Automic Workload Automation

  • 1.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 02, 2015 05:39 AM
    Hi guys,
    I am hoping this will be an easy one for someone on here.

    I have run a job which returns a certain string into the post process tab on the "last report" so the string returned is 
    2015-07-02 08:32:47 - U00020408 "Start : Despatch ( 08:32:45 ) SPRE/2514195/2 ARBMS2-15.5"

    this string may be different based on what the system is processing but will always have a time stamp inside it but not necessarily in brackets.

    What i want is to strip out this time stamp so i can compare it to the current system time and work out the delay.

    i have tried  the below scripting elements but can not get the results i am after, either there is an easier way to search and extract a certain string but at this moment in time i have not been on any formal training so am reliant on Automic staff and the community for help.

    :set &HND# = PREP_PROCESS_FILE
    :PROCESS &HND#
    : SET &LINE1#=GET_PROCESS_LINE

    Are there any tried and tested ways of extracting and manipulating the reports section of jobs? And are these documented anywhere for a newbie to get stuck into? Are there any stand alone guides\walkthroughs that are community supported?

    Thanks


  • 2.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 02, 2015 06:14 AM
    Hi JamesFenoulhet611119

     Is the Timestamp always stored in the first line of the post process report? Does the timestamp always have the same format (HH:MM:SS)?

    Regards
    Joel


  • 3.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 02, 2015 06:29 AM



    :SET &MY_OBJECT# = 'your_object_with_postreport_here'
    :SET &RUNNR# = GET_STATISTIC_DETAIL(, RUNID, &MY_OBJECT#)
    :PRINT "PROCESSING REPORT FOR: &MY_OBJECT# ( &RUNNR# )"

    :SET &HND# = PREP_PROCESS_REPORT(,&RUNNR#, POST, '*??:??:??*')
    :PROCESS &HND#
    :   SET &RET# = GET_PROCESS_LINE(&HND#,1)
    :   PRINT "FILTER MATCH ON LINE: &RET#"
    :   SET &POS# = STR_FIND_REV(&RET#, ':')
    :   SET &POS_START# = SUB(&POS#, 5)
    :   SET &TIMESTAMP# = STR_CUT(&RET#, &POS_START#, 8)
    :   PRINT "TIMESTAMP IS: &TIMESTAMP#"
    :ENDPROCESS



  • 4.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 02, 2015 10:00 AM
    hi Joel, yes, always first line and always in the same format. 
    Have you ever been on the scripting course provided by automic, would you example scripting be touched upon in that course or are you more self trained?


  • 5.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 02, 2015 10:15 AM
    hi Joel, great bit of scripting, thanks. Has done exactly what i need.
    Cheers


  • 6.  Find a certain string (ie time stamp) in a report from a job

    Posted Jul 03, 2015 01:38 AM
    Hi JamesFenoulhet611119

    Just be aware, that if you have any colon (:)  between the timestamp and the end of line the result will not be as expected. However searching for a xx:xx:xx combination would be some more code. If you need a more sophisticated solution let me know and I'll try to help ;-).

    Actually yes. I've been in a scripting course led by peter_grundler_automic. However I also have programming experience in other areas and really appreciate the F1 help. The technical writers of Automic do a really good job.

    Cheers
    Joel