|
Barbara, Jon, et al,
This code (equivalent) was shown to me and the program's behavior
surprised me.
I'm not sure if I'm missing something or if this is an ILE bug.
CLLE
----
xtest: pgm
dcl &p1 *char 10 'ABCDEFGHIJ'
dcl &p2 *char 5 'klmno'
dcl &p3 *char 8 'PQRSTUVW'
dcl &p4 *char 3 'xyz'
dcl &p5 *char 6 '123456'
callprc xtest1 parm( &p1 &p2 &p3 &p4 &p5 )
callprc xtest2
endpgm
-----
RPGLE - XTEST1
-----
* Testing ILE call/parm bug
D P1 S 10
D P2 S 5
D P3 S 8
D P4 S 3
D P5 S 6
C *Entry PLIST
C PARM P1
C PARM P2
C PARM P3
C PARM P4
C PARM P5
C SETON LR
C RETURN
-----
RPGLE - XTEST2
-----
D P1x S 10
D P2x S 5
D P3x S 8
D P4x S 3
D P5x S 6
C *Entry PLIST
C PARM P1x
C PARM P2x
C PARM P3x
C PARM P4x
C PARM P5x
C SETON LR
C RETURN
--------------------------------
OK, pop quiz: What are the values (under debug) of P1x through P5x?
Sources were compiled:
CRTCLMOD MODULE(XTEST) SRCFILE(QCLSRC) SRCMBR(XTEST) TGTRLS(V4R5M0)
DBGVIEW(*ALL)
CRTRPGMOD MODULE(XTEST1) SRCFILE(QRPGLESRC) SRCMBR(XTEST1) DBGVIEW(*ALL)
TGTRLS(V4R5M0)
CRTRPGMOD MODULE(XTEST2) SRCFILE(QRPGLESRC) SRCMBR(XTEST2) DBGVIEW(*ALL)
TGTRLS(V4R5M0)
CRTPGM PGM(XTEST) MODULE(XTEST XTEST1 XTEST2) ACTGRP('ABC')
TGTRLS(V4R5M0)
--------------------------------
Surprise (to me) answer: The variables remained with the same values
throughout.
P1x = 'ABCDEFGHIJ'
P2x = 'klmno'
P3x = 'PQRSTUVW'
P4x = 'xyz'
P5x = '123456'
Why the surprise? I expected the program to either bomb (no parms were
passed to XTEST2) or the variables should have been cleared. The pointers
from the first call seem to have been retained between calls.
Is this a bug, design flaw, feature, other?
To field the obvious question: Why are you calling a module that is
supposed to receive parms w/o any?
1) It was discovered accidentally.
2) In an ILE environment, where a module is supposed to be designed for
reuse, this is an entirely possible scenario.
-mark
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.