Previous Topic: #NOTE Control Statement—Allow User Comments in a Panel Definition

Next Topic: #TRAILER Control Statement—Place Lines at Screen End

#OPT Control Statement—Define Panel Processing Options

This control statement tailors the processing options for a panel.

Before parsing, the #OPT statement is scanned and any variables are substituted. This process makes it possible to tailor dynamically any of the operands on the statement.

Multiple #OPT statements can be specified. However, as with #FLD, #ERR, and #NOTE statements, all #OPT statements must precede the start of the panel, as determined by the first line that is not a control statement.

This control statement has the following format:

#OPT [ ALARM={ YES | NO } ]
     [ BCAST={ YES | NO } ]
     [ CURSOR={ varname | row,column } ]
     [ DEFAULT={ hlu | X'xxxxxx' } ]
     [ ERRFLD=varname ]
     [ FMTINPUT={ YES | NO } ]
     [ IPANULL={ YES | NO } ]
     [ INWAIT=ss.th ]
     [ LSM={ YES | NO } ]
     [ PREPARSE={ (c,S) | (c,D) } ]
     [ UNLOCK={ YES | NO } ]
     [ MAXWIDTH={ YES | NO } ]
ALARM={ YES | NO }

Determines whether to ring the terminal alarm when the panel is displayed. Dynamic control of the alarm can be achieved by changing the value of the ALARM operand using a variable set before issuing the &PANEL statement.

If internal validation has detected an error and the panel is being redisplayed to indicate the error, this operand is ignored and the terminal alarm rung. The #ERR statement can be used to alter the processing performed when an error condition is detected.

BCAST={ YES | NO }

Specifies whether to redisplay the panel automatically when a broadcast is scheduled. By default, the only panels that are redisplayed automatically are those panels that contain one or more of the special broadcast variables, &BROLINEn. If BCAST=YES is coded, a broadcast redisplays the panel even if it does not contain any of the &BROLINEn variables.

CURSOR={ varname | row,column }

Specifies the name of a variable in either an INPUT or an SPD field where the cursor is to position. Alternatively, the precise coordinates for the cursor can be defined as row,column.

The value of varname is the variable name without the ampersand, as used in the INPUT or SPD field (for example, CURSOR=FIELD5).

Where coordinates are specified, row must be specified in the range 1 through 62 and column in the range 1 through 80. The row and column values are always relative to the start of the current window and therefore remain unchanged when operating in split screen mode. The &CURSROW and &CURSCOL system variables can be used to determine the location of the cursor on input to the system.

Dynamic positioning of the cursor can be achieved by using a variable or variables (including the ampersand) in place of varname or row,column. The invoking NCL procedure can set the variables to the name of the field to contain the cursor or the coordinates before issuing the &PANEL statement.

If internal validation has detected an error and the panel is being redisplayed to indicate the error, the CURSOR operand is ignored and the cursor is positioned to the field in error.

Specifying varname with a name other than the name of a variable used in an INPUT or SPD field results in an error. If coordinates are used and they lie outside the dimensions of the window currently displayed, the cursor is positioned in the upper left corner of the window.

DEFAULT={ hlu | X'xxxxxx' }

Alters the three standard default field characters. If the #OPT statement is omitted or the DEFAULT operand not used, then three standard field characters are provided for use when defining the panel. They are:

% = protected, high-intensity

+ = protected, low-intensity

_ = unprotected, high-intensity

It is sometimes necessary to select alternative field characters, for example, if the underscore character is required within the body of the panel for some reason.

The DEFAULT=hlu operand must always specify three characters. The characters chosen must not be alphanumeric, that is, any special character except ampersand (&), which is reserved for variables. They must not duplicate another field character, except one already defined as a default. The order of the characters is significant, as the attributes of the standard default characters apply in the order described.

Therefore specification of DEFAULT=*+/ results in:

* = protected, high-intensity

