Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Interpreting a COBOL numeric field in a raw, fixed width TXT file
Hi,

Please forgive me if this question is too basic.  I've done quite a bit
of searching for an answer without any luck.

I am trying to understand a numeric amount field in a publicly
available federal election campaign finance file from the FEC web site
so that I might correctly load it into various databases.  I won't be
using COBOL to do any of the data loading.

In the raw, fixed width, text form of this data, there is a 7 character
numeric field described like this by the FEC:

"In the fixed width text file, the amounts
are in COBOL format. If the value is negative,
the right most column will contain a special
character:  ] = -0, j = -1, k = -2, l = -3,
m = -4, n = -5, o = -6, p = -7, q = -8,
and r = -9.

In the database file, the amount field contains
positive and negative integers."

I don't understand this explanation. Does anything other than a "]"
indicate the decimal should be shifted for the negative number?

This demonstrates my poor understanding:

"0000100" would be + 100
"000100]" would indicate a negative number, but would it be: - 100?
"000100r" would also indicate a negative number, but how would it be
different from the example above?

Any help on this issue will be very appreciated!

- Thanks,

Craig

Reference: ftp://ftp.fec.gov/FEC/indiv06.txt


Report this thread to moderator Post Follow-up to this message
Old Post
craig
01-10-07 11:55 PM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
"craig" <craigfmitchell@gmail.com> wrote in message
news:1168464083.491639.98290@k58g2000hse.googlegroups.com...
> Hi,
>
> Please forgive me if this question is too basic.  I've done quite a bit
> of searching for an answer without any luck.
>
> I am trying to understand a numeric amount field in a publicly
> available federal election campaign finance file from the FEC web site
> so that I might correctly load it into various databases.  I won't be
> using COBOL to do any of the data loading.
>
> In the raw, fixed width, text form of this data, there is a 7 character
> numeric field described like this by the FEC:
>
>      "In the fixed width text file, the amounts
>      are in COBOL format. If the value is negative,
>      the right most column will contain a special
>      character:  ] = -0, j = -1, k = -2, l = -3,
>      m = -4, n = -5, o = -6, p = -7, q = -8,
>      and r = -9.
>
>      In the database file, the amount field contains
>      positive and negative integers."

The characters shown for negative values are actually
the lower case equivalent of the representation of
zoned decimal as they appear in EBCDIC. These are
not a valid COBOL format for any COBOL
implementation I am aware of.

> I don't understand this explanation. Does anything other than a "]"
> indicate the decimal should be shifted for the negative number?
>
> This demonstrates my poor understanding:
>
> "0000100" would be + 100
> "000100]" would indicate a negative number, but would it be: - 100?
> "000100r" would also indicate a negative number, but how would it be
> different from the example above?

When the last position contains a number, place a "+"
before the number.

When the last position contains one of the characters
shown, place a "-" before the number and replace the
character with the correcsponding digit.

"0000100" becomes "+0000100"
"000100]" becomes "-0001000"
"000100r" becomes "-0001009"

Then use the resulting translation.

> Any help on this issue will be very appreciated!
>
>        - Thanks,
>
>                Craig
>
> Reference: ftp://ftp.fec.gov/FEC/indiv06.txt
>





Report this thread to moderator Post Follow-up to this message
Old Post
Rick Smith
01-10-07 11:55 PM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
Rick Smith wrote:

>
> The characters shown for negative values are actually
> the lower case equivalent of the representation of
> zoned decimal as they appear in EBCDIC. These are
> not a valid COBOL format for any COBOL
> implementation I am aware of.

The representation is valid for all forms of COBOL wherein the PIC used is
S9(7).



Report this thread to moderator Post Follow-up to this message
Old Post
HeyBub
01-11-07 02:55 AM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
HeyBub wrote:
> Rick Smith wrote:
 
> 
>
> The representation is valid for all forms of COBOL wherein the PIC used is
> S9(7).

What do you mean by 'all' ?  It seems to match none that I know of.
Those characters will certainly be invalid for the ASCII compilers that
I am familiar with and are not the ones that I would associate with
EBCDIC - my references only show '}' and upper-case letters.

Then there may be some of the 'all forms of COBOL' where they use
something completely different for negative.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
01-11-07 08:55 AM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
Dear Craig,

I cannot read the file ftp://ftp.fec.gov/FEC/indiv06.txt. However, I
guess that the negative value is talking about the exponent of the
amount. That is, the decimal place of the amount.
How, do you think?

