Avoiding panel loop conditions in the batch environment

When writing new dialogs or altering existing dialogs to run in the batch environment, dialog developers must be very careful not to create functions that result in a processing loop where user input is expected and none is supplied. See Supplying input in lieu of interactive users for more information. For example, running the ISPPREP command causes ISPF to call an interactive ISPPREP dialog, which will cause a loop condition in a batch environment. Instead, you should invoke the non-interactive ISPPREP facility directly by using the SELECT PGM(ISPPREP) service request as described for batch mode under Figure 1.

The KEYS command can cause a loop condition because its processing termination depends on an END or RETURN command. An ENTER condition, which ISPF assumes in absence of an END or RETURN being forced, results only in another panel display, which leads to a loop condition.

To help deal with possible looping situations, the BDISPMAX keyword on the ISPSTART command is available to specify the maximum number of panel displays that can occur during a session. The default value is 100. You can test the current number of displays in a batch mode session by reading the ZBDMXCNT system variable. The value of BDISPMAX is stored in the ZBDMAX system variable.

If the number specified in BDISPMAX is exceeded, a severe error condition (return code 20) results and an error message, stating that the maximum number of displays has been exceeded, is written to the SYSTSPRT data set.