APIs by Example: Exit Points, APIs, and Environment Variables

Control inquiry and reply messages in an interactive job—here’s how.

From release to release, IBM adds more exit points to the IBM i operating system. These exit points let you create exit programs that the system will call every time the event associated with the exit point occurs. Sometimes, however, you need to further granulate control of when to execute an exit program. One option is to employ environment variables at the individual job level. Environment variables provide a global setting to a job so that any program running in the job can access that setting, independent of parameters and call levels. Although system components create and use some environment variables, you can also define and add environment variables if you need to.

To add and retrieve environment variables for a job, you use the appropriate environment variables CL commands and APIs. In this article, I’ll show you how to do this by demonstrating both methods. (The articles listed in the “Find Out More” section below, provide additional details about environment variables and associated programming techniques.) For the exit points involved, I take advantage of the inquiry handling exit point (QIBM_QMH_HDL_INQEXT) and the reply handling exit point (QIBM_QMH_REPLY_INQ).

Download the save file containing the source code.

Read the entire article.


One thought on “APIs by Example: Exit Points, APIs, and Environment Variables

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s