beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 406

background image

Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms
11.2 Designing Video Forms with ACCEPT and DISPLAY Statement Extensions

Figure 11–8 Screen Display of NUM-DATA Using the PROTECTED Option

12345678901234567890123456789012345678901234567890123456789012345678901234567890

4

1

2

3

5

6

7

8

1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

ZK−6109−GE

Enter data item (NUM−DATA) but SIZE = 3:
1
999
1.1
.12
.99

Same data item (NUM−DATA) BUT SIZE = 10:
1234567890
123456789
123456789.
1.23456789
.123456789
12345.6789

TOO MANY NUMBERS−−try this one again!!!

When you do not use the PROTECTED phrase, the amount of data transferred is
determined according to the ACCEPT statement rules. (See the Compaq COBOL
Reference Manual
.)

11.2.5.4 Using NO ECHO with ACCEPT Data

By default, the characters you type at the terminal are displayed on the screen.
Example 11–8 shows how you can use the NO ECHO phrase to prevent the
input field from being displayed; thus, the NO ECHO phrase allows you to keep
passwords and other information confidential.

Example 11–8 Using the NO ECHO Phrase

IDENTIFICATION DIVISION.
PROGRAM-ID.

NOSHOW.

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01

PASSWORD PIC X(25).

PROCEDURE DIVISION.
A00-BEGIN.

DISPLAY "ENTER YOUR PASSWORD: " LINE 5 COLUMN 10

ERASE SCREEN.

ACCEPT PASSWORD WITH NO ECHO.
STOP RUN.

11.2.5.5 Assigning Default Values to Data Fields

Use the DEFAULT phrase to assign a value to an ACCEPT data item whenever:

The program requires a value, and the operator does not have a value for the
data item.

11–16 Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms