KR editions 93 to 96
KR-93 (cutting tips)
We'll take a short break from our management series and go into some techie stuff. Did you know that we have clipboards in mainframes! Did you ever wonder about the DEFAULT in the message "5 lines cut to DEFAULT"? KR contributed by Latha: The CUT and PASTE commands
That's all for this edition and this week....suggestions and contributions welcome; Have a great weekend.
KR-94 (COBOL pics)
The way cobol stores numbers tends to get confusing. We'll establish some basics about storage of numbers and then tackle the questions. A few questions: If I move -8 to a PIC S9(1) variable and display this in my spool it shows: Q. If I move 8 to a PIC S9(1) variable then it shows H. If I move 8 to a PIC 9(1) variable then it shows 8. Why? KR idea triggered by Elan and Divya:
How is a PIC 9(1) stored?
Try it out: just open an empty flat file and type a digit. Then on the command line type HEX ON and you'll know how a display digit is stored (note: 1111 = F in hexadecimal format). So if you typed 6 in the flat file and entered 'hex on' you'd see F6 on the screen - which equals 1111 0110. What about an S9(2)?
This edition is getting long so we'll continue tomorrow.....
KR-95 (COBOL pics II)
Continuing where we left off in our discussion on S9(2) and 9(2).....
That covers the storage aspect of 9(2) and S9(2). Now we'll take a look at what happens when we display these values on screen.
That should help answer yesterday's questions: 1.) A +8 stored in an S9(1) is stored as 1100 1000 (this corresponds to H). Thus when we display this in the spool we would see the character H and not +8 or 8. 2.) Similarly, a -8 in an S9(1) is stored as 1101 1000 (or D8 in hexa) and through EBCDIC decoding we'll arrive at the character Q. 3.) But an 8 stored in a PIC 9(1) is stored as 1111 1000 of F8 which in EBCDIC represents the character '8' itself.
That's all for this edition.....
KR-96 (COBOL numerics)
A short KR to round up the week.
To sum up our discussion, the different ways of representing numerics in COBOL are: 1.) DISPLAY - numerics in display type are also called zoned decimal (remember we talked about 4 dummy bits in every byte of a numeric; these 4 dummy bits are called the "zone bits" while the last 4 bits are the digit bits). There are 2 numeric types in display format: signed and unsigned; i.e. 9(2) or S9(2). 2.) PACKED DECIMAL or COMP-3 3.) Binary or COMP or COMP-4 4.) COMP-1 5.) COMP-4
Well, that's all for this edition and this week; have a great weekend (suggestions and contributions welcome);
Go back to the main contents page
Copyright © 2020 Sethu Subramanian All rights reserved. Reach me via email at ssbell @ gmail.com