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 ON-EXIT is housekeeping for sub-procedures 1

Learning Something New

“I am always ready to learn although I do not always like being taught.” — Winston Churchill

All courses…
  • All courses…
  • Topics
  • Modernization
  • IBM i | AS400 | iSeries
  • WordPress
  • Access restrictions
  • MEMBERS ONLY
  • Free For All

56 Lessons – Easy

Not started

RPG Programming for Beginners.
Aimed at programmers that have (a) no knowledge of the RPG ILE language or (b) knowledge of older RPG versions and want to upgrade to modern ILE Web powerful RPGLE.

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

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

>