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



Hi, Birgitta:

This might have been done to ensure that a "full dynamic call" was used ...

RPG/400 and ILE RPG IV compilers generate code that resolves a pointer to a *PGM just once, and then re-uses that pointer for all subsequent CALLs. This can cause problems if you recompile the *PGM and do not use REPLACE(*YES), thus deleting the old *PGM object. Any programs that have resolved to that *PGM will "blow up" on subsequent calls, with something like:

MCH3402 40 Tried to refer to all or part of an object that no longer exists

There are ways to avoid this, but many RPG programmers are not aware of those techniques. So, they may have come up with this method.

(Of course, we cannot know for certain, unless you can hunt down and ask the original author.)

Hope that helps,

Mark S. Waterbury

> On 6/20/2012 1:20 AM, Birgitta Hauser wrote:
A new way to call a RPG program from a different RPG program!
I found the following code snippet this morning in a program written in
April 2012!!!
Both programs are written in RPGIV!!!
Aaaaaaaaaarrrrrrgh!

D DW_System PR 10i 0
d cmd 2048 varying value

D dsallpf ds qualified
D fil 10A
D lib 10A
...
/Free
dw_system('CALL PGM(DSYUNIQUE) PARM('''+
dsallpf.fil+''' '''+
dsallpf.lib+''' ''0'')');
...
/End-Free
P DW_System B
D DW_System PI 10i 0
D cmd 2048 varying value

d cmdval s 2046 based(cmdval_p)
c eval cmdval_p=%addr(cmd)+2
c eval cmdlen=%len(cmd)
c call 'QCMDEXC' 50
c parm cmdval
c parm cmdlen 15 5
c 50 return -1
c return 0
P DW_System e


Mit freundlichen Grüßen / Best regards


Birgitta Hauser


"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)

"If you think education is expensive, try ignorance." (Derek Bok)

"What is worse than training your staff and losing them? Not training them
and keeping them!"


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email:MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:http://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives athttp://archive.midrange.com/midrange-l.





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.