Re: Layout Hell.
From: JerryMouse (nospam_at_bisusa.com)
Date: 07/16/04
- Next message: JerryMouse: "Re: Layout Hell."
- Previous message: Tom Morrison: "Re: Reading COBOL "data files""
- In reply to: Carol: "Re: Layout Hell."
- Next in thread: Carol: "Re: Layout Hell."
- Reply: Carol: "Re: Layout Hell."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Jul 2004 09:15:46 -0500
Carol wrote:
> Jerry, is there some table out there that lists all possible COBOL
> fields ( PIC X(3),PIC S9(9) ) and the number of bytes they take up,
> so that I can just copy and paste or even write a little script?
> thanks
No.
It's terribly confusing for the neophyte. Several CHAPTERS are necessary in
a COBOL manual to go through all the permutations. For your purposes,
though, you may consider:
PIC ("Picture") X(nn) to be "nn" bytes long.
If the picture line ends in COMP-something, you have to be attuned to your
operating system and compiler. In general:
COMP 9(1) through 9(4) use two bytes (binary half-word)
COMP 9(5) through 9(9) use four bytes (binary full-word)
With each of these, you must be aware of whether your machine stores the
data as big-endian or little-endian.
COMP-3 is Packed Decimal. The last half-byte stores the sign and the
least-significant digit (usually). All other bytes store two digits each.
Viz:
123 = 12 3+
1234 = 01 23 4+
12345 = 12 34 5+
123.45 = 12 34 5+
0.12345 = 12 34 5+
So! Where's the decimal point stored? There is no decimal point stored in
COMP fields. The program just has to KNOW where the decimal point belongs.
- Next message: JerryMouse: "Re: Layout Hell."
- Previous message: Tom Morrison: "Re: Reading COBOL "data files""
- In reply to: Carol: "Re: Layout Hell."
- Next in thread: Carol: "Re: Layout Hell."
- Reply: Carol: "Re: Layout Hell."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]