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


  • Subject: RE: ending selective sessions in batch
  • From: Scott Mildenberger <Smildenber@xxxxxxxxxxxx>
  • Date: Thu, 22 Jun 2000 12:37:04 -0600

Here is a program that can send a message to users with a lock on a file or
it will cancel their jobs.  There is a CL program and a PF.  Note that this
works by copying a *PRINT spool file to a database file so it can be release
dependent if the format of the spool file changes.  We are on V4R3, I do
know the format has changed on me at some time in the past.

Scott Mildenberger

PGM  PARM(&OBJQUAL &TYPE &MEMBER &ACTION &MESSAGE)

    DCL VAR(&OBJQUAL) TYPE(*CHAR) LEN(20)
    DCL VAR(&OBJECT)  TYPE(*CHAR) LEN(10)
    DCL VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
    DCL VAR(&MEMBER)  TYPE(*CHAR) LEN(10)
    DCL VAR(&TYPE)    TYPE(*CHAR) LEN(10)
    DCL VAR(&ACTION)  TYPE(*CHAR) LEN(7)
    DCL VAR(&MESSAGE) TYPE(*CHAR) LEN(512)

    DCLF FILE(LCKPF009)


/*  SPLIT OUT THE OBJECT AND LIBRARY NAMES */

    CHGVAR VAR(&OBJECT)  VALUE(%SST(&OBJQUAL  1 10))
    CHGVAR VAR(&LIBRARY) VALUE(%SST(&OBJQUAL 11 10))

/*  OVERRIDE THE PRINT FILE, SO IT DOES NOT PRINT */

             OVRPRTF    FILE(QPDSPOLK) OUTQ(SCOTTM) HOLD(*YES)

/*  CREATE THE SPOOL FILE WITH USER INFORMATION */

    WRKOBJLCK OBJ(&LIBRARY/&OBJECT) OBJTYPE(&TYPE) MBR(&MEMBER) +
        OUTPUT(*PRINT)

/*  SEND AN ESCAPE MESSAGE IF ERROR OCCURS LOCATION OBJECT */

    MONMSG MSGID(CPF0000) EXEC(SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
        MSGDTA('UNABLE TO LOCATE REQUESTED OBJECT') MSGTYPE(*ESCAPE))

/*  CREATE FILE TO HOLD USER INFORMATION FROM SPOOL FILE */
/*      IN QTEMP AND PERFORM OVERRIDE */

    CRTDUPOBJ OBJ(LCKPF009) FROMLIB(STARR) OBJTYPE(*FILE) +
        TOLIB(QTEMP) NEWOBJ(&OBJECT)
    MONMSG     MSGID(CPF2130)

    OVRDBF FILE(LCKPF009) TOFILE(QTEMP/&OBJECT)

/*  COPY SPOOL FILE INFORMATION INTO DATABASE FILE */

    CPYSPLF FILE(QPDSPOLK) TOFILE(QTEMP/&OBJECT) SPLNBR(*LAST)

/*  DELETE SPOOL FILE FROM OUTQ */

 /* DLTSPLF FILE(QPDSPOLK) SPLNBR(*LAST) */

/*******************************************************************/
/*  MESSAGE IS TO BE SENT TO THE USER ACCESSING THE OBJECT */
/*******************************************************************/

           IF COND(&ACTION *EQ '*INFORM') THEN(DO)

INFO_READ: RCVF RCDFMT(RLCK009)

           MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EXIT))

           IF COND(&WRKSTN *NE '          ' & &USER *NE +
               '          ' & &NUMBER *GT '000000') THEN(DO)
               IF COND(&STATUS = 'HELD') THEN(DO)

/*  REPLACED SNDBRKMSG WITH NOTIFY_USR SO ALL USERS SESSIONS GET */
/*      THE MESSAGE */
/*         SNDBRKMSG MSG(&MESSAGE) TOMSGQ(&WRKSTN) */
           CALL PGM(NOTIFY_USR) PARM(&USER &MESSAGE)
           MONMSG CPF0000

           ENDDO
           ENDDO

           GOTO INFO_READ

           ENDDO

/*******************************************************************/
/*  CANCEL THE USER ACCESSING THE OBJECT */
/*******************************************************************/

           IF COND(&ACTION *EQ '*CANCEL') THEN(DO)

CNCL_READ: RCVF RCDFMT(RLCK009)
           MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EXIT))

           IF COND(&WRKSTN *NE '          ' & &USER *NE +
               '          ' & &NUMBER *GT '000000') THEN(DO)

           ENDJOB JOB(&NUMBER/&USER/&WRKSTN) OPTION(*IMMED) LOGLMT(0)
           MONMSG CPF0000

           ENDDO

           GOTO CNCL_READ

           ENDDO

/*  DELETE THE DATABASE FILE FROM QTEMP */

EXIT:      DLTF FILE(QTEMP/&OBJECT)


ENDPGM


Physical File:

     A          R RLCK009
     A            SKIP1         14
     A            WRKSTN        10
     A            SKIP2          1
     A            USER          10
     A            SKIP3          1
     A            NUMBER         6
     A            SKIP4         20
     A            STATUS         4
     A            SKIP5         66





> -----Original Message-----
> From: Dean Booth [SMTP:dbooth@injectronics.com]
> Sent: Thursday, June 22, 2000 11:28 AM
> To:   MIDRANGE-L@midrange.com
> Subject:      ending selective sessions in batch
> 
> Greetings on the longest day of the year (for us northern hemispherians,
> anyway).  But lucky me, when my overnight batch jobs don't run, every
> day seems like the longest day of the year.
> 
> My EDI software has a job that must run every night.  It won't if
> certain users are on and tying up particular files.  This became a
> problem when we hired a 3rd shift shipper last week.  I can't end my
> interactive subsystem because I have other users doing other things (I'm
> using QBASE instead of QINTER, but I'd switch if it would solve the
> problem).
> 
> All I have is the user name.  This is a TCP/IP user, so I won't know the
> device name.  If I could direct the output of WRKUSRJOB to a file maybe
> I could turn the data into ENDJOB commands.
> 
> How can I kill sessions in batch when all I know is their user name?
> 
> thanks, Dean
> 
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
> MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 thread ...


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.