[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index


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:
    • For fixed point numeric, too many characters on either side of the decimal point. (The PICTURE clause of dest-item determines this overflow condition.)
    • For floating-point numeric, an exponent outside the valid range:
      • For IEEE double format (T_floating format) and G_floating format, the valid range is +308 to -308.
      • For IEEE single format (S_floating format), D_floating format, and F_floating format, the valid range is +38 to -38.
    • Invalid numeric data (for both fixed and floating-point numeric).

    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:
    • ZEROES (or spaces if BLANK WHEN ZERO is specified) are moved to a numeric or numeric edited dest-item, if you do not specify the DEFAULT phrase.
    • SPACES are moved to an alphanumeric or alphanumeric edited dest-item, if you do not specify the DEFAULT phrase.
    • However, the default value is moved to dest-item, if you do specify the DEFAULT phrase.

    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:
    • If the operator attempts to type beyond the rightmost position of the input field: (1) the terminal bell rings, (2) the cursor remains on the position to the right of the rightmost position, and (3) character entry attempts beyond the rightmost position are not echoed to the terminal screen.
    • If the operator attempts to delete beyond the leftmost position of the input field: (1) the terminal bell rings, and (2) the cursor remains on the leftmost position.
  4. If you use the PROTECTED phrase without the SIZE phrase, the maximum number of characters that the operator can enter is as follows:
    • The number of characters in a fixed point dest-item
    • Thirteen, if dest-item is COMP-1 F_floating format or IEEE S_floating format
    • Twenty two, if dest-item is COMP-2 D_floating or G_floating format or IEEE T_floating format

    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. On OpenVMS systems, the EDITING phrase enables keys to perform field editing functions, described in Table 6-8.

    Table 6-8 Field Editing Keys for OpenVMS 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 systems, the EDITING phrase enables the keys described in Table 6-9.

    Table 6-9 Field Editing Keys for Tru64 UNIX 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.


Previous Next Contents Index