Yours sincerely,
George

craig =BCg=B9D=A1G

> Hi,
>
> Please forgive me if this question is too basic.  I've done quite a bit
> of searching for an answer without any luck.
>
> I am trying to understand a numeric amount field in a publicly
> available federal election campaign finance file from the FEC web site
> so that I might correctly load it into various databases.  I won't be
> using COBOL to do any of the data loading.
>
> In the raw, fixed width, text form of this data, there is a 7 character
> numeric field described like this by the FEC:
>
>      "In the fixed width text file, the amounts
>      are in COBOL format. If the value is negative,
>      the right most column will contain a special
>      character:  ] =3D -0, j =3D -1, k =3D -2, l =3D -3,
>      m =3D -4, n =3D -5, o =3D -6, p =3D -7, q =3D -8,
>      and r =3D -9.
>
>      In the database file, the amount field contains
>      positive and negative integers."
>
> I don't understand this explanation. Does anything other than a "]"
> indicate the decimal should be shifted for the negative number?
>
> This demonstrates my poor understanding:
>
> "0000100" would be + 100
> "000100]" would indicate a negative number, but would it be: - 100?
> "000100r" would also indicate a negative number, but how would it be
> different from the example above?
>
> Any help on this issue will be very appreciated!
>
>        - Thanks,
>
>                Craig
>=20
> Reference: ftp://ftp.fec.gov/FEC/indiv06.txt


Report this thread to moderator Post Follow-up to this message
Old Post
George
01-11-07 08:55 AM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
On 11 Jan 2007 00:20:49 -0800 "Richard" <riplin@Azonic.co.nz> wrote:

:>HeyBub wrote:
:>> Rick Smith wrote:

:>>>    "In the fixed width text file, the amounts
:>>>     are in COBOL format. If the value is negative,
:>>>     the right most column will contain a special
:>>>     character:  ] = -0, j = -1, k = -2, l = -3,
:>>>     m = -4, n = -5, o = -6, p = -7, q = -8,
:>>>     and r = -9.

:>> > The characters shown for negative values are actually
:>> > the lower case equivalent of the representation of
:>> > zoned decimal as they appear in EBCDIC. These are
:>> > not a valid COBOL format for any COBOL
:>> > implementation I am aware of.

:>> The representation is valid for all forms of COBOL wherein the PIC used 
is
:>> S9(7).

:>What do you mean by 'all' ?  It seems to match none that I know of.
:>Those characters will certainly be invalid for the ASCII compilers that
:>I am familiar with and are not the ones that I would associate with
:>EBCDIC - my references only show '}' and upper-case letters.

:>Then there may be some of the 'all forms of COBOL' where they use
:>something completely different for negative.

PIC S9(whatever) has the last character defined as carrying the sign.

One would not do a

MOVE 99J TO SIGNED-FIELD

one would do

MOVE -991 TO SIGNED-FIELD

--
Binyamin Dissen <bdissen@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

Report this thread to moderator Post Follow-up to this message
Old Post
Binyamin Dissen
01-11-07 11:55 PM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
Thanks Rick and everyone else.  The explanation Rick gave:

When the last position contains one of the characters
shown, place a "-" before the number and replace the
character with the correcsponding digit.

"0000100" becomes "+0000100"
"000100]" becomes "-0001000"
"000100r" becomes "-0001009"

makes a lot of sense to me, and now I've heard it from more than one
source.  Thanks for all of your efforts.  This group is great!

- Craig


Report this thread to moderator Post Follow-up to this message
Old Post
craig
01-11-07 11:55 PM


Re: Interpreting a COBOL numeric field in a raw, fixed width TXT file
Binyamin Dissen wrote:
> On 11 Jan 2007 00:20:49 -0800 "Richard" <riplin@Azonic.co.nz> wrote:
>
> :>HeyBub wrote:
> :>> Rick Smith wrote:
>
> :>>>    "In the fixed width text file, the amounts
> :>>>     are in COBOL format. If the value is negative,
> :>>>     the right most column will contain a special
> :>>>     character:  ] = -0, j = -1, k = -2, l = -3,
> :>>>     m = -4, n = -5, o = -6, p = -7, q = -8,
> :>>>     and r = -9.

> One would not do a
>
>      MOVE 99J TO SIGNED-FIELD
>
> one would do
>
>      MOVE -991 TO SIGNED-FIELD

And on which system would you get _lower-case_ 'j' in the last postion ?


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
01-11-07 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:55 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.