Informing the IBM Community

A screen a story – Pre-power down system exit point?


The Exit point functionality available within IBM i, is what I would call a hidden gem. If we just look at the Pre-power down Exit Point my guess is you will agree. In my article of last month the Start-up program was handled. Now it is time to look at the Pre-power down program.

The documentation for this Exit Point can be found on the regular IBM i documentation website: Power Down System Exit Programs.

When searching the Internet for documentation you may also find other documents IBM wrote dealing with this subject PWRDWNSYS and ENDSBS *ALL Exit Programs.

Although this document was last updated on 18 December 2019 it only mentions IBM i 7.1, for that reason my advice is to ignore it. The document does contain some recommendations for including commands in your Pre-power down exit point program.

I assume that you have never bothered about running the command “ENDHOSTSVR SERVER(*ALL) ENDACTCNN(*DATABASE *FILE)”, I never have.

Stopping Websphere is also recommended. What about that? Well for sure it does no harm if you stop Websphere in an orderly manner, does it?

Before diving deeper into what to do and what not to do in this Exit Point Program, we first need to know when it is executed. 

If you register a program under format PWRD0100 this results in your program being called when entering the commands PWRDWNSYS and ENDSYS.

The Exit Point program has two Formats:

  • PWRD0100 which does not require any parameters
  • PWRD0200 which does requires parameters, one of which contains the format of the exit information.
    There are two flavours of PDPF0100 & PDPF0200. The first format specifies a check action request, the other an execute or cancel request. For more details use the link above to the IBM i documentation website.

As we have implemented PWRD0100, we are running a program which does not require parameters.

Our program is quite simple and calls the same program as the one in the Start-up program:

/*    Execute                                               */
              chgjob  log(4 00 *seclvl) logclpgm(*Yes)
              call    pgm(pr_str_end/strend_mng) parm('*STOP')
              monmsg  msgid(cpf0000)

/*    Normal End of program                                 */              

Only this time with the parameter *STOP

This program processes the same file as the one we used for the Start-up program. Only this time in reverse order. The content of the file we use does contain a stop command as shown below:

The file does contain a sequence number to be used when running the program with the *STOP parameter. Below the Index we use when doing that:

The reason for having a stop command is to control the ending of some ISV vendor’s applications, for example M3. The stopping of some applications is controlled by kicking off another job. This results in the stop task running the stop command expecting the application to be stopped almost immediately.

This would result in the pre-power down exit point program to be ready within a second and running the power down of the system while M3 was still stopping.

In order to solve this, the call to the “WAIT” program is done.

This program ends as soon as a data area “CONTINUE” exists in the library QRPLOBJ. So as soon as M3 is stopped that data area is created. This can be after a simple “DLYJOB” command, giving M3 enough time to stop or better still a program checking if there are still M3 jobs active.

There is also an Exit Point defined which does include the ENDSBS command Pre-restricted State Exit Programs (EWCPRSEP). This Exit Point has two formats which can be used:

  • PRSE0100 – Pre restricted state check
  • PRSE0200      Pre restricted state execute or cancel

I think this Exit Point a part of the hidden gem – Exit point functionality. 

I will give this Exit point a try and see if it allows us to get rid of the wait program.

Up to now we have not yet used this Exit Point, but when writing articles you nearly always learn something new. I do hope the same is valid for you reading them.                                

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.


Leave a Reply

Your email address will not be published. Required fields are marked *