Compaq COBOL
Reference Manual
NOT ON EXCEPTION Phrase (Format 5, Alpha) 
  - 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 and 4; and Formats  5,  7, and 8, Alpha) 
  -  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) 
  - The AT END phrase allows execution of an imperative statement when 
  an end-of-file condition occurs.
  
- AT END and ON EXCEPTION are mutually exclusive.
  
- 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) 
  - 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) 
  - The UNDERLINED phrase echoes input characters to the terminal with 
  the underscore on character attribute.
  
- When you use the UNDERLINED phrase with the PROTECTED phrase, the 
  input field is underlined prior to accepting data.
BOLD Phrase (Format 3) 
  - The BOLD phrase echoes input characters to the terminal with the 
  bold on character attribute.
  
- 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) 
  - The BLINKING phrase echoes input characters to the terminal with 
  the blink on character attribute.
  
- 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) 
  - The REVERSED phrase echoes input characters to the terminal with 
  the reverse video on character attribute.
  
- 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) 
  - 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.)
  
- When dest-item is numeric or numeric edited (other than 
  floating point), the CONVERSION phrase:
  
    - Converts input numeric data to a numeric literal (TRAILING SEPARATE 
    SIGNED DISPLAY DECIMAL)
    
- Moves the result to dest-item (using MOVE statement rules)
  
 
- When dest-item is floating point, the CONVERSION phrase:
  
    - Converts input data to floating point (COMP-1 or COMP-2 as 
    appropriate).
    
- Moves the converted result to the destination as if a numeric 
    literal equivalent to the input data was moved to the destination with 
    the MOVE statement.
  
 
- When dest-item is numeric or numeric edited (other than 
  floating point), and you use the CONVERSION phrase, valid input 
  characters are as follows:
  
    - 0 to 9
    
- Period (.), unless DECIMAL POINT IS COMMA is specified
    
- Comma (,), if DECIMAL POINT IS COMMA is specified
    
- Space (leading and trailing)
    
- Sign (+ or -)
  
 
 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.
- When dest-item is floating point, and you use the 
  CONVERSION phrase, valid input characters are as follows:
  
    -  <zero or more blanks>
    
-  <"+", "-", or null>
    
-  <zero or more decimal digits>
    
-  <"." or null> if DECIMAL POINT IS COMMA then 
    <"," or null>
    
-  <zero or more decimal digits>
    
-  <exponent or null> where exponent is:
 <"E" or "e">
 <zero or more blanks>
 <"+" or "-" or null>
 or
 <"+" or "-">>
 <zero or more decimal digits>>
 
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 
 | 
  - 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.
- 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.
- 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.
- 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) 
  - The PROTECTED phrase limits the number of characters that can be 
  entered from the terminal.
  
- 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.
- 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.
  
 
- 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.
- 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.
  
- 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.
  
- 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) 
  - You can use the SIZE phrase only when you also specify the 
  PROTECTED phrase.
  
- 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.
  
- Data input results are undefined if the program generates a value 
  for prot-size-item that is zero or negative.
AUTOTERMINATE Phrase (Format 3) 
  - You can use the AUTOTERMINATE phrase only when you also specify the 
  PROTECTED phrase.
  
- 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.
  
- 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) 
  - You can use the NO BLANK phrase only when you also specify the 
  PROTECTED phrase.
  
- 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) 
  - You can use the EDITING phrase only when you also specify the 
  PROTECTED phrase.
  
- 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 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 <> |  
 
- 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.
- 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.
  
- 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) 
  - You can use the FILLER phrase only when you also specify the 
  PROTECTED phrase.
  
- 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.
  
- 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.
  
- 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) 
  - The NO ECHO phrase suppresses the display of input characters on 
  the screen.
  
- When you do not use the NO ECHO phrase, valid input characters are 
  displayed on the screen as they are typed.
  
- When the EDITING phrase is used, the field editing functions still 
  take place, but the display field is not modified.
DEFAULT Phrase (Format 3) 
  - 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.)
  
- 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.
  
- Conversion of the DEFAULT item will occur if CONVERSION is 
  specified.
  
- 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.
  
- 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) 
  -  The CURRENT VALUE phrase can be used only when you specify the 
  DEFAULT phrase.
  
-  The CURRENT VALUE phrase specifies that the default input value is 
  the initial value of the ACCEPT destination item.
  
-  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:
  
    - You specify the CURRENT VALUE phrase.
    
- The EDITING phrase is not used.
    
- The default path is taken.
  
 
-  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) 
  -  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.
  
-  When you do not use the CONTROL KEY phrase in Format 3, the 
  operator can terminate data input only with RETURN or TAB.
  
-  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 
  -  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 
  -  The end-of-file indication is considered a normal, successful 
  termination.
  
-  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:
    - If the field is not numeric and the JUSTIFIED clause is specified, 
    the data is right-justified.
    
- If the field is numeric or numeric edited, the data is formatted 
    according to the PICTURE, SIGN, and BLANK WHEN ZERO clauses. This 
    formatting is always successful because only the following characters 
    from the data are formatted:
    
      - 0--9
      
- Period (.), if DECIMAL POINT IS COMMA is not specified
      
- Comma (,), if DECIMAL POINT IS COMMA is specified
      
- Sign (+, - , DB, db, CR, or cr)
    
 
 Note that only the first occurrence of the period, comma and sign 
      is accepted; multiple occurrences are ignored. Also, to the left and 
      right of the decimal point excess leftmost digits and excess rightmost 
      digits are truncated, respectively.
 
 Validation occurs when the FULL or REQUIRED clauses are specified.
-  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:
  
    - If the USING clause is specified, the default is the current value 
    of the USING item.
    
- If the TO and FROM clauses are specified, the default is the 
    current value of the FROM item.
    
- If only the TO clause is specified:
    
      - The default is ZEROES (or SPACES if BLANK WHEN ZERO is specified) 
      for numeric and numeric edited items.
      
- The default is SPACES for alphabetic, alphanumeric, and 
      alphanumeric edited items.
    
 
 
-  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.
  
-  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.
  
-  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 systems are described in 
    Table 6-11.
 
  Table 6-11 SCREEN SECTION Keys for Tru64 UNIX 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. <> |  
 
-  The description of insert and overstrike editing for the EDITING 
  Phrase (Format 3) also applies here.