-
Notifications
You must be signed in to change notification settings - Fork 0
/
Datatypes.cbl
38 lines (37 loc) · 1.43 KB
/
Datatypes.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
******************************************************************
* Author:Lawrence Wilson
* Date: 9/18/24
* Purpose: Learning data types and MOVE verb
* Tectonics: cobc
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. YOUR-PROGRAM-NAME.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 Num1 PIC 999 VALUE ZEROS.
01 Num2 PIC 999 VALUE 15.
01 TaxRate PIC V99 VALUE .35.
01 CustomerName PIC X(15) VALUE "Mike".
01 Surname PIC x(8) VALUE "COUGHLAN".
01 SalePrice PIC 9(4)V99.
PROCEDURE DIVISION.
MAIN-PROCEDURE.
MOVE "SMITH" TO Surname.
DISPLAY "Surname = ",Surname.
MOVE "FITZWILLIAM" TO Surname.
DISPLAY "Surname = ",Surname.
*> This is a perfect example of truncation taking place for alphanumeric values
MOVE ZEROS TO SalePrice.
DISPLAY SalePrice.
MOVE 25.5 TO SalePrice.
DISPLAY SalePrice.
MOVE 7.553 TO SalePrice.
DISPLAY SalePrice.
MOVE 93425.157 TO SalePrice.
DISPLAY SalePrice.
MOVE 128 TO SalePrice.
DISPLAY SalePrice.
*> When moving numeric value be wary of the decimal place
STOP RUN.
END PROGRAM YOUR-PROGRAM-NAME.