You are here: DBG/400>DBG400 Web>ClDBG213CL (15 Jun 2016, MartinRowe)EditAttach
/* ************************************************************************** */
/* DBG213CL: End jobs with lock on specified object                           */
/* Copyright (C) 2007  Martin Rowe  <martin@dbg400.net>                       */
/*                                                                            */
/* This program is free software; you can redistribute it and/or modify       */
/* it under the terms of the GNU General Public License as published by       */
/* the Free Software Foundation; either version 2 of the License, or          */
/* (at your option) any later version.                                        */
/*                                                                            */
/* This program is distributed in the hope that it will be useful,            */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of             */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              */
/* GNU General Public License for more details.                               */
/*                                                                            */
/* You should have received a copy of the GNU General Public License          */
/* along with this program; if not, write to the Free Software                */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307   USA */
/* ************************************************************************** */
PGM PARM(&QUALOBJ &OBJTYPE)
  DCL        VAR(&QUALOBJ) TYPE(*CHAR) LEN(20)
  DCL        VAR(&OBJECT) TYPE(*CHAR) LEN(10)
  DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
  DCL        VAR(&RTNLIB) TYPE(*CHAR) LEN(10)
  DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
  DCL        VAR(&OBJTYPE) TYPE(*CHAR) LEN(7)
  DCL        VAR(&OBJATR) TYPE(*CHAR) LEN(10)
  DCL        VAR(&MBR) TYPE(*CHAR) LEN(10) VALUE('*NONE')
  DCL        VAR(&LOCKS) TYPE(*DEC) LEN(10 0)
  DCL        VAR(&LOCKCOUNT) TYPE(*CHAR) LEN(10)
  DCL        VAR(&ERRORS) TYPE(*DEC) LEN(10 0)
  DCL        VAR(&ERRORCOUNT) TYPE(*CHAR) LEN(10)
/* ************************************************************************** */
/* GLOBAL MESSAGE MONITOR                                                     */
/* ************************************************************************** */
  MONMSG     MSGID(CPF0000 RPG0000 QRG0000 RSF0000 +
               MCH0000) EXEC(GOTO CMDLBL(##ERROR))
  GOTO       CMDLBL(##NOERROR)
##ERROR:
  MOVDIAGMSG
  MONMSG     MSGID(CPF0000)
  RSNESCMSG
  MONMSG     MSGID(CPF0000)
  RETURN
##NOERROR:
/* ************************************************************************** */
/* MAINLINE:                                                                  */
/* ************************************************************************** */
  CHGVAR     VAR(&OBJECT) VALUE(%SST(&QUALOBJ 1 10))
  CHGVAR     VAR(&LIBRARY) VALUE(%SST(&QUALOBJ 11 10))
  RTVOBJD    OBJ(&LIBRARY/&OBJECT) OBJTYPE(&OBJTYPE) +
               RTNLIB(&RTNLIB) OBJATR(&OBJATR)
  IF         COND(%SST(&OBJATR 1 2) = 'PF') THEN(CHGVAR +
               VAR(&MBR) VALUE('*ALL'))
  IF         COND(%SST(&OBJATR 1 2) = 'LF') THEN(CHGVAR +
               VAR(&MBR) VALUE('*ALL'))
  IF         COND(&LIBRARY *EQ '*LIBL') THEN(DO)
    CHGVAR     VAR(&LIBRARY) VALUE(&RTNLIB)
  ENDDO
  ENDJOBLCK  OBJ(&LIBRARY/&OBJECT) OBJTYPE(&OBJTYPE) +
               MBR(&MBR) OPTION(*IMMED) LOCKS(&LOCKS) +
               ERRORS(&ERRORS)
  CHGVAR     VAR(&ERRORCOUNT) VALUE(&ERRORS)
  CHGVAR     VAR(&LOCKCOUNT) VALUE(&LOCKS)
  CHGVAR     VAR(&MSGDTA) VALUE(&LOCKCOUNT *BCAT 'locks +
               ended.' *BCAT &ERRORCOUNT *BCAT 'errors +
               detected.')
  SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
               MSGTYPE(*COMP)
ENDPGM:
  RETURN
ENDPGM
Topic revision: r1 - 15 Jun 2016 - 14:34:44 - MartinRowe
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback