Re: COBOL format definitions?
- From: "HeyBub" <heybubNOSPAM@xxxxxxxxx>
- Date: Fri, 29 Dec 2006 19:04:09 -0600
Barb wrote:
Hi all,
I'm not a COBOL programmer at all, but I am starting to work with data
that was given to me with a COBOL field format listing. I get most of
the format codes, but there are a few that I need to verify that I'm
understanding them correctly.
For example, I understand that PIC X(03) is an alpha/numeric field
with a length of 3 characters.
I also understand that PIC 9(03) is a numeric integer field with
numbers <= 999.
But I would like to find some sort of online listing or guide to help
me as I encounter other ones such as:
* PIC S9(09) COMP-3
Five bytes, +123456789 looks like 12 34 56 78 9+
* PIC 9(02)V9(04)
Six bytes, 12.3456 looks like 31 32 33 34 35 36 (in ASCII on a PC)
* PIC S9(07)V99 COMP-3
Five bytes. +1234567.89 looks like: 12 34 56 78 9+ (note you can't tell from
the record where the decimal point is located).
I don't need to program an import file (I know that SAS can convert a
COBOL copybook to a SAS informat), but I would like to sound half-way
intellegent with the people who provided the copybook when I have
questions about the files.
Can anyone point me to a good website that just explains the basics of
what these codes mean (there are others besides the 3 above that I
would like to be able to interpret).
You bet there are others besides DISPLAY (the default) and COMP-3.
Thanks for any help you can provide!
Barb
Barb, understanding PIC defintions is a non-trivial undertaking. If you
follow these rules, you should be okay...
1. If the PIC contains ONLY digits and/or Xs, allow 1 byte for each
character.
2. If the PIC contains ONLY digits and a "V," allow one byte for each
character and the "V" locates the decimal point.
3. If the PIC contains ONLY digits and an "S," either the first or (usually)
the last digit is "over-punched" with the sign.
4. If the PIC explicitly (or implicitly*) contains COMP-x, or contains
editting characters "$" "Z" "." "," "CR" "DB" or anything else not
immediately clear, ask us.
--------
* "implicitly" = the format of a numeric field defaults to USAGE DISPLAY
(one byte per digit). Other representations are possible such as 1, 2, 4, or
8 byte binary (in two varieties: little-endian or big-endian), 4 or 8 byte
floating-point, and the one that drives other languages nuts: PACKED
DECIMAL. See the COMP-3 examples above.
BUT
SAS specifications seem to be able to handle the standard USAGE renditions.
.
- References:
- COBOL format definitions?
- From: Barb
- COBOL format definitions?
- Prev by Date: Re: Variable Length Input File
- Next by Date: Re: Variable Length Input File
- Previous by thread: Re: COBOL format definitions?
- Index(es):
Relevant Pages
|
|