Implementing a power-handling program

Start of changeThis topic highlights what you need to do to use a power-handling program for a system when a full uninterruptible power supply is attached.End of change

Note: This example assumes that QCTL is the controlling subsystem.
  1. Because of the critical nature of a power-handling program, you should isolate the objects used by the power-handling program in their own library and secure them from other users, as follows:
    CRTLIB LIB(UPSLIB) AUT(*EXCLUDE) CRTAUT(*EXCLUDE)
  2. A power-handling program requires exclusive use of a message queue. For this reason, you should create a unique message queue and exclude its use from all other users and general system use, as follows:
    CRTMSGQ MSGQ(UPSLIB/UPSMSGQ) AUT(*EXCLUDE)
  3. Create the CL power-handling program and exclude its use from all other users, as follows:
    CRTCLPGM PGM(UPSLIB/UPSPGM) AUT(*EXCLUDE)
  4. Create the job description for the power-handling program you want started automatically whenever the controlling subsystem is started.
    CRTJOBD JOBD(UPSLIB/UPSJOBD) JOBQ(QSYS/QCTL2)
            JOBPTY(1) RQSDTA('CALL UPSLIB/UPSPGM')
            AUT(*EXCLUDE) USER(xxxxx)
    Note: You must provide a user profile to use the job description as an auto-start job.
  5. Create an alternative controlling subsystem description by making a copy of the current controlling subsystem description, as follows:
    CRTDUPOBJ OBJ(QCTL) FROMLIB(QSYS)
    OBJTYPE(*SBSD) TOLIB(QSYS)  NEWOBJ(QCTL2)
  6. Change your startup program to start all subsystems. You will need to include a check to see if system value QCTLSBSD is equal to QCTL2. See system value QSTRUPPGM for the name and library. If you do not change the startup program it will not check for QCTL2 in QSYS or QGPL and the startup program will end without starting the rest of your subsystems.
  7. Add the autostart job entry to the alternative controlling subsystem description, as follows:
    ADDAJE SBSD(QSYS/QCTL2) JOB(QSYS/QCTL2)
    JOBD(UPSLIB/UPSJOBD)
  8. Change the controlling subsystem system value to use the alternative controlling subsystem description, as follows:
    CHGSYSVAL SYSVAL(QCTLSBSD) VALUE('QCTL2')
  9. Change the system values to allow the program to handle a power outage, as follows:
    CHGSYSVAL SYSVAL(QUPSMSGQ) VALUE('UPSMSGQ UPSLIB')
    CHGSYSVAL SYSVAL(QUPSDLYTIM) VALUE(*NOMAX)
  10. Perform an IPL of the system to have the new controlling subsystem description take effect, as follows:
    PWRDWNSYS OPTION(*IMMED) RESTART(*YES)
Related tasks
Example: Power-handling CL program