× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Eric,

I think I've spotted the problem.

In the DDS for your file, you define your amount as

        A            TRANSAMT       7P 2       ALIAS(CT_TRANSACTION_AMOUNT)

This defines a 7 digit packed field with two positions to the right of the
decimal point (leaving five positions to the left of the decimal point).

In your COBOL program, you define your amount as

        05  CT-TRANSACTION-AMOUNT       PIC 9(7)V99 PACKED-DECIMAL.

This defines a packed field with seven positions to the left of the decimal
point and two positions to the right of the decimal point.

Here is the part of the dump that shows CT-TRANSACTION-AMOUNT, which
identifies it as a PACKED(9,2) field.

CT-TRANSACTION-AMOUNT       000043  PACKED(9,2)
                                  **INVALID DATA  '0045678F40'X

If you look at the hex value of the field, the first 8 hex digits are
'0045678F' which matches the 456.78 that was entered for the Mark Henry
record.

Here's the "gotcha"! In DDS you define the total field length and then
specify how many of those positions are to the right of the decimal point.
In COBOL you define how many positions are on either side of the decimal
point.

To fix the problem, you can change the DDS to

        A            TRANSAMT       9P 2       ALIAS(CT_TRANSACTION_AMOUNT)

OR change the COBOL code to

        05  CT-TRANSACTION-AMOUNT       PIC 9(5)V99 PACKED-DECIMAL.

Hope this helps!
Richard Casey



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.