× 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.



IBM has, for ages, provided a sample program to do this.
http://www-01.ibm.com/support/docview.wss?uid=nas192c8e3c06622aad686256d4400
70d2ae


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Wednesday, February 20, 2013 4:22 AM
To: Midrange Systems Technical Discussion
Subject: Re: Spool files

Hi John

You might not want to use a CL program, at least not ONLY a CL program.
Somewhere you'll need to process either a file or a user space.

Now in recent OS versions (at least V5R4) you can work with pointers in CL
and process a user space just fine.

You want to use the QUSLSPL API - list spooled files - you can specify a
certain OUTQ, then walk through the entries, then check the create date and
delete with DLTSPLF.

A Google of QUSLSPL reveals several example code sites -

http://www.itjungle.com/fhg/fhg080305-story01.html
http://www.iprodeveloper.com/print/rpgprogramming/apis-by-example-list-spool
ed-files-quslspl-api-61150
(links to other examples)

In CL you can define a variable that is like a data structure, with *DEFINED
and variables based on a pointer, with *BASED. With these and integer
variable types, you can read the user space easily and use the information
to decide which ones to delete.

HTH
Vern

On 2/20/2013 4:32 AM, John Mathew wrote:

Hi,

How to delete the spool files which are older than 7 days from a
particular queue.
Can some one please send me some sample CL program code which would help
me to achieve this.

Thanks in advance.

John







________________________________
From: CRPence <CRPbottle@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Sent: Tuesday, 19 February 2013 10:46 PM
Subject: Re: MONMSG issues

On 19 Feb 2013 13:01, ADriver@xxxxxxxxxxxx wrote:
I'm running into an issue with a program. Amongst other things I'm
trying to GRTOBJAUT to a bunch commands and it keeps dumping with
CPF2204 (User profile doesn't exist).
The dump is presumably for CPA0701 [or the CLLE equivalent] due to
an unmonitored exception message. The CPF2204 is a diagnostic
message, and that will not be the origin for the /dumping/ for the
error; i.e. the diagnostic is merely /logged/ to the program message
queue.

I want this to be a generic program I run on different systems, and
there will be some profiles that exist on some but not others.
Apparently then the Grant Object Authority request will not be
built dynamically for the system on which the request will be run, but
hard-coded and compiled static into a CLP or CLLE. In that case just
monitor for the exception, and in response to that error, as the coded
handler, verify that the only diagnostic messages are the CPF2204 for
user profile names that are acceptable to be ignored.

I'd rather not code IF this system DO... or IF EXIST ... for each
statement if I can avoid it.
Even if not coded fully dynamic, a list of only existing user
profiles as obtained from a list [effective array] could be specified
as elements on the USER parameter; replacing any missing *USRPRF
object with a mandatory user profile name. So for example if the list
of users to assign authority is (APPLUSER OPTIONAL) [coded as USER(&U1
&U2)] where user APPLUSER is mandatory and user OPTIONAL is optional
and does not exist, then the request coded as GRTOBJAUT USER(&U1 &U2)
could be modified so &U2 is changed from 'OPTIONAL' to 'APPLUSER' so
the request resolves to the redundant yet acceptable request:
GRTOBJAUT USER(APPLUSER APPLUSER). Another option is to ignore the
CPF2204 for optional users... described in code later below.

I tried MONMSG CPF2204 after the GRTOBJAUT statements in the CL, but
it keeps dumping on this message.
As described earlier, the CPF2204 is not the exception, so the
MONMSG
CPF2204 is not doing anything. More specifically, the exception is
CPF2227 but because that is not being monitored, the CL default
exception handler is presumably being called to send an inquiry
message which is replied to with 'D'=Dump in response.

Looking at the help text for GRTOBJAUT (and TAATOOLS DSPMONMSG),
CPF2204 is not listed as one of the messages that can be monitored
for with GRTOBJAUT. There are other MONMSG statements in this CL that
do work, although the one thing that stands out is that CPF2204 is a
DIAG message, not and ESC. Am I correct in assuming that's why the
MONMSG doesn't work?
Correct. The CPF2204 can not be monitored because that message is
not one of the messages issued as an exception message; thus why the
message is not listed in the help text for the command.

The following algorithm should suffice for ignoring some cases of
CPF2204 for a chosen user profile name, though easily expanded to
ignore multiple user profiles; noting effectively the same is done for
one [or more if expanded] mandatory user profiles that must not be
ignored:

[code]

dcl &mk *char 04
dcl &mi *char 07
dcl &md *char 100/* cpf2204 &1 *char 10 UsrPrf name */
/* the length 100 covers most other possible diags */
dcl &up *char 10
dcl &xk *char 04 /* cpf2227 exception msg key; for resend */
?grtobjaut (mylib/uln*) *file aut(*all) ??user(bogus appUser myUsr)
monmsg cpf2227 exec(do)
rcvmsg pgmq(*same) msgq(*pgmq) msgtype(*excp) rmv(*no) +
keyvar(&xk)
Next2204:
rcvmsg pgmq(*same) msgq(*pgmq) msgtype(*diag) rmv(*no) +
keyvar(&mk) msgdta(&md) msgid(&mi)
if cond(&mi *eq ' ') then(goto NoMoreDiag)
if cond(&mi *eq 'CPF2204') then(do)
chgvar &up %sst(&md 1 10)
/* if &up in list_of_mandatory then bad_thing: */
if (&up *eq 'APPUSER ') then(do)
/* mandatory user can not be ignored; send diag as escape */
sndpgmmsg *n cpf2204 qcpfmsg tomsgq(*topgmq) topgmq(*prv (*)) +
msgdta(&md) msgtype(*escape)
enddo /* escape message terminates this pgm */
/* if &up in list_of_optional then(do) */
if (&up *eq 'BOGUS ') then(do)
/* remove any cases that are ignored */
rmvmsg pgmq(*same (*)) msgq(*pgmq) msgkey(&mk) clear(*bykey)
enddo
goto Next2204
enddo
else do /* only cpf2204 is processed by this pgm */
/* leave whatever is the unprocessed diag(s) */
/* resignal CPF2227 exception using the saved key */
call qmhrsnem (&xk x'0000000000000000')
enddo
NoMoreDiag:
enddo /* end-monmsg cpf2227 */

[/code]


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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.