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



James,

The main procedure of an RPG module cannot be called recursively (unless you're using the new V6R1 support -- but you're not...)

Subprocedures CAN be called recursively, but not the main procedure.

If you're not familiar with the term "main procedure", that's referring to the "main part" of your module. If you have no subprocedures (no P-specs) in your module, the whole module is in the main procedure.

Regarding CALLB -- don't use it. Ever. It's obsolete, and has been for more than a decade. Unless your code must work on V3R1 (which was the ONLY release where we had CALLB and it wasn't obsolete) then you should use prototypes instead of CALLB.


Note that both CALLB and prototypes will call ANY type of procedure (either main procedure or subprocedure.) But, neither prototypes nor CALLB will let you call a main procedure recursively (which is what I *think* you're asking).

However, you COULD call a program recursively with the CALL op-code (or a prototype) provided that you specified ACTGRP(*NEW) on the program. That's one way of making a main procedure work recursively -- create a new activation for each call! which is what ACTGRP(*NEW) does. However, performance wouldn't be good. Using a subprocedure would make more sense.


James Lampert wrote:
Two questions, with regard to something I didn't write:

1. I know that it's possible to have recursive procedure calls in ILE RPG; I've done it myself, but is it possible to set up an ILE RPG program to call itself at the program level?

2. Will a CALLB work at the program level? It doesn't look right to me.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.