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



Any danger in creating all RPGLE programs with DFTACTGRP(*NO) ACTGRP(*NEW)?
We don't use activation groups and compile everything as CRTBNDRPG.  Could
it be a potential memory problem?

 -----Original Message-----
From:   Scott Klement [mailto:klemscot@xxxxxxxxxxxx] 
Sent:   Tuesday, March 11, 2003 2:40 AM
To:     RPG programming on the AS400 / iSeries
Subject:        Re: CRTDUPOBJ an ILE program


> I hope you will be able to resolve this problem.. In our old OPM days we
use
> to use CRTDUPOBJ to create a copy of a program to prevent recursive call,
as
> this program had a potential to be called more than once.

I think maybe you're saying it backwards.   OPM programs could not be
called recursively.   If you try, you get an error RPG8888 "Program called
itself recursively".

A really awkward workaround to this problem was to create a copy of the
program with a different name (or library) so that you aren't really
calling it recursively, but instead calling a whole new program that's
identical to the first.

I guess what I'm saying is, CRTDUPOBJ didn't "prevent" recursing, it
"allowed" recursing.   But, since you're asking how to prevent it, I'm not
sure which answer I should give...

> But, since we covered this program to ILE, the procedure of using
> CRTDUPOBJ does not work, as it's the old name that appears in the
> program stack and so when we send a program message it fails to find the
> correct program message queue.

Okay, I'm going to assume that you want to allow recursing, rather than
preventing it, and give you that answer.

Remove the CRTDUPOBJ stuff.  It's no longer necessary.

Compile the program with DFTACTGRP(*NO) ACTGRP(*NEW)

That's it.  Now the program can call be called as many times as you like
in the program stack, and can even call itself, all with the same program
name and same object on disk.

Although the ACTGRP(*NEW) scenario is more efficient than the CRTDUPOBJ
scenario, it's still not very efficient.   If this is a program that needs
to call itself recursively to accomplish some function (as opposed to
merely ending up multiple times on the call stack by chance) you should
use subprocedures, which can call themselves recursively within the same
program.

Good luck!


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.