RPG ON-EXIT is housekeeping for sub-procedures

  • Home
  • /
  • Blog
  • /
  • RPG ON-EXIT is housekeeping for sub-procedures

May 15, 2017

RPG ON-EXIT is housekeeping for sub-procedures

By NickLitten

May 15, 2017

IBM i, ON-EXIT, ONEXIT, RPG, RPGLE

Nice Subprocedures with RPG ON-EXIT

IBM is adding all kinds of new tweaks to RPG with each new release of IBM i. RPG ON-EXIT is a great example of a neat tweak to the RPG programming language.

Last year, IBM quietly introduced a rather neat new function called “ON-EXIT” to our sub procedures in RPG.

RPG ON-EXIT is a nice structured way of storing procedure house keeping and/or error catching.

ON-EXIT is available if you are running IBM i V7.2 or higher:

The ILE RPG compiler is enhanced with a new ON-EXIT opcode which begins the “ON-EXIT” section containing code to be run whenever a procedure ends, either normally or abnormally.

So, if you have code that you always want to run at the end of a procedure you can just put that in the ON-EXIT section.

So how does ON-EXIT work?

It works like this

RPG Programming for Beginners

RPG is the well known programming language on the IBM i platform. Earlier versions of RPG ran on the old AS/400 and iSeries machines in decades gone by… the beauty of RPG is that it is fully backwards compatible. But, over the years RPG has evolved massively!

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>