Forum Post: Re: Buffer Scope Issue With Break By

  • Thread starter Simon L. Prinsloo
  • Start date
Status
Not open for further replies.
S

Simon L. Prinsloo

Guest
That is expected behaviour. The buffers will scope to the lowest block in which they are referenced. When you define them in the IP, they belong to the IP. As they are only referenced in the FOR block, that is the outer most block with scoping capability that reference the buffer and it will control the scope, i.e. the record will go out of scope after each iteration. But if you reference the buffer before the FOR in the IP or after the END of the FOR block in the IP, the IP will control scope and the records from previous iterations will remain in the buffer. But if you do not define them in the IP, the IP will share the globally (implicitly or explicitly) defined buffers of the external procedure, which will then manage scope in order to enable sharing of the buffer between the main block and all the IPs. You can however explicitly fix the scope by using a "DO FOR", in which case references to the buffer outside the block should give an error.

Continue reading...
 
Status
Not open for further replies.
Top