File: test.cbl

package info (click to toggle)
shared-mime-info 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,528 kB
  • sloc: ansic: 3,791; xml: 2,177; python: 168; sh: 119; javascript: 113; lisp: 28; cobol: 20; makefile: 14; cs: 13; perl: 11; java: 7; objc: 6; php: 1; vhdl: 1
file content (25 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (19)
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
       IDENTIFICATION DIVISION.
       PROGRAM-ID. Age.
       AUTHOR. Fernando Brito.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Age               PIC 99   VALUE ZEROS.
       01  Had_Birthday      PIC X    VALUE SPACES.
       01  Current_Year      PIC 9999 VALUE 2010.
       01  Result            PIC 9999 VALUE ZEROS.

       PROCEDURE DIVISION.
          DISPLAY "==> How old are you?".
          ACCEPT Age
          DISPLAY "==> Had you already had birthday this year (y or n)?".
          ACCEPT Had_Birthday

          SUBTRACT Current_Year FROM Age GIVING Result

          IF Had_Birthday = "n" THEN
            SUBTRACT 1 FROM Result GIVING Result
          END-IF

          DISPLAY "Let me guess... "" You were born in ", Result
          STOP RUN.