Compaq COBOL
Reference Manual


Previous Contents Index

NOT ON EXCEPTION Phrase (Format 5)

  1. The NOT ON EXCEPTION phrase allows execution of an imperative statement when the ACCEPT statement terminates successfully. When there is an applicable CRT STATUS clause, successful termination is indicated by a value of '0' in the first character of the CRT STATUS data item (see the SPECIAL-NAMES section of Chapter 4).

NOT ON EXCEPTION Phrase (Formats 3, 4, 5, 7, and 8)

  1. A DISPLAY statement within an ACCEPT [NOT] ON EXCEPTION statement must be terminated (with, for example, END-DISPLAY).

AT END Phrase (Formats 3 and 4)

  1. The AT END phrase allows execution of an imperative statement when an end-of-file condition occurs.
  2. AT END and ON EXCEPTION are mutually exclusive.
  3. If AT END is specified, the end-of-file indication is also a control key. If you do not specify AT END or ON EXCEPTION, and end-of-file is entered, an error condition occurs.

NOT AT END Phrase (Formats 3 and 4)

  1. The NOT AT END phrase allows execution of an imperative statement when an end-of-file condition (or other error) does not occur.

Format 3

UNDERLINED Phrase (Format 3)

  1. The UNDERLINED phrase echoes input characters to the terminal with the underscore on character attribute.
  2. When you use the UNDERLINED phrase with the PROTECTED phrase, the input field is underlined prior to accepting data.

BOLD Phrase (Format 3)

  1. The BOLD phrase echoes input characters to the terminal with the bold on character attribute.
  2. When you use the BOLD phrase with the PROTECTED phrase, the input field is visibly bolded prior to accepting data only if: (1) the underlined or reversed attributes are also specified, or (2) the video terminal screen is set to light background.

BLINKING Phrase (Format 3)

  1. The BLINKING phrase echoes input characters to the terminal with the blink on character attribute.
  2. When you use the BLINKING phrase with the PROTECTED phrase, the input field is visibly blinked prior to accepting data only if: (1) the underlined or reversed attributes are also specified, or (2) the video terminal screen is set to light background.

REVERSED Phrase (Format 3)

  1. The REVERSED phrase echoes input characters to the terminal with the reverse video on character attribute.
  2. When you use the REVERSED phrase with the PROTECTED phrase, the input field appears in reverse video prior to accepting data.

CONVERSION Phrase (Formats 1 and 3)

  1. The CONVERSION phrase allows you to accept data into a field and achieve the same results as you would with the MOVE statement for non-floating-point items, and provides conversion from display, display scaled or E-notation to floating point in the case of floating-point data items. It enables validation of the accepted data and facilitates editing and alignment of data within dest-item. The effect of the CONVERSION phrase on data handling depends on the category of dest-item. (Numeric data can be described by any USAGE clause.)
  2. When dest-item is numeric or numeric edited (other than floating point), the CONVERSION phrase:
  3. When dest-item is floating point, the CONVERSION phrase:
  4. When dest-item is numeric or numeric edited (other than floating point), and you use the CONVERSION phrase, valid input characters are as follows:
    The terminal operator can input space characters only as leading and trailing spaces. If this occurs, space characters are simply ignored during numeric conversion.
    However, the operator cannot input space characters between numeric characters, between numeric characters and a decimal point, or between a sign and any other input character. When this occurs, the input data is invalid, and an error condition results.
    The operator can input only one sign character and one decimal point character.
    When the operator inputs a sign character, it must precede or follow all numeric characters and the decimal point.
    The default sign character is a plus sign (+).
    The default number of decimal places is zero.
  5. When dest-item is floating point, and you use the CONVERSION phrase, valid input characters are as follows:

For example:


2.5E2 
-0.08e4 
10.0E-1 
-2.14158E0 

Note that numbers can be expressed in several ways. For example, the number 257.0 can be represented in any of the following ways:


257e0   2.57E2   0.000257E+6   2570E-1 

  1. When you use the CONVERSION phrase and dest-item is numeric, data input results in a conversion error condition if the operator enters any of the following:
    When one of these error conditions occurs, and you do not specify the ON EXCEPTION phrase: (1) the contents of dest-item do not change, (2) the terminal bell rings, (3) the input field is erased, and (4) the ACCEPT statement executes again. The input field is not erased if the EDITING phrase is used.
    When one of these error conditions occurs, and you do specify the ON EXCEPTION phrase: (1) the contents of dest-item do not change, (2) the input field is left as if no error occurred, and (3) the imperative statement of the ON EXCEPTION phrase executes.
  2. When dest-item is not numeric, the CONVERSION phrase moves input characters to dest-item as an alphanumeric string (MOVE statement rules apply). Therefore, data can be accepted into an alphanumeric edited field, or a reference modified field, and the JUSTIFIED clause, if it applies to dest-item, can take effect.
    An overflow condition is not an error condition when dest-item is alphanumeric; in this case, right-end truncation occurs. However, you can specify the PROTECTED and SIZE phrases to limit the amount of input data when dest-item is alphanumeric.
  3. When you use the CONVERSION phrase, and the operator types the terminator key prior to any data input:
    If the default value is not a valid value for dest-item, an error condition results. If ON EXCEPTION is used, an exception path is followed. If ON EXCEPTION is not used, an automatic reprompt for data occurs.
  4. If you do not use the CONVERSION phrase, data is transferred to dest-item according to Format 1 ACCEPT statement rules when CONVERSION is not specified.

PROTECTED Phrase (Format 3)

  1. The PROTECTED phrase limits the number of characters that can be entered from the terminal.
  2. If you do not specify the PROTECTED phrase, the cursor remains on the character position immediately following the position of the last input character. This is the default starting position of the next data item you input from or display upon the terminal.
    However, if you use the PROTECTED phrase to delimit the field of a data item, the cursor moves to the character position immediately following the last position of the input field. In this case, the default starting position of the next data item is always to the right of the input field, as determined by the SIZE phrase or PICTURE clause.
  3. When you specify the PROTECTED phrase without the AUTOTERMINATE phrase:
  4. If you use the PROTECTED phrase without the SIZE phrase, the maximum number of characters that the operator can enter is as follows:
    For non-floating-point numeric items, the maximum number of characters allows for entry of sign and decimal point characters when these are implied by dest-item's PICTURE clause. For example, if PIC S9(4)V99 is the PICTURE clause for dest-item, all of the following character strings are valid input:
    2222.22
    2222
    .22
    +2222.22
    222.22-
    -02.2
    Although the sign does not represent a character position (and does not count toward item size), a space in the input field is allocated for it. A space is also allocated for the implied decimal point.
  5. When you use the PROTECTED phrase without the NO BLANK or FILLER phrase, the input field is filled with spaces prior to accepting data. If you also use the UNDERLINED, REVERSED, BOLD, or BLINKING phrase, those spaces have the specified character attributes.
  6. If you use the PROTECTED phrase on a field that causes the cursor to position past the last column position of the screen, the results are undefined.
  7. If you do not use the PROTECTED phrase, an overflow condition is treated according to rules for the Format 1 ACCEPT statement.

SIZE Phrase (Format 3)

  1. You can use the SIZE phrase only when you also specify the PROTECTED phrase.
  2. The SIZE phrase specifies the number of characters in the input field. It allows you to specify fewer or more characters than are specified in the PICTURE clause for dest-item.
  3. Data input results are undefined if the program generates a value for prot-size-item that is zero or negative.

AUTOTERMINATE Phrase (Format 3)

  1. You can use the AUTOTERMINATE phrase only when you also specify the PROTECTED phrase.
  2. The AUTOTERMINATE phrase terminates a protected ACCEPT as soon as the maximum number of characters has been entered. If the maximum number is entered, you should not enter a legal terminator. If you enter the maximum number of characters and a terminator, the terminator is retained in the terminal driver type-ahead buffer and will terminate the next ACCEPT statement. If you enter fewer than the maximum number of characters, a legal terminator is required to terminate the ACCEPT statement. The maximum number of characters is determined by the same rules that apply to the PROTECTED phrase.
  3. If you do not use the AUTOTERMINATE phrase, the ACCEPT statement is terminated when you enter a legal terminator key.

NO BLANK Phrase (Format 3)

  1. You can use the NO BLANK phrase only when you also specify the PROTECTED phrase.
  2. The NO BLANK phrase specifies that the input field is not to be changed until you enter the first keystroke. Once you enter a keystroke, the remainder of the field is filled with spaces or filler (or the default value, if the EDITING and DEFAULT phrases are used) using any character attributes specified on the ACCEPT statement.

EDITING Phrase (Format 3)

  1. You can use the EDITING phrase only when you also specify the PROTECTED phrase.
  2. The EDITING phrase enables keys to perform field editing functions.
    On OpenVMS Alpha systems, the EDITING phrase enables the keys described in Table 6-8.

    Table 6-8 Field Editing Keys for OpenVMS Alpha Systems
    Key Description
    Left,
    Ctrl/D
    Move left.
    Right,
    Ctrl/F
    Move right.
    Ctrl/H,
    F12
    Move to beginning of line.
    Ctrl/E Move to end of line.
    Ctrl/A,
    F14
    Toggle insert and overstrike mode.
    Ctrl/K Erase to end of line.
    Ctrl/U Erase to beginning of line.
    Ctrl/M,
    TAB,
    CR
    Terminate input.
    Ctrl/Z End-of-file termination. <>

    On Tru64 UNIX and Windows NT systems, the EDITING phrase enables the keys described in Table 6-9.

    Table 6-9 Field Editing Keys for Tru64 UNIX and Windows NT Systems
    Key Description
    Left,
    Ctrl/B
    Move left
    Right,
    Ctrl/F
    Move right
    Ctrl/H Erase previous character
    F12,
    Ctrl/A
    Move to beginning of line
    Ctrl/E Move to end of line
    F14,
    Ctrl/T
    Toggle insert and overstrike mode
    Ctrl/K Erase to end of line
    Ctrl/U Erase to beginning of line
    Ctrl/M,
    TAB,
    CR
    Terminate input
    Ctrl/D End of file termination <>

  3. In insert editing, each new character is entered where the cursor indicates and the cursor moves to the right. The rest of the field also moves one character position to the right. A character moved beyond the last character position of the field is lost. The delete key causes the character to the left of the cursor to be deleted. The rest of the field moves one character position to the left, and space is inserted in the last position of the field.
    In overstrike editing, each new character replaces the one where the cursor is positioned and the cursor moves to the right. The delete key causes the character to the left of the cursor to be replaced by a space and the cursor moves to the left.
  4. When program execution begins, overstrike or insert editing is used, according to your terminal's current setting. The same editing mode is used for all ACCEPT statements with the EDITING phrase until the next use of the switch-mode function.
  5. The EDITING phrase affects the syntax and semantics of other phrases. For more information, see the sections on NO BLANK, FILLER, CONVERSION, NO ECHO, DEFAULT, CURRENT VALUE, and CONTROL KEY.

FILLER Phrase (Format 3)

  1. You can use the FILLER phrase only when you also specify the PROTECTED phrase.
  2. The FILLER phrase initializes each character position of the input field with the character specified in prot-fill-lit. As you enter characters, the filler characters are replaced by your input. If you strike the delete key after you have entered data, the position made available by the delete operation is refilled with the character specified in prot-fill-lit. When you terminate the ACCEPT operation, any remaining filler characters are replaced by space characters.
  3. When you use the FILLER phrase with the NO BLANK phrase, the input field is filled with the character specified in prot-fill-lit, after you have entered the first character.
  4. The FILLER phrase is not allowed to be used with the EDITING phrase. If both are present, the FILLER phrase is ignored.

NO ECHO Phrase (Format 3)

  1. The NO ECHO phrase suppresses the display of input characters on the screen.
  2. When you do not use the NO ECHO phrase, valid input characters are displayed on the screen as they are typed.
  3. When the EDITING phrase is used, the field editing functions still take place, but the display field is not modified.

DEFAULT Phrase (Format 3)

  1. The DEFAULT phrase specifies default input values when no characters are entered from the terminal. Null input is signaled by entering a legal terminator key that is not preceded by data. (See the general rules for the CONTROL KEY phrase.)
  2. When the null input condition occurs, def-src-lit or the value of def-src-item is moved to dest-item according to theMOVE rules. When the move occurs, the specified default value is not displayed on the terminal screen.
  3. Conversion of the DEFAULT item will occur if CONVERSION is specified.
  4. When the EDITING phrase is used, the default value is displayed in the input field. The value can be blank-filled on the right or truncated, depending on the relative lengths of the default value and the input field.
  5. When the EDITING phrase is used and a terminator is entered, the contents of the input field are moved to dest-item according to the MOVE rules.

CURRENT VALUE Phrase (Format 3)

  1. The CURRENT VALUE phrase can be used only when you specify the DEFAULT phrase.
  2. The CURRENT VALUE phrase specifies that the default input value is the initial value of the ACCEPT destination item.
  3. The value of the ACCEPT destination item is the same as it was before the execution of the ACCEPT statement if all the following conditions exist:
  4. When you use the EDITING phrase, dest-item can be alphabetic, alphanumeric, or non-floating-point numeric. In this case, the input field is always updated to be what is on the screen. It cannot be numeric edited, alphanumeric edited, COMP-1, or COMP-2; if it is, the program will ignore the DEFAULT and CURRENT VALUE phrases.

CONTROL KEY Phrase (Format 3)

  1. When you use the CONTROL KEY phrase in Format 3, the operator must terminate data input with a legal terminator key. Ctrl/Z is a legal terminator if ON EXCEPTION or AT END is specified.
  2. When you do not use the CONTROL KEY phrase in Format 3, the operator can terminate data input only with RETURN or TAB.
  3. When the EDITING phrase is used, the keys which invoke field editing functions do not terminate the ACCEPT statement and are not stored in key-dest-item.

Format 4

  1. When any key other than a valid control key is entered: (1) the contents of key-dest-item do not change, and (2) the terminal bell rings. This occurs until a proper control key is entered.

Format 5

  1. The end-of-file indication is considered a normal, successful termination.
  2. The data in each field is converted and validated as you leave the field. The updated value is displayed in the field if the SECURE clause is not specified.
    Conversion occurs in the following instances:
    Validation occurs when the FULL or REQUIRED clauses are specified.
  3. The default value for each field is displayed when the operator enters the field for the first time during an ACCEPT statement. The default value is determined as follows:
  4. If the operator types a terminator key prior to entering data in every field, the default value for each untouched field is moved to the field's destination item.
  5. The operator is limited to entering the number of characters specified by the PICTURE clause. If the operator attempts to type beyond the rightmost position of the field: (1) the cursor remains on the position to the right of the rightmost position and (2) the last character of the field is overwritten with the new character.
  6. There are special keys that allow the operator to edit data within a field and to move among the fields within a screen. Except where noted otherwise, the operator is allowed to move among the fields in the order in which the fields are defined within the Screen Description Entry.
    The keys defined on OpenVMS Alpha systems are described in Table 6-10.

    Table 6-10 SCREEN SECTION Keys for OpenVMS Alpha Systems
    Key Description
    Left,
    Ctrl/B,
    Ctrl/D
    Move left (if not at beginning of field, move left within field; if at beginning of field, move to previous field).
    Right,
    Ctrl/F
    Move right (if not at end of field, move right within field; if at end of field, move to next field).
    Up Move to the nearest field that is positioned above the current cursor position; this movement ignores the order in which fields are defined within the Screen Description Entry and is based simply on the location of items on the screen.
    Down Move to the nearest field that is positioned below the current cursor position; this movement ignores the order in which fields are defined within the Screen Description Entry and is based simply on the location of items on the screen.
    Ctrl/P,
    Ctrl/L
    Move to previous field.
    TAB,
    Ctrl/N,
    Ctrl/I
    Move to next field.
    Ctrl/H,
    Ctrl/W
    Move to beginning of line (if at beginning of line within a multiple-line field, move to beginning of previous line).
    Ctrl/E Move to end of text (if at end of text within a multiple-line field, move to end of text on next line).
    Ctrl/A,
    Ctrl/T
    Toggle insert and overstrike mode (if $ SET NOCONTROL=T).
    Ctrl/K Erase to end of line (always performed in insert mode).
    Ctrl/U,
    Ctrl/X
    Erase to beginning of line (always performed in insert mode).
    CR,
    Ctrl/M,
    Ctrl/Z
    Terminate input. <>

    The keys defined on Tru64 UNIX and Windows NT systems are described in Table 6-11.

    Table 6-11 SCREEN SECTION Keys for Tru64 UNIX and Windows NT Systems
    Key Description
    Left,
    Ctrl/B,
    Ctrl/D
    Move left (if not at beginning of field, move left within field; if at beginning of field, move to previous field).
    Right,
    Ctrl/F
    Move right (if not at end of field, move right within field; if at end of field, move to next field).
    Up Move to the nearest field that is positioned above the current cursor position; this movement ignores the order in which fields are defined within the Screen Description Entry and is based simply on the location of items on the screen.
    Down Move to the nearest field that is positioned below the current cursor position; this movement ignores the order in which fields are defined within the Screen Description Entry and is based simply on the location of items on the screen.
    Ctrl/P,
    Ctrl/L
    Move to previous field.
    TAB,
    Ctrl/N,
    Ctrl/I
    Move to next field.
    Ctrl/A,
    Ctrl/H,
    Ctrl/W
    Move to beginning of line (if at beginning of line within a multiple-line field, move to beginning of previous line).
    Ctrl/E Move to end of text (if at end of text within a multiple-line field, move to end of text on next line).
    Ctrl/T Toggle insert and overstrike mode.
    Ctrl/K Erase to end of line (always performed in insert mode).
    Ctrl/U,
    Ctrl/X
    Erase to beginning of line (always performed in insert mode).
    CR,
    Ctrl/M
    Terminate input. <>

  7. The description of insert and overstrike editing for the EDITING Phrase (Format 3) also applies here.


Previous Next Contents Index