Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms
11.2 Designing Video Forms with ACCEPT and DISPLAY Statement Extensions
When you use the FILLER phrase with the NO BLANK phrase, the input field is
filled with the filler character only after you have entered the first character.
The PROTECTED SIZE phrase sets the size of the input field on the screen
and allows you to change the size of the input field from the size indicated by
the PICTURE phrase of the destination item. Example 11–7 and Figure 11–8
show how to use the SIZE phrase with the PROTECTED phrase. When the
example specifies SIZE 3, any attempt to enter more than three characters
makes the terminal bell ring. When the example specifies SIZE 10, the ACCEPT
statement includes the ON EXCEPTION phrase to warn you whenever you enter
a number that will result in truncation at either end of the assumed decimal
point. Figure 11–8 shows such an example in which the operator entered a 10-
digit number, exceeding the storage capacity of the data item NUM-DATA on the
left side of the assumed decimal point.
Note
The SIZE phrase controls only the number of characters you can enter;
it does not alter any other PICTURE clause requirements. Truncation,
space or zero filling, and decimal point alignment occur according to
MOVE statement rules only if CONVERSION is specified.
Example 11–7 Using the SIZE and PROTECTED Phrases
IDENTIFICATION DIVISION.
PROGRAM-ID.
PROTECT.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01
NUM-DATA
PIC S9(9)V9(9) COMP-3.
PROCEDURE DIVISION.
A00-BEGIN.
DISPLAY "Enter data item (NUM-DATA) but SIZE = 3:"
LINE 1 COLUMN 14
UNDERLINED
ERASE SCREEN.
PERFORM ACCEPT-THREE 5 TIMES.
DISPLAY "Same data item (NUM-DATA) BUT SIZE = 10:" LINE PLUS 3
COLUMN 14
UNDERLINED.
PERFORM ACCEPT-TEN 5 TIMES.
STOP RUN.
ACCEPT-THREE.
ACCEPT NUM-DATA WITH CONVERSION PROTECTED SIZE 3
LINE PLUS COLUMN 14.
ACCEPT-TEN.
ACCEPT NUM-DATA WITH CONVERSION PROTECTED SIZE 10
LINE PLUS COLUMN 14
ON EXCEPTION
DISPLAY "TOO MANY NUMBERS--try this one again!!!"
COLUMN PLUS
REVERSED
GO TO ACCEPT-TEN.
Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms 11–15
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......