Automic Workload Automation

Expand all | Collapse all

Java CALL API - Is possible to retrieve the executed job run-id running instead of CALL API script.

  • 1.  Java CALL API - Is possible to retrieve the executed job run-id running instead of CALL API script.

    Posted Nov 09, 2017 07:58 AM
    Hi Team,

    Is it possible to retrieve the run-id of activated job instead of script id.

    piece of code:
    automicJobScript = ":SET &ACTJOB# = ACTIVATE_UC_OBJECT("+jobName+",wait)";
                        response =uc4.activateScript(automicJobScript); 
    if it executed successfully i am retrieving "OK" Message.

    When i call this method UC4.getRunNumber(). It returning CALL API run-id not the Activated-job id. Please advise.

    In addition,is it possible to Send more than one command in activateScript.

    Please share your thoughts. 

    Thanks


  • 2.  Java CALL API - Is possible to retrieve the executed job run-id running instead of CALL API script.

    Posted Nov 09, 2017 01:36 PM
    To my knowledge, the "callapi" process can not provide any response information other than the runid of the script it activated.   

    If you require additional response information, then you'll have to engineer your own solution.  For instance the UC4 object you launch could write the information you need into a database table and you could query that database table.

    I would be careful about using the "wait" option via callapi.  This can create the need for a long running connection with your AE that will expend more AE resources.   If you can have more than one of these running at a time, then the resource impact will be multiplied and put your AE at risk.


  • 3.  Java CALL API - Is possible to retrieve the executed job run-id running instead of CALL API script.

    Posted Nov 09, 2017 04:41 PM
    I'm a little short on time today, but here's a snip from a shell script we use for CallAPI job launches (this is a job in one instance to launch a job in another). I think it may give you some ideas; feel free to reply with questions & I'll take a look Monday. :smile:

    Output from the calling job looks like this...

    NOTE: The first RunID output by the API is for the *SCRIPT object.
    To ensure GEN_PAYPAL_RELEASE_REQUEST ran, look for a second RunID and success message.

    Initiating UC4 CallAPI...

    20171109/131841.953 - U3000000 Program 'UC4 Call Interface' version '9.00A114-511' started.
    20171109/131849.362 - U3000004 RunID '542707231'
    20171109/131849.365 - U0000050 Job GEN_PAYPAL_RELEASE_REQUEST with RunID 0542681803 activated.
    20171109/131849.365 - U3000001 Program 'UC4 Call Interface' version '9.00A114-511' ended normally.

    UC4 *SCRIPT object ended with 4.
    This indicates success! Returning zero!
    # Write the API code into a temp file
    tempfile="$tempdir/$ts.scr"
    echo "Using temp file $tempfile"

    echo ":PSET &CALLING_CHAIN_ID# = $parent_chain_id" >> $tempfile
    echo ":PSET &CALLING_CHAIN_CLIENT# = &$CLIENT#" >> $tempfile
    echo ":SET &JOBID = ACTIVATE_UC_OBJECT($job,,,,,PASS_VALUES)" >> $tempfile
    echo ":IF &JOBID = '0000000'" >> $tempfile
    echo ":  STOP MSG,51,'Failed to start $job !!!'" >> $tempfile
    echo ":ELSE" >> $tempfile
    echo ":  STOP MSG,50,'Job $job with RunID &JOBID activated.'" >> $tempfile
    echo ":ENDIF" >> $tempfile
    echo ""


    # A note about the UC4 output (which can be misleading)

    echo "NOTE: The first RunID output by the API is for the *SCRIPT object."
    echo "To ensure $job ran, look for a second RunID and success message."
    echo ""
    echo "Initiating UC4 CallAPI..."
    echo ""

    # Call the API to start the job

    ./$CallAPI INI=$inifile $tempfile # Deal with the error code passed from CallAPI myErr=$? echo "" echo "UC4 *SCRIPT object ended with $myErr." if [ $myErr -eq 4 ]; then         echo "This indicates success! Returning zero!"         rm $tempfile         (exit 0) else         echo "This indicates a problem!"         echo "The object $job might not exist, or it might have encountered a FAULT status."         echo "Returning error!"         (exit $myErr) fi


  • 4.  Java CALL API - Is possible to retrieve the executed job run-id running instead of CALL API script.

    Posted Nov 10, 2017 12:16 AM
    Thanks Jesscia,

    By using :STOP MSG action . I am able to retrieve the Run-id of the activated job. 

    automicJobScript = ":SET &ACTJOB# = ACTIVATE_UC_OBJECT("+jobName+")\r\n:IF &ACTJOB# > 0\r\n:stop msg,50,\"Runnr = &ACTJOB#\"\r\n:ENDIF"

    Thanks pete for the info.For testing purpose added "WAIT" to the script will remove once tested.