-
Notifications
You must be signed in to change notification settings - Fork 0
/
exm20.cbl
69 lines (61 loc) · 2.84 KB
/
exm20.cbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
*****************************************************************
* *
* This software have been developed under GNU GPL v3 License. *
* That means, no closed distribution of this software is *
* allowed. *
* *
* Please refer to the License text here: *
* https://www.gnu.org/licenses/gpl-3.0.txt *
* *
* For any comment, suggestion or similar, you can reach me via *
* mail on "doscar.sole@gmail.com" *
* *
*****************************************************************
ID DIVISION.
PROGRAM-ID. EXM20.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 VARIABLES.
02 INTERRUPTOR-1 PIC 9(02) VALUE 2.
88 INT-CINCO VALUE 5.
88 INT-1-CIFRA VALUE 0 THRU 9.
88 INT-2-CIFRA VALUE 10 THRU 99.
88 INT-PAR VALUE 0, 2, 4, 6, 8, 10.
88 INT-IMPAR VALUE 1 3 5 7 9.
88 INT-PROHIBIDO VALUE 11 THRU 80.
02 EDAD PIC 9(03).
02 PAIS PIC X(03).
PROCEDURE DIVISION.
MAINLINE.
DISPLAY 'INICIO DEL PROGRAMA'.
DISPLAY 'VALOR INCIAL: ' INTERRUPTOR-1.
DISPLAY 'INTERRUPTOR: '.
ACCEPT INTERRUPTOR-1 FROM SYSIN.
DISPLAY 'EDAD: '.
ACCEPT EDAD FROM SYSIN.
DISPLAY 'PAIS: '.
ACCEPT PAIS FROM SYSIN.
EVALUATE TRUE
WHEN INT-CINCO
DISPLAY 'CINCO'
WHEN INT-1-CIFRA
DISPLAY 'UNA CIFRA'
WHEN INT-2-CIFRA
DISPLAY 'DOS CIFRAS'
WHEN INT-PAR
DISPLAY 'PAR'
WHEN INT-IMPAR
DISPLAY 'IMPAR'
WHEN INT-PROHIBIDO
DISPLAY 'PROHIBIDO'
WHEN OTHER
DISPLAY 'CASO NO CONTEMPLADO: ' INTERRUPTOR-1
END-EVALUATE.
EVALUATE TRUE ALSO PAIS
WHEN (EDAD >= 18) ALSO 'ESP'
DISPLAY 'MAYOR DE EDAD'
WHEN (EDAD >= 21) ALSO ANY
DISPLAY 'MAYOR DE EDAD'
WHEN OTHER
DISPLAY 'MENOR DE EDAD'
END-EVALUATE.