input and output fields need to keep decimal



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

input and output fields need to keep decimal

Postby basmith11 » Fri Feb 17, 2012 11:01 pm

How can I add up the fields and get the same output including the decimal???
58335.26
41186.55
47051.15
50015.01
21595.61

currently defined as alpha
ACCT-AMT-H 140 11 A
ACCT-AMT-DOLS-H 140 8 A
ACCT-AMT-CENT-H 149 2 A

TOT-AMT-HOLD W 11 N 2
TOT-AMT-DOLS W 9 N
TOT-AMT-CENT W 2 N 2

How do I bring them back together like using COBOL levels in working storage
01 TOT-AMT.
05 TOT-AMT-DOLS PIC 9(9).
05 TOT-AMT-CENT PIC v99.
MOVE ACCT-AMT-DOLS-H TO TOT-AMT-DOLS.
MOVE ACCT-AMT-CENT-H TO TOT-AMT-CENT.

TOT-AMT-HOLD = TOT-AMT-HOLD + TOT-AMT.
basmith11
 
Posts: 11
Joined: Fri Feb 10, 2012 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: input and output fields need to keep decimal

Postby BillyBoyo » Sat Feb 18, 2012 1:08 am

In your sample data you are showing an actual decimal point, not an implicit one. Was that just for us?

If yes, then:

ACCT-AMT-H-NUMERIC ACCT-AMT-H 11 N 2


If it is an actual decimal point, let us know, as you need to do something quite different (note, this would not match the Cobol definitions you have shown).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: input and output fields need to keep decimal

Postby basmith11 » Sat Feb 18, 2012 1:09 am

Yes, it is an actual decimal on the input file.
basmith11
 
Posts: 11
Joined: Fri Feb 10, 2012 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: input and output fields need to keep decimal

Postby BillyBoyo » Sat Feb 18, 2012 1:20 am

Well, your Cobol is wrong as well, then. Do you need that fixing?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: input and output fields need to keep decimal

Postby BillyBoyo » Sat Feb 18, 2012 1:27 am

First, note that your field has "shrunk" in size, to remove the decimal point.

TOT-AMT-HOLD            W     10  N  2
TOT-AMT-DOLS            TOT-AMT-HOLD     8  A   
TOT-AMT-CENT            TOT-AMT-HOLD +8 2  A   


Personally, I'd

  1. Use an S not a W
  2. Prefix the datanames with S-
  3. Test that the numbers are numeric
  4. Test the undefined position on your input file, to see that it is actually a "."
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: input and output fields need to keep decimal

Postby basmith11 » Sat Feb 18, 2012 2:03 am

Thank you everyone, I finally got it to work.....
basmith11
 
Posts: 11
Joined: Fri Feb 10, 2012 7:16 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post