Implementing a power-handling program

 

When an uninterruptible power supply is attached, you can use a power-handling program for a system.

This procedure assumes that QCTL is the controlling subsystem.

  1. Isolate the objects used by the power-handling program in their own library and secure them from other users because of the critical nature of a power-handling program.

    You can use the following command:

    CRTLIB LIB(UPSLIB) AUT(*EXCLUDE) CRTAUT(*EXCLUDE)

  2. Create a unique message queue and exclude its use from all other users and general system use because a power-handling program requires exclusive use of a message queue, 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)

    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. 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 cannot check for QCTL2 in QSYS or QGPL, and the startup program ends 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)

 

Parent topic:

Enabling a power-handling program to control system activity during a power interruption