|
I had several requests for the code so decided to simply post on the site for future reference. Please note code is not warranted in any way and only represents what I had a need for. Here's the code I use. I do have an older version that is RPGLE without the SQL. I converted it to SQL in order to avoid a level check in the event of Mapics changes to the JOBACT file. The service program may be over kill but I anticipated using this routine again. Hopefully this is of some assistance. I still haven't figured out a way to determine if Mapics Browser jobs are still active. If anyone knows how to do this I'd like to know the secret. FIXABENDCL CLP Runs twice daily on the job schedule PGM ADDLIBLE LIB(CMALIB) MONMSG MSGID(CPF2103) ADDLIBLE LIB(AMFLIB) MONMSG MSGID(CPF2103) ADDLIBLE LIB(AMALIB) MONMSG MSGID(CPF2103) CALL PGM(FIXABENDSR) ENDPGM FIXABENDSR SQLRPGLE H BNDDIR('CMALIB/CMABNDDIR') DFTACTGRP(*NO) ACTGRP(*CALLER) *--------------------------------------------------------------------- * Program: FIXABENDSR - Remove ABEND records for inactive jobs * Programmer: Lisa Thomas Date: October 10, 2000 *--------------------------------------------------------------------- * Return Job Found Flag D gJobFound PR N D Name 11 Const D User 11 Const D Number 11 Const D User S 10 D Number S 6 D Ref S 10 D Queue S 10 D Sequence S 3P 0 D Session S 1 D f@JobFound s n C/EXEC SQL DECLARE DD CURSOR FOR C+ SELECT JAUSR, JAJNR, JBREF, JQUE1, SESSN, JAJIS C+ FROM JOBACT C+ WHERE JAUSR <> 'QUSER' C+ and JQUE1 = ' ' C/END-EXEC C/EXEC SQL OPEN DD C/END-EXEC C/EXEC SQL FETCH DD C+ INTO :User, :Number, :Ref, :Queue, :Session, C+ :Sequence C/END-EXEC C dow SQLCod = 0000 C eval f@JobFound = gJobFound(Ref:User:Number) C if NOT f@JobFound C/EXEC SQL C+ DELETE from JOBACT C+ WHERE JBREF = :Ref C+ and SESSN = :Session C+ and JAJIS = :Sequence C/END-EXEC C endif C/EXEC SQL FETCH DD C+ INTO :User, :Number, :Ref, :Queue, :Session, C+ :Sequence C/END-EXEC C enddo C/EXEC SQL CLOSE DD C/END-EXEC C eval *inLR = *on C return Binding directory is used to access service program gJobFound. gJOBFOUND RPGLE * PROCEDURE: gJobFound - Returns a '1' if Job Found * DESCRIPTION: This procedure checks to see if a job is found. * PARMS: Output f@JobFound - Job Found flag * Example: C* eval f@JobFound = gJobFound(Name:User:Nbr) * Change Log: * LAT 10/10/2000 New Program H NOMAIN * Return Job Found Flag D gJobFound PR 1 D Name 11 Const D User 11 Const D Number 11 Const * Prototypes P gJobFound B EXPORT D gJobFound PI 1 D Name 11 Const D User 11 Const D Number 11 Const * Call MAPICS pgm to get Job Status D JobStatus PR EXTPGM('AXZDA') D p@Axdas 64 Const D p#Axdas DS D p@Action 1 10 D p@Name 11 20 D p@User 21 30 D p@Nbr 31 36 D p@StsRequested 37 46 D p@JobStatus 47 56 D p@MsgId 57 63 D p@ActiveStatus 64 64 D f@Found S 1 C eval p@Action = '*GET ' C eval p@Name = Name C eval p@User = User C eval p@Nbr = Number C eval p@StsRequested = '*ACTIVE ' C eval p@JobStatus = ' ' C eval p@Msgid = ' ' C eval p@ActiveStatus = ' ' C CALLP JobStatus(p#Axdas) C return p@ActiveStatus C *PSSR begsr C RETURN *blanks C endsr P gJobFound E Lisa A. Thomas HAYSSEN a Barry-Wehmiller Company
As an Amazon Associate we earn from qualifying purchases.
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.