Microsoft KB Archive/32428

How ACCEPT Handles Numeric and Numeric-Edited Fields

PSS ID Number: Q32428 Article last modified on 11-16-1992

3.00 MS-DOS

Summary: This article discusses the following three forms of data entry for numeric and numeric-edited fields: 1. Fixed format or formatted 2. Free Format 3. RM style This information applies to Microsoft COBOL Version 3.00.

More Information: 1. Fixed format or formatted Fixed format or formatted can be best described as “What you see is what you get.” As each keystroke is pressed, the field is automatically reformatted to conform to the picture string. Therefore, ADIS tries to ensure that the field always looks on the screen the way it will be stored in the DATA DIVISION and its size will be the same as the size of the data item. During data entry, characters other than numeric digits (“+”, “-”, and the decimal point character) are rejected. Insertion characters in edited fields are automatically skipped over as the cursor is moved backwards and forwards. Any sign indicator is automatically modified if a “+” or “-” is pressed, regardless of where the cursor is in the field. Data entry of simple numerics and numeric-edited fields with no zero suppression is similar to that for alphanumeric fields, except that insert mode is not supported in numeric and numeric-edited fields. For example, a field defined as PIC 9(5) that is initially set up to contain zeros will be accepted as follows: Initial display 00000 Pressing 1 will give 10000 Pressing 2 will give 12000 Pressing 4 will give 12400 Pressing rubout will give 12000 Pressing “.” will give 00012 Data entry into numeric-edited or zero-suppressed fields is handled differently. If you wish to enter digits after the decimal point when there are integer places still unfilled, the decimal point must be entered. Otherwise, the cursor is automatically moved to the first decimal digit and the cursor advances as the decimal digits are entered. Fixed-format mode is only allowed on numeric-edited data items if they are less than 33 characters long. If they are longer than 32 characters, they are automatically handled in free-format mode. Fields are also automatically treated as free format if a SIZE clause is specified in the ACCEPT statement. 2. Free Format Free-format mode can be selected for either numeric fields or numeric-edited fields or both. This can be done using ADISCF (Accept/Display options 13 and 14). During data entry into a free-format field, the field is treated as a PIC X field of the appropriate length. It is only when the user leaves the field that it is reformatted to comply with the picture string. Any characters other than the digits, the sign character, and the decimal point character are discarded. Fields occupy the same number of characters on the screen as they do bytes in memory, with the exception that an additional character is allocated for implied spaces and decimal points. Therefore, a data item defined as PIC S99V99 will occupy six characters on the screen in free-format mode, as opposed to four characters in fixed-format mode. Data entry is the same as for alphanumeric fields. If a format 2 ACCEPT is being used, the clauses SPACE-FILL, ZERO-FILL, LEFT-JUSTIFY, RIGHT-JUSTIFY and TRAILING-SIGN are applicable only to free-format nonedited fields. 3. RM style This mode is selected using Accept/Display option 18 in ADISCF. It is provided for emulation of numeric and numeric-edited ACCEPTs in Ryan Mcfarland COBOL Version 2.00. If this mode is selected, all other Accept/Display options that control numeric and numeric-edited data entry are ignored. This style of numeric input is not intended for use with Microsoft COBOL Version 3.00 screen handling syntax; it is intended for use only with code originally written in Ryan Mcfarland COBOL. Data entry is the same as for alphanumeric fields. The following are general notes concerning accepting data into fields: 1. If a field is so large that it will not fit onto one line on the screen, it is split into separate subfields at run time. Each subfield will fit entirely onto one line. The cursor automatically skips to the next subfield at the end of one subfield, regardless of the setting of any auto-skip controls. 2. If a field extends beyond the end of the screen, the action taken depends on the type of field involved, as follows: a. Alphanumeric fields are truncated to a size that will fit on the screen. b. Numeric and numeric-edited fields are treated as if they were defined as FILLER (i.e., not a field).

Copyright Microsoft Corporation 1992.