Question Why we should define the Stream outside of the function Or inside the procedure and why we can't def shared stream inside the internal procedure?

Could someone please explain more about the streams


Those are restrictions imposed by the compiler.

The "why" is probably something that only the development team can speak to. You can often find the right people at PUG Challenge or Progress NEXT.

Rob Fitzpatrick Sponsor
Even if you could, I'm not sure you'd want to. Typically code is encapsulated in a function or IP because you want to us it in multiple places, which often means running it many times within the execution of a procedure. That could lead to the creation of a lot of streams if you weren't careful, and likely also a lot of extra overhead.