Automic Workload Automation

Expand all | Collapse all

Capture from Last Report and Store as a Variable

Jump to Best Answer
  • 1.  Capture from Last Report and Store as a Variable

    Posted 01-20-2020 07:58 AM
    Edited by Kenneth Hutchins 01-21-2020 09:49 AM
    I am trying to capture a value produced from a file transfer job.


    We want to capture the numerical value showing the number of files transferred.

    We tried this syntax in the post process which fails. 


    :set &HND# = PREP_PROCESS_REPORT(,"REP","*file(s) copied.*","COL=DELIMITER", 'DELIMITER=*"*')
    :PROCESS &HND#
    : SET &LINE# = GET_PROCESS_LINE (&HND#,2)
    : PRINT "NUMFILS IS NOW SET TO:&NUMFILS#"
    :ENDPROCESS
    :close_process &HND#
    :put_var "KENNY.NUMFILS","NUMFILS","&NUMFILS#"


  • 2.  RE: Capture from Last Report and Store as a Variable

    Posted 01-20-2020 08:14 AM
    Edited by Christoph Rekers 01-20-2020 08:21 AM
    Hi Kenneth,

    If a JOBF fails, the REP states a certain U-Number e.g. U00011134. Just insert the U-Number you're locking for like this to the Post-Process tab, that's it:

    :set &HND# =PREP_PROCESS_REPORT(,,"REP","*U00011134*")
    :set &count# = GET_PROCESS_INFO(&HND#,ROWS)
    :print &count#


    ...you mean files, not fails, right? Just change U00011134 by U00011133 (that's the U-Number for "Transfer was ok")
    .... and you mean a FTP job, not a JOBF, right? okay, than just apply your original filter...


    Cheers
    Christoph 


  • 3.  RE: Capture from Last Report and Store as a Variable

    Posted 01-21-2020 09:46 AM
    yes files


  • 4.  RE: Capture from Last Report and Store as a Variable

    Posted 01-22-2020 03:26 AM
    In my first post I missed the attached screen shot...
    The screen shot you provided looks like a JOBS report of a DOS copy command, not a FTP-JOBS or JOBF report. The more details you provide, the better we can help you ;-)
    Anyway...this should work:

    ! I use "file(s) co" as delimiter. The first column of the handle contains the desired number
    :SET &HND# = PREP_PROCESS_REPORT(,,"REP", "*file(s) copied.*","COL=DELIMITER","DELIMITER=*file(s) co*")
    :PROCESS &HND#
    : SET &number# = GET_PROCESS_LINE(&HND# , 1)
    :set &number# = str_trim(&number#)
    : PRINT &number#
    :ENDPROCESS
    :CLOSE_PROCESS &HND#


    Christoph



  • 5.  RE: Capture from Last Report and Store as a Variable

    Posted 01-21-2020 08:14 PM
    In your posted script, I don't see where it populates variable &NUMFILS#?   I suspect the value you want should be in the &LINE# variable....

    ------------------------------
    Pete
    ------------------------------



  • 6.  RE: Capture from Last Report and Store as a Variable
    Best Answer

    Posted 01-22-2020 10:15 AM
    Thanks guys!

    :SET &HND# = PREP_PROCESS_REPORT(,,"REP", "*file(s) copied.*","COL=DELIMITER","DELIMITER=*file(s) co*")
    :PROCESS &HND#
    : SET &number# = GET_PROCESS_LINE(&HND# , 1)
    :set &number# = str_trim(&number#)
    : PRINT &number#
    :ENDPROCESS
    :CLOSE_PROCESS &HND#
    :put_var "NUMFILESVAR.JOBIDS","NUMFILS","&number#"

    worked.