![]() Controlling Screen Iterations |
![]() DEVELOPER |
![]() |
PROIV is fundamentally iterative. Functions are usually designed to be executed repeatedly against a set of data. In this scenario, the user has direct control of the application and determines what to do.
If a function is to be used in component mode, there is a fundamental difference: there may be a single iteration of the function against one set of data, with the data to be worked on being determined externally. There are, however, some implications if a function can be run in both the standard mode and component (Task) mode without changes:
-
When a screen function is called as part of a Task, it may need to be treated as a one-time screen.
-
It may be that a series of functions loops back to the start function. This must be prevented in component mode, otherwise the Task will never exit and pass control back to the calling program.
-
If data is passed into the first screen from the calling application, some of the fields that take that data should be made display-only, (i.e. pre-loaded fields). This ensures that the user cannot change that value, possibly causing unexpected behaviour or change of execution flow in the Task.
For non-mainframe use, you can control the iteration of a screen function by using the new writable property CURRENTLS.ONETIME, which can be set to zero (for multiple iterations), or non-zero (for one-time or single-shot). This is not supported under the S/390 product.
Use CURRENTLS.ONETIME in conjunction with a new system variable, @TASK, to control the iteration. @TASK can be checked in logic to determine if the kernel is executing a Task. If there is no active Task (or one is yet to be loaded), it is null. This field is set by the kernel at the start of Task execution and is cleared when the Task is exited. The value of @TASK cannot be modified.
Topic ID: 540026