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



On 1/16/2012 10:55 AM, PAPWORTH Paul wrote:
I would have liked to eliminate this unnecessary complexity and
replaced the pointer by a prototyped call using the likeds feature.
However this would have had an enormous impact on the system , so I
opted for a work around.

Why would this have an "enormous impact" on the system? Do you mean that it'd be hard to find all of the calling programs and update the code to pass the DS?


I created 3 separate little programs to write to each of the files
and I created these in their own named activation groups thus
'protecting them' from the address error in the main program group.

I don't see how that solves the problem?! You just moved the problem to another place... perhaps it's a place where it doesn't trigger an exception for now... but, just like your original problem, it can rear it's ugly head somewhere in the future.

The real solution is to find the bug... figure out where you're corrupting memory and fix it.


This solved the problem and reinforces my belief that we should avoid
passing pointers when other more safe techniques exist.

The problem is pointers isn't that they are inherently dangerous -- it's just that there's no safety net. If there's a bug in your code, it can go unnoticed. You need to make sure your pointer logic is written in a way that any bugs would be completely obvious to someone reading the code, and therefore they wouldn't make any mistakes.

The biggest problem with pointers in RPG is that 95% of the RPG programmers using them haven't a clue of what they do or how they work. They just muddle through it, trying different things until one of them works. And with pointers, that's a recipe for disaster, because stuff that "works" in tests may very well be corrupting memory and creating a "time bomb" for the future. You should only code pointers if you fully understand what the code does, and are certain (even before your code is compiled) that you know it's coded properly.

As for passing pointers as a parameter on a dynamic call -- I've never seen an instance where it's required. There may be exceptions, but as a general rule it's the hallmark of a bad design.


I hope this is not too crude a solution as do admit that I do find
this area quite difficult to follow and as such am a bit worried how
I'll get on with Java as we are dropping RPG in favor of OO.

You never code pointers in Java. (Obviously, pointers are a big part of how computers work... so they exist under the covers, but you never have to code them yourself.)

FWIW, this also means that you won't be able to call those dynamic RPG programs you mentioned from Java... since Java can't pass a pointer, those programs are uncallable.

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.