Previous Topic: #NOTE Statement

Next Topic: #TRAILER Statement


#OPT Statement

This statement defines panel processing options.

Before parsing, the #OPT statement is scanned and any variables are substituted. This makes it possible to dynamically tailor 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, which is determined by the first line that is not a control statement.

This 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 ]
     [ PREPARSE={ (c,S) | (c,D) } ]
     [ UNLOCK={ YES | NO } ]
     [ MAXWIDTH={ YES | NO } ]
ALARM={  YES | NO  }

Determines whether the terminal alarm is to be rung 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 prior to 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 that the panel is to be redisplayed automatically if a broadcast is scheduled. By default, the only panels that are redisplayed automatically are those that contain one or more of the special broadcast variables, &BROLINEn. If BCAST=YES is coded, a broadcast causes the panel to be redisplayed 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 SPD field where the cursor is to be positioned. Alternatively, the precise co-ordinates for the cursor can be defined as row,column.

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

Where co-ordinates are specified, row must be specified in the range 1 to 62 and column in the range 1 to 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 prior to issuing the &PANEL statement.

If internal validation detects 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’  }

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

%

protected, high-intensity

+

protected, low-intensity

_

unprotected, high-intensity

It might be necessary to select alternative field characters, for example if the underline 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 be non-alpha and non-numeric, 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 above.

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 following 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), and X‘40’ (blank) or X‘50’ (ampersand), are valid. This 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. (It is advisable to use hexadecimal values that do not correspond to alphanumeric characters.)

For example, specification of DEFAULT=‘010203’ results in the following:

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 error processing is to be invoked 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 that the error field is to be displayed in reverse-video, colored red and the terminal alarm sounded. Use of the ERRFLD operand can be accompanied by the assignment of some error text into a variable appearing on the screen that identifies the nature of the error.

The operand can be specified with the name of a variable (including the &) that is set to null unless an error occurs, in which case the NCL procedure sets the variable to the name of the field in error prior to 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 high-lighting) without the need 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 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

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

The same effect can be achieved by using the &ASSIGN OPT=SETERR verb. This allows more than one field to be marked as in error.

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

FMTINPUT={  YES | NO  }

Determines if input fields are to be formatted when a panel is displayed. This is a specialized option that is designed to be used in conjunction with INWAIT. When processing with INWAIT, the time interval might expire at the instant when data is being entered by the operator. 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 can be assigned to a variable from within the NCL procedure and changed between YES and NO as required (#OPT FMTINPUT =&YESNO). Care must taken when using this facility, as incorrect use of FMTINPUT=NO can result in validation errors. Ideally, a panel should be displayed initially with FMTINPUT=YES and only when the INWAIT timer expires is it redisplayed with FMTINPUT=NO.

IPANULL={  YES | NO )

The default YES, specifies that if 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 input is caused by a PA key, all variables associated with the panel input fields are to be set to null value.

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

INWAIT=ss.th

Specifies the time in seconds and/or parts of seconds that Panel Services is to wait for input from the terminal prior to returning control to the NCL procedure following the &PANEL statement. By default the system waits indefinitely for input having displayed a panel. This might not always be desirable, as is the case where a terminal is performing a monitoring function where input might 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. Should input be made during the time interval, the time period is canceled and standard processing will proceed.

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 using the clear key, causes the panel to be redisplayed and the time interval reset.

Specification of internal validation options, such as REQUIRED=YES are ignored if the time interval expires before input is received.

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

The invoking NCL procedure can determine if the INWAIT time elapsed or if data was entered by testing the &INKEY system variable. &INKEY is 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 is in effect, &RETCODE is set to 12 to indicate that the INWAIT timer has expired.

Note: INWAIT is ignored for asynchronous panels.

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

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

Although the attributes of each field character (such as the color of the field) can be modified by the use of variables in the #FLD statement, this technique is limited in the number of variations that can be achieved.

The PREPARSE operand requests that Panel Services perform a preliminary substitution scan of each panel line prior to processing the line for field characters. The PREPARSE operand specifies a substitution character c that is to be used to determine where substitution is to take place. This character is processed in exactly 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 impact standard substitution when it is performed following preparsing. Preparsing can be used to alter a field character that appears in a particular position, thereby allocating a new set of attributes to the field or to create entire new fields (or complete lines) that in themselves contain the required field characters.

(c,S)

Indicates that the character c is to be used as the preparse character for the panel, but that the Static Preparse Option is to apply during preparse processing. This 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 is to be displayed in columns. If necessary, 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 to be used as the preparse character for the panel, but that the Dynamic Preparse Option is to apply during preparse processing. The dynamic option allows the movement of preparse or field characters to left or right of their original position to accommodate differing lengths of data being substituted into the panel.

UNLOCK={  YES | NO  }

Determines if the terminal keyboard is to be unlocked when the panel is displayed. Specification of UNLOCK=NO prevents entry of data by the terminal operator, and can be used in conjunction with the INWAIT operand where a panel was being displayed for a short period, prior to progressing to some other function.

MAXWIDTH={ YES | NO }

Specify MAXWIDTH=YES to indicate the display is to be wider than the standard 80 character width. MAXWIDTH=YES means that panel services will use the number of columns available on the terminal (&ZCOLS).

Examples:

#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: