How to Reference ProcessID of Job in other objects

Document ID : KB000089869
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
How to Reference ProcessID of Job in other objects
Resolution:
Detailed Description and Symptoms

Jobs that run on Agents that integrate with Applications return a Application jobid as the 'ProcessID'

Sometimes this ID needs to be referenced in other Objects or Notifications.


Solution

?In the Post-Process Tab add the following script in an Include or straight into the Tab:

 

:set &pid#=prep_process_var(PROCESS.ID)
:process &pid#
: set &pid_nbr#=get_process_line(&pid#,1)
: p &pid_nbr#
:put_var PID_NBR.VAR,"pid.&$RUNID#",'&pid_nbr#', '&$PHYS_DATE_DDMMYY#'
:endprocess
:close_process &pid#

 

The Script references a SQLI Variable(PROCESS.ID). The statement in the variable would be:

 

select ah_processid from ah where ah_idnr=&$RUNID#

 

The Script then inserts the value into a Static Variable(PID_NBR.VAR) with the Key being pid.<runid>. The Variable can be referenced by an object later on.

 

 

 

To clean out the entries in the Static Variable, put the following Script in a Script Object and schedule it to run weekly/monthly/etc:

:set &pid#=prep_process_var(PROCESS.ID)
:process &pid#
:    set &pid_nbr#=get_process_line(&pid#,1)
:    set &date#=get_process_line(&pid#,3)
:    if &date# <> &$PHYS_DATE_DDMMYY#
:      delete_var "PROCESS.ID", "&pid_nbr#"
:    endif
:endprocess

:close_process &pid#