RPGLE Getting around recursive calls

With proceedures I read that recursive calls are allowed.  No time to get into proceedures.

clp calls, pgm1.

pgm1 add function displays scrn2, then calls pgm2, pgm2 calls pgm3, pgm3 calls pgm4.

pgm1 update function calls pgm4.

Issue is that pgm4 can call pgm1, pgm2, pgm3, pgm5, pgm6.  On the call to pgm1 a recursive call occurs resulting in RNX8888. 

I added


to all programs, to no avail.

My thoughts on this are: since all parms used between the programs are loaded to the *LDA, end the RPG's with LR = *on and return to the clp.  Let the CLP rtvdtaara *lda and sort out which program to go to next.  Flds in the LDA are;

D LDA_DS         UDS                  dtaara(*LDA)                                            D  LDACNUM                1      9  0                                      Claim number       D  LDAMODE               10     18                                         Mode               D  LDARTNIND             19     20  0                                      Return Indicator   D  LDACUST               21     28  0                                      Customer/Location # D  LDACODE               31     38  0                                      Plumber Code       D  LDADETLN              39     41  0                                      Detl/DetD line #   D  LDASEQ#               43     45  0                                      DetD Sequence #   

I could easily add caller and called pgm to the lda.

What are your thoughts on getting around this?  Is there a quicker way?

The better way may be to use proceedures.  Iam not sure about what all would have to be changed.   I have never used them, now is when I don't have the time to learn it.

All ideas welcomed.


Software/Hardware used:
as400 rpgle

Answer Wiki

Thanks. We'll let you know when a new response is added.

Changed the H spec to:

It works.

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: