07/08/08 Automatically monitor message queues for Save While Active checkpoints to execute other actions

The following describes two CL programs that can automate your save process so that prior to it starting a program is submitted to batch that creates a job to monitor the message queue for the checkpoint message. When the checkpoint message is received other processes can then be initiated.

Create a save program (i.e.:pgmlib/savepgm)


PGM
CLRMSGQ MSGQ(QUSRSYS/SWAMSGQ)
MONMSG MSGID(CPF2403) EXEC(CRTMSGQ MSGQ(QUSRSYS/SWAMSGQ))

/* INSERT THINGS TO DO PRIOR TO THE SAVE SO A CHECKPOINT CAN BE REACHED */
/* Example ENDSBS SBS(QINTER) OPTION(*IMMED) */

SBMJOB CMD(CALL PGM(yourlibrary/SWAMONMSGQ)) JOB(#SWAMONMSG)
SAVLIB LIB(libtosave) DEV(yourdevice) +

SAVACT(*SYNCLIB) SAVACTMSGQ(QUSRSYS/SWAMSGQ)
ENDPGM


Create a program to monitor for checkpoint (i.e.: pgmlib/SWAMONMSGQ) that will monitor the message queue for the save while active checkpoint message. When the message is processed, other actions can then be executed; i.e.: letting users back into an application or restarting another process. If multiple backups are running at one time, a message queue for each save should be used.

PGM

DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
LOOP: RCVMSG MSGQ(QUSRSYS/SWAMSGQ) MSGID(&MSGID)
IF COND(&MSGID *NE 'CPI3712') THEN(GOTO CMDLBL(LOOP))

/*INSERT THINGS TO DO AFTER THE CHECKPOINT MESSAGE IS REACHED HERE */
/* Example STRSBS SBSD(QINTER) */


ENDPGM

Submit or schedule the save program you created (pgmlib/savepgm)


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

No comments: