× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Charles,

All ILE programs remain activated until the activation group ends (unless you specify DFTACTGRP(*YES) on the CRTBNDxxx command, that is)
That includes all of CL, RPG, and C.

(Yes, an ILE RPG program remains active regardless of whether *INLR is on or off. However, if INLR is on, the files are closed, and the variables are reset to their initial values on the subsequent calls -- but either way the program remains active until the activation group is reclaimed.)

What I think you're driving at is that RPG's main procedure stores it's variables in static storage. So they can keep their values from call to call. CL uses automatic storage, so the storage of the variables is freed when the procedure ends, and has no chance of keeping it's value from call to call.

That, by the way, is one of the reasons why CL can be called recursively and RPG can not! :) So that's a GOOD feature in this case, not a bad one. Because CL's variables are in automatic storage, there's a separate copy created for each call stack level -- which is a requirement for recursion.

C will also, by default, use automatic storage (like CL does) though C has more options to control how the storage is allocated than CL has.

However, if it's a simple wrapper that does nothing by call an RPG procedure, I really think this bit about automatic vs. static storage is a moot point. There probably won't be any variables scoped to the main procedure, since all it's going to do is pass it's parameters on to the RPG subprocedure.

Also, just to straighten out the terminology a little bit... we are talking about using C or CL for the UEP, not the PEP. You can't create your own PEP, the PEP is generated by the compiler. We are working on the UEP (user entry procedure) that's called when the program is invoked.



Charles Wilt wrote:
Good point Scott, just to expand upon your reply...

The OP would want to use ILE CL in order to use the CALLPRC command to
call the RPG IV procedure.

However, since we're talking about triggers, I'm wondering how big the
performance hit would be using ILE CL. Correct me if I'm wrong Scott,
but ILE CL doesn't support a program staying active like RPG does by
returning with LR = *OFF. C programs on the other hand always remain
active till the activation group ends.

Thus, it would seem to me that using C for the PEP (mainline) would be
preferable to using ILE CL. Even if a shop doesn't have C experience,
the C routine is so simple and easily copied for use in other
triggers, picking up what little knowledge is required to use it
shouldn't be a big deal in a modern RPG IV shop.

Charles

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.