Problem solve Get help with specific problems with your technologies, process and projects.

ILE CL can boost productivity and performance

Ron Turull shows you the advantages and disadvantages of using ILE CL.

In case you hadn't noticed, the CL language is an official ILE language. There are many obvious advantages to this. There are also some that are not so obvious. And some seeming advantages are not advantages at all!

It's easy to convert CL programs to bound CL procedures
ILE CL supports bound procedure calls via the CALLPRC command. CL programs can be turned into CL procedures and statically bound into other programs. Converting an existing CL program to a CL procedure is as easy as changing its source member type from "CLP" to "CLLE" and compiling it into a module using the CRTCLMOD command. The module is then ready to be bound into any program.


Ron Turull

Because ILE CL can access all the system APIs, including those available only to ILE languages, CL has become quite robust. Dynamic screen manager (DSM) can be used for the most complex screen manipulation and user I/O. The alternative file systems (e.g., hierarchical file system) APIs or a user-written service program can be used to implement database support. At this point in its evolution, the CL language is comparable to BASIC. But before you go building any huge complex applications with CL, remember there are other languages that most likely will do the job better, faster, and with less coding.

Performance tip: Like all ILE programs, a CL program compiled under ILE can run in any activation group you specify. This gives you the opportunity to isolate a CL program in its own activation group. Coding a RETURN command in a CL program will leave a named activation group activated (so it can be reused on the next call to the program). This increases performance because the activation group does not have to be recreated.

More Information

Watch out for RCLRSC
The Reclaim Resources (RCLRSC) command is most often found in CL programs. When converting an existing CL program to ILE, you must pay particular attention to any RCLRSC commands. (See "The trouble with Reclaim Resources" for more details.)

Performance issues
You could squeeze out a 5% performance increase by simply converting your OPM CL programs to ILE CL. In the chart below, notice the seven-second drop in run time gained by converting a simple OPM CL program to ILE CL (133 seconds to 126). The program calls another CL program 500,000 times. Since much of CL consists of calling other programs -- either directly with the CALL statement or indirectly via commands (i.e., calling command processing programs) -- this is fairly representative of real-world CL programs.

If your CL programs do a lot of calling to other user-written programs (written in CL or another ILE-enabled language), consider converting all of them to ILE procedures/modules that can be bound into a single ILE program. Bound procedure calls are about 80% faster than external program calls.

Relative performance figures for
500,000 consecutive calls (in seconds)

External call to
OPM CL program
Bound call to
ILE CL procedure
Called from OPM CL 133 Not applicable
(not supported)
Called from ILE CL 126 27

-----------------------------------
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.


Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close