APIs and exit programs: Thousands of lines of free code

You can shave hours off of your development time by taking advantage of thousands of lines of free code IBM has given all of us. Many of the System i-iSeries system APIs and exit programs take parameters that can get quite complex; that is, a parameter can be formatted as a data structure containing many subfields -- sometimes as many as 30 or 40. Defining these data structures is a time-consuming chore and a waste of your valuable talents. The IBM-provided code contains predefined data structures and constants for most, if not all, of the system APIs and exit programs.


Ron Turull
You can shave hours off of your development time by taking advantage of thousands of lines of free code IBM has given all of us. Many of the System i-iSeries system APIs and exit programs take parameters that can get quite complex; that is, a parameter can be formatted as a data structure containing many subfields -- sometimes as many as 30 or 40. Defining these data structures is a time-consuming chore and a waste of your valuable talents. The IBM-provided code contains predefined data structures and constants for most, if not all, of the system APIs and exit programs.

How to take advantage of this code

The free code is in the form of copy members (also known as header files and include files) and can be found in the QSYSINC library, which stands for 'system includes' (the word 'includes' is the C language terminology for copy member). Each language has its own file. The chart below will help you locate the file appropriate for the language you are using.

Quick reference to copy files in QSYSINC

Tips for locating the proper member

Once you have determined which file you need, you'll need to locate the appropriate file member. Because there are so many copy members in each of these files and many of their names apparently have no relation to their contents, finding the right member can be tough. Try these two tricks to lessen the burden:

1. Search through the contents of all the members for the name of the API you are using (e.g., QMHRDQM). To search through all the members in a file, "open" the file in PDM (use the WRKMBRPDM command to get into PDM). Then, type option 25 next to the first member listed and press F13 (this will copy the option 25 to all the members in the list). Next, press Enter and the Search Options screen will appear, where you can type the name of the API (or any other text) you want to search for. Finally, press Enter and the system will start searching through the members.

2. A quicker, but less effective, method involves searching just the text descriptions of the members. You can do this by pressing F17 to bring up the Subset Member List screen and specify criteria to subset the list. To search the text descriptions, type in a search word for the Text field. For example, to locate members having include information for data queue APIs, type "data queue" in the Text field and press Enter.

Once you have located the appropriate member, use the "/COPY" RPG compiler directive to have the compiler copy the contents of the member into your program (COBOL programmers use the COPY statement).

-----------------------------------
About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years' experience programming for and managing AS/400-iSeries systems.


This was first published in October 2006

Dig deeper on iSeries Applications

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close