---+ Scoping Rules - Subprocess/Related/Detached 'Scoping' refers to what workfields and temporary files (both disk and memory) are available to a given process. There are three levels of Scoping: SUBPROCESS, RELATED, and DETACHED. Every workfield and temporary (disk or memory) file is defined at one of these three levels of scoping. The same three scoping levels define every 'child' invocation. For example: * <p>Menu children are typically <span style="font-size: xx-small;">(and by default)</span> defined as DETACHED invocations.</p> * Job-step children are typically <span style="font-size: xx-small;">(and by default)</span> defined as RELATED invocations. * Parent-Child invocations between two <span style="font-size: xx-small;">(for example INPUT)</span> processes are typically <span style="font-size: xx-small;">(and by default)</span> defined as SUBPROCESS invocations. * Direct ILF verb invocations (ex: ILF verb 'INPUT') are by default defined as DETACHED invocations. DETACHED workfields/tempfiles survive DETACHED process invocations. RELATED and SUBPROCESS level files/fields don't. DETACHED workfields/tempfiles initialize on the next invocation of a DETACHED proces. DETACHED and RELATED workfields/tempfiles survive RELATED invocations. SUBPROCESS level files/fields don't. DETACHED, RELATED, and SUBPROCESS workfields/tempfiles all survive SUBPROCESS level invocations. For example, if a DETACHED workfield or tempfile is referred to by a DETACHED child invocation, parent and child share that workfield/tempfile. But if a RELATED or SUBPROCESS workfield/tempfile is referred to by a DETACHED child, the child creates a new copy of that workfield/tempfile. Record buffers, field contents (including Working Storage fields), and file pointers are all available transparently through a SUBPROCESS invocation. They are not maintained for RELATED or DETACHED process invocations. ---+++++ Exception #1: Query(Setup) inherits inbound workfields/tempfiles according to normal scoping rules. But it passes workfields/tempfiles _only_ to Query(Runtime) execution. Query(Runtime) inherits inbound workfields/tempfiles <em>only </em>from its associated Query(Setup). It can pass _nothing_ to any subsequent JOB step. The exception to this is that <span style="font-family: Courier New;">--- PROCESS CODE</span> can be used to pass limited information into and out of Query processes. But <span style="font-family: Courier New;">--- PROCESS CODE </span>should only be used for SPEED II compatibility issues. See ECR #2805 for further explanation. ---+++++ Exception #2: No workfield or tempfile information can 'come back' from a JOB step whose 'Sep Tsk?' (Separate Task) flag is set to 'Y'. This is because a JOB step process that could be spawned into an independent thread has no facility for communicating back to the original parent process, save by means of a disk/permanent file. See <a href="BackgroundProcessing" target="_blank">APPX Background Processing</a> for further discussion. ---++ Comments: _Read what other users have said about this page or add your own comments._ --- <br />%COMMENT%
This topic: Main
>
WebHome
>
DeveloperTips
>
ScopingRulesSubprocessRelatedDetached
Topic revision: r2 - 2016-02-19 - JeanNeron
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback