AppWorx, Dollar Universe and Sysload Community

 View Only

 Help with Appworx After Condition and SQL for Queue

Kellie Brown's profile image
Kellie Brown posted Apr 22, 2024 09:24 AM

I need help with using an After condition to extract data from a report.  I have a sub var to look up the queue from the job and its currently bringing back the previous not the most current queue. 

Job A runs 9a noon and 3p

Sub Var for history query:

select max(so_ref1) from so_job_history where so_module in ('job A name') 
and (so_job_finished) >= sysdate -(12/24)

When the above sub var is run right after the job runs it picks up the exact queue at 9, noon and 3p.  My problem is when I set up an After condition to extract data from the Job A report, at noon it will pick up the 9a queue not the noon queue.  I also created a dummy job to run After Job A and let it sleep for 100 seconds it still picks up the 9a queue not the noon queue at noon'ish.  

G:\OSI\RPTS\OSIPROD\{#yyyymmdd_today}\{#quenbr_JOBA}\JOB A.LIS

Is there something I can change or adjust to pick up the exact queue of Job A? 

Pat Richards's profile image
Pat Richards

i suspect the issue is that the job data doesn't appear in the so_job_history table until after the job is complete, and this would include after conditions

try using the so_job_queue table instead:

       select so_ref1 from so_job_queue where so_jobid={jobid}

let us know how you get on

Kellie Brown's profile image
Kellie Brown

Pat Richards, 

I figured out another way to get the queue number by not using the so_job_history table even though the information is there.  I can use (extract from) the Appworx o log to get the queue number then populate that in a sub var.  From that I can get everything I need from the report.  

Thanks for the help!!  Much appreciated.

Dominic Aloi's profile image
Dominic Aloi

Hi Kellie,

I saw that you already figured out another way, but I wanted to share what we have been using to get the job queue number.  We run this SQL in the after condition of a job when we want to set the queue number to a substitution variable:

SELECT TO_CHAR (MAX(QUENBR))
FROM QUE
WHERE QUEDESC = '{module}'

Let me know if I can provide additional information.

Thank you,

Dominic