Automic Workload Automation

 View Only

  • 1.  How to pass two values from a sql vara to trigger a batch job

    Posted Aug 27, 2024 01:26 PM

    Hello All, i am working on use case for service desk from automic side. In this use case i am able to fetch values of table using sql vara and storing in sql vara and printing the output using pre process in sql job 

    so now i want to trigger a batch script by passing two parameters i.e  USD:11, 2781 and should keeps on incrementing till the last values, so for every row  values i want to trigger batch script and it should keeps on triggering the batch script for all the rows one after other. So how to pass these values to a execute a batch script in windows job. Please suggest me.

    Regards,

    Kiran Kumar Vasanthavada.



  • 2.  RE: How to pass two values from a sql vara to trigger a batch job

    Posted Aug 28, 2024 02:50 AM

    Hello Kiran,

    I hope that I understood you right. You want to pass each pair of values to an windows-job. Without been tested I would try:


    :set &hnd#=prep_process_var(ref_sql_vara) 
    :process &hnd#

    :pset &vk# = get_process_line(&hnd#,2)
    :pset &value# = get_proces_line(&hnd#,3)

    :print &vk#
    :print #value#

    :SET &ACTOBJ# = ACTIVATE_UC_OBJECT ( "<name of win-job>" ,,,,, PASS_VALUES)

    :endprocess
    :close_process &hnd#

    For each activation the windows-job will get the values of a new line in the variables &vk# and &value#.

    Regards,
    Bernhard




  • 3.  RE: How to pass two values from a sql vara to trigger a batch job

    Posted Aug 29, 2024 02:59 AM

    Hello Kiran,
    maybe put_read_buffer will do the trick?

    :PUT_READ_BUFFER (automic.com)

    :put_read_buffer vk# = &vk#
    :put_read_buffer value# = &value#
    :set &actjob# = activate_uc_object(jobs, <Jobname>) 




  • 4.  RE: How to pass two values from a sql vara to trigger a batch job

    Posted Aug 29, 2024 04:46 AM
    Edited by Juergen Lechner Aug 30, 2024 02:37 AM

    Hi,

    the code you provided needs to be in the Script section of a Window Job. Instead of the PRINT you can directly write the call of a Windows batch. Like


    'C:\Program Files\whatever\bin\do_something.bat &vk# &value#'

    This should do the trick.

    Regards,

    Juergen



    ------------------------------
    Juergen Lechner
    Managing Consultant
    setis GmbH
    Germany
    ------------------------------