|
You have several options available to you. If you need to use RPG (say for
writing an audit report) then I would suggest using the QUSLJOB and the
QUSLSPL APIs to list the eligible jobs and their associated spooled files.
If a quick CL program is sufficient, try this as a start. Do a WRKJOB with
the generic job name and receive the diagnostic messages that tell what jobs
are duplicates. You'll need to substitute ENDJOB for DSPJOB, but I think it
shows the technique pretty well.
PGM &JobName
DCL &JobName *Char 10
DCL &JobNbr *Char 6
DCL &JobUsr *Char 10
DCL &DupFlag *Char 1
DCL &MsgID *CHAR 7
DCL &MsgDta *CHAR 100
DCL &MsgF *CHAR 10
DCL &MsgFlib *CHAR 10
CHGVAR &DupFlag 'N'
WRKJOB JOB(&JobName) OUTPUT(*PRINT) DUPJOBOPT(*MSG)
MONMSG CPF1069 EXEC(CHGVAR &DupFlag 'Y') /* End of duplicate jobs */
/* Process the duplicate jobs */
If (&DupFlag *EQ 'Y') (DO)
ReadDupJob:
RCVMSG MSGTYPE(*DIAG) +
MSGDTA(&MsgDta) +
MSGID(&MsgID) +
MSGF(&MsgF) +
MSGFLIB(&MsgFlib)
IF ((&MsgID *EQ ' ') *OR +
(&MsgID *NE 'CPF0906')) GOTO Finished
CHGVAR &JobUsr %SST(&MsgDta 11 10)
CHGVAR &JobNbr %SST(&MsgDta 21 06)
DSPJOB &JobNbr/&JobUsr/&JobName
GOTO ReadDupJob
ENDDO
/* Process the single job */
ELSE DO
DSPJOB &JobName
ENDDO
Finished:
ENDPGM
Buck Calabro
Aptis; Albany, NY
mailto:Buck.Calabro@aptissoftware.com
> -----Original Message-----
> From: Ajay Kumar
> Sent: Wednesday, September 08, 1999 4:09 PM
> To: RPG400-L@midrange.com
> Subject: How to kill multiple jobs with same name ?
>
> I want to kill multiple jobs with same name.
>
> Result of wrkjob (cd001abc3):
>
> Job User Number Type -----St
> CD001ABC3 QSYSOPR 539429 BATCH ACTIVE
> CD001ABC3 QSYSOPR 538746 BATCH ACTIVE
> CD001ABC3 QSYSOPR 535610 BATCH OUTQ
> CD001ABC3 QSYSOPR 534139 BATCH OUTQ
> CD001ABC3 QSYSOPR 533186 BATCH OUTQ
> CD001ABC3 QSYSOPR 532693 BATCH OUTQ
>
> My requirement is to kill all active jobs and delete the old spool files.
>
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.