From the course: COBOL Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Comp-3 data types - COBOL Tutorial
From the course: COBOL Essential Training
Comp-3 data types
- [Instructor] It was a common practice in the 1980s to store numbers in what they call a packed decimal format, to save space on a file. In COBOL, we use the data usage clause comp-3 to indicate a packed decimal. Packed decimal format means that each byte of storage, except the low order byte can contain two decimal numbers. The low order byte contains one digit in the leftmost portion and the sign whether it's positive or negative in the rightmost portion. Here's an example representing the decimal number 21544. You can see it only takes up three bytes, which saves a lot of space. By using comp-3, we were able to compress numeric field into roughly half their size. This is especially useful in situations where we had to add a field to an existing file and there wasn't much space left to play with. If you convert an existing field to comp-3, you have additional space for other values. Comp-3 is also used to avoid rounding…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
COBOL naming standards4m 9s
-
(Locked)
How to define types of data4m 37s
-
(Locked)
Comp-3 data types3m 40s
-
(Locked)
Literal and figurative constants4m 48s
-
(Locked)
Editing characters for writing reports5m 27s
-
(Locked)
Challenge: Create a sales commission report1m 33s
-
(Locked)
Solution: Commission report solution5m 59s
-
-
-
-
-
-
-
-
-