2/28/08 Replicating the active OS/400 History Log

If you use a high availability solution and you need to do an emergency switchover, the active history log that is contained in system storage (accessed via DSPLOG) can be replicated to a backup system in order for the history log to be reviewed during an unplanned switch. Using the following CL code*, you can actively poll this storage and store it in an OS/400 DB2 table.

DMPLOG: PGM
DCL VAR(&QTIME) TYPE(*CHAR) LEN(6)
DCL VAR(&QDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&STIME) TYPE(*CHAR) LEN(6)
DCL VAR(&SDATE) TYPE(*CHAR) LEN(6)

CRTPF FILE(QTEMPDB/QHSTLOG) RCDLEN(220)
OVRDBF FILE(QPDSPLOG) TOFILE(QTEMPDB/QHSTLOG) +
LVLCHK(*NO)

DSPLOG OUTPUT(*PRINT)

RTVSYSVAL SYSVAL(QDATE) RTNVAR(&SDATE)
RTVSYSVAL SYSVAL(QTIME) RTNVAR(&STIME)

LOOP: DLYJOB DLY(15)

RTVSYSVAL SYSVAL(QDATE) RTNVAR(&QDATE)
RTVSYSVAL SYSVAL(QTIME) RTNVAR(&QTIME)

DSPLOG PERIOD((&STIME &SDATE) (&QTIME &QDATE)) OUTPUT(*PRINT)
MONMSG MSGID(CPF2447)

CHGVAR VAR(&SDATE) VALUE(&QDATE)
CHGVAR VAR(&STIME) VALUE(&QTIME)

GOTO CMDLBL(LOOP)

ENDPGM



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.

No comments: