|There are two parts to a file: the file contents, and the file stream. File contents can be permanent or temporary. If temporary, the contents can be scoped as subprocess, related, or detached. The file stream is always subprocess.
That means that if you have a stream positioned at record 10, and invoke a child as a subprocess, and READNEXT within the child, you will be sharing the stream with the parent and the parent will now be positioned at record 11. On the other hand, if you invoke the child as related or detached, the child has its own stream and a READNEXT will not affect the parent's stream.
A stream has four components:
- readnext position (record number/key value plus key path)
- an optional record lock
- a record buffer
- pointer to cached or base file