+ = protected, low-intensity

/ = unprotected, high-intensity

You can also specify the default field characters in hexadecimal in the format:

DEFAULT=X'xxxxxx'

Each xx pair represents a hexadecimal number in the range X'00' to X'FF'. All numbers except X'00” (null), X'40' (blank), and X'50' (ampersand), are valid. This format even allows alphanumeric characters to be used as field characters. For example, if you specify X'C1', any occurrence of the letter A in the panel definition is treated as the default character. However, we recommend using hexadecimal values that do not correspond to alphanumeric characters.

For example, specification of DEFAULT='010203' would result in:

X'01' = protected, high-intensity

X'02' = protected, low-intensity

X'03' = unprotected, high-intensity

ERRFLD=varname

Specifies the name of a variable in an INPUT field that is in error and for which to invoke error processing, as defined on a #ERR statement. Use of this operand without including a #ERR statement within the panel definition results in an error. The ERRFLD operand provides a simple way of informing Panel Services that the field identified by varname is in error. Panel Services displays the panel using the options defined on the #ERR statement. The #ERR statement could indicate to display the error field in reverse video, colored red and the terminal alarm rung. The assignment of error text into a variable appearing on the screen to identify the nature of the error typically accompanies the use of the ERRFLD operand.

This operand is typically specified with the name of a variable (including the &) that is set to null unless an error occurs. On error, the NCL procedure sets the variable to the name of the field in error before issuing the &PANEL statement to display the panel.

ERRFLD provides the panel designer with a simple means of changing the attributes of a field (such as color and highlighting) without needing to resort to dynamic substitution of #FLD statements.

Consider the case where an input field &INPUT1 is found to be in error and the #OPT statement has been defined with ERRFLD=&INERROR. The NCL procedure simply assigns the name of the variable used to identify the input field, in this case INPUT1 (minus the &), into &INERROR and then redisplays the panel.

&INERROR = INPUT1
&SYSMSG = &STR THIS FIELD IS WRONG
&PANEL MYPANEL

In this example, the text that identifies the nature of the error has been assigned into the variable &SYSMSG which would be defined somewhere on the panel.

&ASSIGN OPT=SETERR is effective only if &CONTROL FLDCTL is in effect.

FMTINPUT={ YES | NO }

