RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Controlling PWRDWNSYS Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   

I wanted to Control the way of PWRDWNSYS command processing, Ex. Getting a confirmation and sending a message to QSECOFR and get his response to the message.


Bellow are the steps which I have done


1. Changing the PWRDWNSYS command defaults

CHGCMDDFT CMD(PWRDWNSYS) NEWDFT('CONFIRM(*YES)')

2. Create environment variable

GO CMDENVVAR

Use option 1 to create a new environment variable as QIBM_PWRDWNSYS_CONFIRM and give the default value as *YES

3. Add the exit program to QIBM_QWC_PWRDWNSYS

ADDEXITPGM EXITPNT(QIBM_QWC_PWRDWNSYS) 
   FORMAT(PWRD0100) PGMNBR(1) 
   PGM(SDBUTILS/PWREXIT) TEXT('Power Down System Confirmation')                            

Bellow is my CL program

             /* ----------------------------------------------------------- */
             /*                                                             */
             /* Application : Utilities                                     */
             /* Module      : PWRDWNSYS Exit                                */
             /* Title       : PWRDWNSYS Exit Program                        */
             /* Description : This program will ask a confirmation from     */
             /*               QSECOFR to get process the command            */
             /*                                                             */
             /* Author     : Chamara Withanachchi                           */
             /* Version    : V 1.0.0                                        */
             /* Date       : 2010/09/15                                     */
             /*                                                             */
             /* ----------------------------------------------------------- */
             /* Exit Point : QIBM_QWC_PWRDWNSYS                             */
             /* Format     : PWRD0100                                       */
             /* ----------------------------------------------------------- */

             PGM

             DCL        VAR(&MSGRPY) TYPE(*CHAR) STG(*AUTO) LEN(1)
             DCL        VAR(&JOBNM) TYPE(*CHAR) STG(*AUTO) LEN(10)
             DCL        VAR(&USER) TYPE(*CHAR) STG(*AUTO) LEN(10)

             RTVJOBA    JOB(&JOBNM) USER(&USER)
             SNDUSRMSG  MSG('PWRDWNSYS issued by ' *CAT &USER *CAT 'Type G +
                          to continue') VALUES(G) TOUSR(QSYSOPR) +
                          MSGRPY(&MSGRPY)

             ENDPGM 

safe PWRDWNSYS

Next>