Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this message"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 >
Post Follow-up to this messageRick 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).
Post Follow-up to this messageHeyBub 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.
Post Follow-up to this messageDear 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
Post Follow-up to this messageOn 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.
Post Follow-up to this messageThanks 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
Post Follow-up to this messageBinyamin 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 ?
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.