Determines whether input fields are to be formatted when a panel is displayed. This specialized option is designed to be used with INWAIT. When processing with INWAIT, the time interval could expire at the instant when the operator enters data. If the same panel is redisplayed to update the screen contents, the data entered by the operator is lost as the new panel is written. FMTINPUT can be used to bypass formatting of input fields and hence when the panel is redisplayed only output fields are written. The value of this operand is typically assigned to a variable from within the NCL procedure, and changed between YES and NO as required (#OPT FMTINPUT =&YESNO). Take care when using this facility because incorrect use of FMTINPUT=NO can result in validation errors. Ideally, a panel is displayed initially with FMTINPUT=YES and only when the INWAIT timer expires would it be redisplayed with FMTINPUT=NO.

IPANULL={ YES | NO }

Specifies whether to set all variables associated with the panel input fields to null when the panel is displayed with the INWAIT option, and the time specified on the INWAIT expires so that control is returned to the procedure without any panel input or a PA key causes the input.

If you do not want to erase input field variables if INWAIT completes or a PA key is pressed, specify IPANULL=NO.

Default: YES

INWAIT=ss.th

Specifies the time in seconds and parts of seconds that Panel Services is to wait for input from the terminal before returning control to the NCL procedure following the &PANEL statement. By default, the system, having displayed a panel, waits indefinitely for input. This indefinite wait is not always desirable, as is the case where a terminal is performing a monitoring function where input can be infrequent or never occur. If INWAIT is utilized and the specified time elapses, control is returned to the NCL procedure with all input or SPD variables set to null. If input is made during the time interval, the time period is canceled and standard processing proceeds.

The maximum value that can be specified for INWAIT is 86400.00 seconds (24 hours).

Specification of part seconds is possible. For example:

INWAIT=.5
INWAIT=20.5
INWAIT=.75

Any redisplay of a panel (for example, by use of the clear key) causes the time interval to be reset. If the time interval expires before input is received, specification of internal validation options (such as REQUIRED=YES) is ignored.

Specification of INWAIT=0 or INWAIT=0.00 indicates to accept no input, and control is returned to the NCL procedure immediately after the panel has been displayed. In this case, subsequent action taken by the procedure determines the period that the panel remains displayed.

The invoking NCL procedure can determine, by testing the &INKEY system variable, whether the INWAIT time elapsed or data was entered. &INKEY is typically set to the character value of the key pressed by the operator to enter the data (for example, Enter or F1). If the INWAIT time interval elapsed and no entry was made, the &INKEY variable is set to null. If processing with &CONTROL PANELRC in effect, &RETCODE is set to 12 to indicate that the INWAIT timer has expired.

INWAIT is ignored for asynchronous panels.

Default: Wait indefinitely for input.

LSM={ YES | NO }

If you do not want the LSM to control a particular panel, then code #OPT LSM=NO in the panel definition. The entire panel is then written to the terminal each time. If large numbers (thousands) of EASINET terminals are being supported, the reduction in storage can become significant.

PREPARSE={ (c,S) | (c,D) }

Preparsing provides a means for dynamically modifying the location of field characters in a panel. Normally, the position of field characters (as defined by the #FLD control statement) is determined when Panel Services creates the panel and remains fixed until the panel is modified.

Although you can modify the attributes of each field character (such as the color of the field) by using variables in the #FLD statement, you are limited in the number of variations.

The PREPARSE operand requests that Panel Services performs a preliminary substitution scan of each panel line before processing the line for field characters. The PREPARSE operand specifies a substitution character (c) that is used to determine where substitution takes place. This character is processed in the same manner as an ampersand (&) is processed during standard substitution.

The ability to specify a character other than an ampersand means that preparsing does not affect standard substitution when it is performed following preparsing. You can use preparsing for the following purposes:

(c,S)

Indicates that the character c is used as the preparse character for the panel, but that the Static Preparse Option applies during preparse processing. This option prevents the movement of preparse or field characters during the substitution process. This option is useful when panels are being dynamically modified to hold data that can vary in length but displays in columns. Substituted data can be truncated if it is too long to fit into its target field without overwriting the next occurrence of a preparse or field character on the same line.

(c,D)

Indicates that the character c is used as the preparse character for the panel, but that the Dynamic Preparse Option applies during preparse processing. The dynamic option allows the movement of preparse or field characters to the left or right of their original position to accommodate differing lengths of data being substituted into the panel.

UNLOCK={ YES | NO }

Determines whether the terminal keyboard is unlocked when the panel is displayed. Specification of UNLOCK=NO prevents entry of data by the terminal operator. NO is typically used with the INWAIT operand where a panel is being displayed for a short period before progressing to some other function.

MAXWIDTH={ YES | NO }

When MAXWIDTH=NO is specified or defaulted, the panel display is limited to the standard 80-column width. If you are designing a panel for a wider screen (for example, a model 5 terminal), specify MAXWIDTH=YES to allow the full width of the screen to be used.

Examples: #OPT Control Statement

#OPT DEFAULT=#$%
#OPT INWAIT=60 CURSOR=&CURSORFLD
#OPT CURSOR=IN1 ALARM=YES
#OPT ALARM=&ALARM PREPARSE=($,D)
#OPT ERRFLD=&INERROR
#OPT INWAIT=.5 UNLOCK=NO PREPARSE=($,S)
#OPT CURSOR=5,75
#OPT CURSOR=&ROW,&COLUMN FMTINPUT=&FMT

Notes: