08/12/08 Creating a single startup program for multiple systems

This tip is particularly useful if you are using an iSeries high availability product for disaster recovery purposes. The idea is to create one startup program that will work on two or more systems -- one source code for multiple systems.

Use a data area to define the system's role in the iSeries replication environment. For example, the production system data area would have a setting of SRC and the backup system the setting of TGT. You may also want to define a value of SWT when the system is in the process of switching.

When a system is the production system, you want production subsystems/processes to start when the system is IPL'd. When a system is the backup system, you likely do not want these subsystems/processes to be started when the backup system is IPL'd. Of course, there will be some things you will want to start on all systems regardless of its role.

In the startup program, retrieve the pre-defined data area and then process accordingly.

Example source code for the startup program:


PGM

DCL VAR(&SYSROLE) TYPE(*CHAR) LEN(3)
RTVDTAARA DTAARA(YOURLIB/SYSROLE (1 3)) RTNVAR(&RTNVAL)
MONMSG MSGID(CPF1015) EXEC(CHGVAR VAR(&RTNVAL) +
VALUE('UNK'))

SELECT
WHEN COND(&SYSROLE = 'SRC') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS THE SOURCE */

ENDDO

WHEN COND(&SYSROLE = 'TGT') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS THE TARGET */

ENDDO

WHEN COND(&SYSROLE = 'SWT') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS MID SWITCH */

ENDDO
ENDSELECT

/* INSERT COMMANDS TO RUN REGARDLESS OF SYSTEM ROLE */

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. All other brands are property of their respective registered owners.

No comments: