This feature is not available under the S/390 product

If a calling program passes data into a screen function, the caller may not want a user to be able to change the value of that data. This can be achieved by setting the field attribute to some combination of ‘No Change’, ‘Auto Repeat’ and a new attribute, ‘Pre-Load’.

The primary purpose of the pre-load flag on a screen field is to allow data to be fed into the field from outside the screen, either from a parent screen (standard mode) or from third-party program using component mode. A pre-load field behaves as a no-change, auto-repeat field if there is data in the field when the field is first visited. The data can be placed in the field prior to file reads in any way that a field is loaded in PROIV—via P4API, via a logic command, etc.

If there is data in the pre-load field, the field cannot be changed, no matter what the screen mode. If there is no data in the field when it is first visited during a screen iteration, the field will behave as a normal field and data can be entered until the current record is saved and the iteration begins again. This is different from the behaviour of a ‘no-change’ field, where data cannot be entered into the field when the screen is in ‘change’ mode, whether or not data is present in the field.

The PROIV Timing Cycle initialises the file data to null before each iteration of a logical screen, report or update. It also clears the scratch data associated with the screen fields. Key fields and data associated with auto-repeat fields are not initialised, neither are data fields used by pre-load screen fields. The latter will be treated as auto-repeat fields as long as the field remains pre-loaded.

The following use cases describe the functionality of pre-load fields more fully.

If a pre-loaded field is visited, and the data element has no data in it, the pre-load restraint is removed for that iteration. The user is allowed to enter and change the data. Since the pre-load constraint has been turned off, this data will not be preserved for the next screen iteration. If the screen is not a one-time screen (set by the writable CURRENTLS.ONETIME property), then the next time the screen is executed, the field is treated as a pre-load field again but the pre-load data protection is never turned on again.

It is possible to create a pre-load field that is not pre-load on one iteration and is then pre-load on the next. In this case, the field would have been loaded from within the screen, but not by the user. If this is done, the pre-load state of the field will no longer protect the data from the initialisation at the start of screen execution. If the programmer does not want the data re-initialised, the auto-repeat flag on the field will protect the data from initialisation unconditionally.

There are two caveats to the use of pre-load fields:

Based on the rules above, if a pre-loaded field is specified for execution, a file read error occurs, and there is data in the field, the field cannot be visited.  If every field between the file read field and the new field to be executed is a field that cannot be changed by the user, an infinite loop occurs.  This is treated as a fatal error and rollback is invoked.  The rollback occurs whether or not it is enabled for the function in general.

There are no validation checks for pre-load fields.  The application developer must make sure data is correct in the third party application or in the Task start function.

Comment on this topic

Topic ID: 540111