How to retrieve all "system return code" from database?
Hi Haim, which product are you using? :-)
On a similar note, I would like to know if it's possible to retrieve the original system return code in AE, if you've used a condition/script to "modify status" ... which forces to change the "return code" to zero if you want ENDED_OK status.
We are under OM V8 and have not been able to locate table columns that retains the original return codes. It appears that the EH/AH_RetCode/Status columns are changed when the MODIFY_STATE statement is used in the Post Process and not copied somewhere else; if it is, it’s well hidden.
Our convention is to use the ADD_COMMENT function to record the original and subsequent change. Not ideal, but better than nothing. Sometimes we will subsequently use the PREP_PROCESS_COMMENT to extract the needed information. It’s a bit cumbersome as just using a GET_STATISTIC_DETAIL function would be more straight forward.
:SET &rc = GET_STATISTIC_DETAIL(,RETURN_CODE)
:SET &rc = FORMAT(&rc)
:SET &src = GET_STATISTIC_DETAIL(,STATUS)
:SET &src = FORMAT(&src)
:SET &emsg = "Return_code=&rc, Status=&src"
:ADD_COMMENT ,"Original &emsg"
:MODIFY_STATE STATUS_TEXT="Retcode=&rc, Status=&src"
Hi Idan, which product are you using?
For AE status codes: Documentation > User Guide > Objects > Working with Objects > Returncodes > System Return Codes of Executable Objects
If you want the return codes from the jobs themselves...
For OM or AE: select ah_retcode from ah where ah_idnr = [your RUNID]
For AM: select so_return_code from so_job_history where so_jobid = [your jobid]
If you are only wanting to check jobs that are currently active in the activities window you, you only need the EH table. The AH is an Archive.
We have a job that runs and check the current status of jobs and checks for any that might be hung up or overly exceeding a max run. It ignores status that are waiting for other jobs in a workflow and stuff like that.
If you are using the Automation Engine, you can create a SQLI variable which will populate this info into the variable table that can be used in the Engine.
WHERE EH_Client LIKE '200'
AND EH_OType NOT IN ('EVNT','JSCH')
AND EH_Status < '1800'
AND EH_Status NOT IN ('1700')
/*these last three are all one statement---- AND ((x and y) or z)*/
AND ((DATEPART(hh,SYSUTCDATETIME()) - DATEPART(hh, [EH_RDate]) >= 4
AND DATEPART(mi, [EH_RDate]) - DATEPART(mi, SYSUTCDATETIME()) <= 0)
OR CONVERT(DATE, [EH_RDate]) < CONVERT(DATE, SYSUTCDATETIME()))
Retrieving data ...