Question & Answer
Question
Is there a way to automate the deletion (DLTJRNRCV) of journal receivers on the system? Does IBM have any sample code that demonstrates how to do this?
Cause
The following article provides some good information on how to automate journal receiver deletion. The sample code, however, is flawed and it does not work over month/year boundaries.
[ ] Automate journal receiver (*JRNRCV) deletion
==> https://www.ibm.com/support/pages/automate-journal-receiver-jrnrcv-deletion
The above page ultimately links to:
==> https://www.ibm.com/developerworks/ibmi/library/i-automate-journal-receiver-deletion/index.html
Development had provided another CLLE sample, which is listed below. Note - the logic to delete the
receiver is at the very end of the program and uses 5 days as the criteria for deletion. The criteria
may be updated based on your needs.
Source can be found in QMGTOOLS's QMGDBSQL source physical files (as of late 2020)
Answer
PROVIDED AS-IS Support cannot assist with modifying and or troubleshooting this code.
/*************************************************************************/
/* */
/* Sample exit program to delay deleting a journal receiver */
/* */
/* This sample will compare the number of days between detach date */
/* and current date in days to determine if receiver is eligible for */
/* delete. */
/* */
/* Provided AS-IS Support cannot assist with modifying and or */
/* troubleshooting */
/* */
/* QMGTOOLS/QMGDBSQL.DLTJRNRCV2 */
/* */
/*************************************************************************/
DCL VAR(&OUTPUT) TYPE(*CHAR) LEN(5)
DCL VAR(&INPUT1) TYPE(*CHAR) LEN(200)
DCL VAR(&DTCHSYS) TYPE(*CHAR) STG(*DEFINED) +
LEN(6) DEFVAR(&INPUT1 81)
DCL VAR(&DTCHINT) TYPE(*INT) LEN(4)
DCL VAR(&JRNNAME) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&INPUT1 53)
DCL VAR(&JRNLIB) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&INPUT1 63)
DCL VAR(&RTVCURDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&CURDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&CURINT) TYPE(*INT) LEN(4)
DCL VAR(&OUTPUT1) TYPE(*CHAR) LEN(5)
DCL VAR(&OUTPUTLGTH) TYPE(*INT) STG(*DEFINED) +
LEN(4) DEFVAR(&OUTPUT)
DCL VAR(&OUTPUTSTS) TYPE(*CHAR) STG(*DEFINED) +
LEN(1) DEFVAR(&OUTPUT 5)
DCL VAR(&PICSTR) TYPE(*CHAR) LEN(6) VALUE('YYMMDD')
/* ADD CODE IN HERE IF YOU WANT TO CHECK FOR A JRN NAME AND LIB */
/* AGAINST A LIST OF JRNS TO BE RETAINED. &JRNNAME AND &JRNLIB */
/* HAVE BEEN PASSED IN BY THE EXIT POINT */
/******************************************************************/
/* ALLOW THE RECEIVER TO BE DELETED */
CHGVAR VAR(&OUTPUTLGTH) VALUE(5)
CHGVAR VAR(&OUTPUTSTS) VALUE('1')
CVTDAT DATE(&RTVCURDATE) TOVAR(&CURDATE) +
FROMFMT(*JOB) TOFMT(*YMD) TOSEP(*NONE)
CALLPRC PRC(CEEDAYS) PARM(&CURDATE &PICSTR &CURINT)
/*******************************************************************/
/* IF CURRENT - DETACH DAY IS NOT > 5 THEN DISALLOW THE DETACH */
/*******************************************************************/
CMDLBL(END))
ELSE CMD(CHGVAR VAR(&OUTPUTSTS) VALUE('0'))
ENDPGM
Related Information
Was this topic helpful?
Document Information
Modified date:
05 October 2020
UID
ibm16342913