× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rob,

Thanks for the SQL info.

That worked, however the response time on the QSYS2.OUTPUT_QUEUE_ENTRIES is poor, 5 minutes+.
Thus, for Month End process, when I have to run hundreds of these, could be a performance issue.
Good for onesies, though.

SELECT
spooled_file_name,
job_name,
file_number,
user_data,
status,
create_timestamp,
x.*
FROM QSYS2.OUTPUT_QUEUE_ENTRIES x
WHERE substr(job_name, locate('/', job_name, 8) + 1, 10)='DEFREVENUE' and
user_data = 'Deferred '
ORDER BY create_timestamp DESC
FETCH FIRST 1 ROWS ONLY
SELECT statement run complete.

I went back to QSYS2.JOB_INFO.

https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/QSYS2.JOB_INFO%20UDTF

Since I couldn't select on the needed fields, I selected what I could to a file, then ran a 2nd SQL over the output file.
Works, not pretty.

SELECT * FROM TABLE(QSYS2.JOB_INFO(JOB_USER_FILTER => 'MSROBOT',
JOB_STATUS_FILTER => '*OUTQ')) X
File JOBINFO in QGPL was created.

select * from qgpl.jobinfo where substr(job_name,16,10) =
'DEFREVENUE' order by JOB_E00001 desc
FETCH FIRST 1 ROWS only
SELECT statement run complete.

Now I have options.
And I have improved logic ensuring the last occurrence of a spoolfile will be release.

Paul


From: Rob Berendt [mailto:rob@xxxxxxxxx]
Sent: Monday, February 05, 2018 8:19 AM
To: Midrange Systems Technical Discussion
Subject: RE: Order of output for QUSLJOB API

So something like this wouldn't work?
SELECT
spooled_file_name,
job_name,
file_number,
user_data,
status,
create_timestamp,
x.*
FROM QSYS2.OUTPUT_QUEUE_ENTRIES x
WHERE substr(job_name, locate('/', job_name, 8) + 1, 10)='SS6066' and
user_data = 'PRDSCD-31'
ORDER BY create_timestamp DESC
FETCH FIRST 1 ROWS ONLY;

(bcc'ing you attached image)

[cid:image001.gif@01D39E67.E56E2F60]


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com<http://www.dekko.com/>





From: "Steinmetz, Paul" <PSteinmetz@xxxxxxxxxx<mailto:PSteinmetz@xxxxxxxxxx>>
To: "'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxx>>
Date: 02/03/2018 11:44 AM
Subject: RE: Order of output for QUSLJOB API
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxx>>
________________________________



Rob,

I played around with JOB_INFO and GET_JOB_INFO.
In both cases, I was not able to select a specific job, which is what I need for the next step.
Selecting by job name was not an option.

The bigger goal is to find and release the latest spoolfile for a specific job.
I know the job name, spoolfile name, user data.
I do NOT know the job number.

I also looked at the Spool Services, hoping to maybe being able to select the exact spool file, no luck there.

Paul

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rob Berendt
Sent: Friday, February 02, 2018 4:39 PM
To: Midrange Systems Technical Discussion
Subject: Re: Order of output for QUSLJOB API

I find this a spiffy way to sort
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/QSYS2.JOB_INFO%20UDTF

or
http://ibm.biz/DB2foriServices
QSYS2.JOB_INFO()

See also:
IBM i Access Client Solutions
Run SQL Scripts
Edit, Insert from Examples
IBM i Services
Work Management


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com<http://www.dekko.com/>





From: "Steinmetz, Paul" <PSteinmetz@xxxxxxxxxx<mailto:PSteinmetz@xxxxxxxxxx>>
To: "'Midrange Systems Technical Discussion'"
<midrange-l@xxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxx>>
Date: 02/02/2018 04:30 PM
Subject: Order of output for QUSLJOB API
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxx>>



I'm reviewing the order of output for a CVTJOB command (TAATOOLS) that
uses the QUSLJOB API.
It "appears" the order is by job#, which is not necessary newest to
oldest.

In my example, on a V7R1 system, oldest, newest, 2nd oldest

PENCOR05 180201 105329 S001SREVT1 CPAROBOT 321739 (oldest)
PENCOR05 180201 105329 S001SREVT1 CPAROBOT 688140 (newest)
PENCOR05 180201 105329 S001SREVT1 CPAROBOT 984105 (2nd
oldest)

Comparing to Output form WRKJOB, order is newest to oldest.

S001SREVT1 CPAROBOT 688140 BATCH OUTQ 01/31/18
S001SREVT1 CPAROBOT 984105 BATCH OUTQ 12/31/17
S001SREVT1 CPAROBOT 321739 BATCH OUTQ 11/30/17

Does anyone know the order output for the QUSLJOB API?
And if so, can the order output be controlled?

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/apis/qusljob.htm



Thank You
_____
Paul Steinmetz
IBM i Systems Administrator

Pencor Services, Inc.
462 Delaware Ave
Palmerton Pa 18071

610-826-9117 work
610-826-9188 fax
610-349-0913 cell
610-377-6012 home

psteinmetz@xxxxxxxxxx<mailto:psteinmetz@xxxxxxxxxx>
http://www.pencor.com/



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx> for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.