buffer in a FOR EACH statement is affected by IP

Project:Prolint Issue Tracker
Component:Rules
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

try to check if the buffer in a FOR EACH statement is affected by internal procedures. For example:

Code:

	
   FOR EACH customer :
       RUN Something.
       DISPLAY customer.cust-num.
   END.

   PROCEDURE Something :
       FIND FIRST customer.
   END PROCEDURE.

You would expect Progress error "FIND cannot be processed for a FOR EACH mode record. (213)"


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

buffers in udf/ip

If you have a rule that you must always define buffers for every table in every udf/ip that reads from the database, you don't need this rule. You can simply write :

define buffer customer for customer.

The buffer-rule also makes your udf/ip's safe(r) from other points of view, like they become more independant from any surrounding/calling code. Seems easier to implement too, I think.


jurjen's picture

re: buffers in udf/ip

Hi Johan,
Have you noticed that such a rule already exists? Rules "bufdbmeth", "bufdbfunc" and "bufdbproc" check if buffers are defined for every table in methods, udf's and ip's :-)


re: buffers in udf/ip

Yes I did, Jurjen, right after I posted my comment ;-).
But that sort of confirmed my remark to me.
Don't you agree ?


jurjen's picture

re: buffers in udf/ip

If i agree? Well, yes and no :-)
Sure I agree that scoping buffers to the ip/udf/method is generally a very good idea. And if you always do that, then you will not suffer from the bug that is addressed by this "buffer in a FOR EACH statement is affected by IP" issue.

But from a Prolint ruleset point of view, I think that there is still a valid reason to have a rule for this.
The "bufdbproc" rules are enforcing something that you can describe as a best practice or programming style. A warning from this rule does not always indicate a real problem in the code, it is totally valid to configure Prolint to skip the "bufdb*" rules when someone does not agree with the recommendation that buffers should always be defined locally. The issue with "buffer in FOR EACH statement is affected by IP" however scans for real bugs; situations that the Progress compiler should have noticed. The rule would not find as many warnings, but the severity of the warning would be very high. In cases like this I would gladly accept the fact that rules are somewhat overlapping each other.