|
Scott,
I respectfully disagree with any general statements like removing pointer logic from the program.
And since he's using a data structure I am wondering if he's using something like QUSPTRUS to process a list returned by some API. I find QUSPTRUS better than QUSRTVUS.
Going back to QUSRTVUS would make as much sense as IBM dropping the ADD op code and also dropping
number = x + y;
and making you do something like
number = AddNumbers(x : y : ErrDS);
Select;
When ErrDS.ErrCode=NoError;
// ok
ProcessAddedUpNumbers(number);
When ErrDS.ErrCode= TruncationError;
// Truncation occurred
Other;
// generic error handler
EndSl;
He simply needs to consider whether or not he needs to initialize the data structure at all, and if so, ensure that the basing pointer is set first.
When using a data structure in list logic (like the API example above) I wouldn't see a reason to ever initialize it. The values would change upon adding the increment to the pointer. And if you checked the error code upon the initial call to QUSPTRUS and didn't muff up the looping logic you should be fine.
Better to teach someone than to scare them off.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.
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.