Help for Packed Decimal



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

Help for Packed Decimal

Postby aripalli » Mon Jan 30, 2012 2:07 pm

I am new to Eazytrieve, need help if this is duplication of any ones earlier question please don’t get angry and please answer my question.
I am reading IMS database with Easytrieve, I have a fields defined as S9(3)V9(2) comp-3 and this value should be written to the output file as ex 50.00/100.00 where ever value is present.
I defined the Output file as below
OUT-PCT 6 A

And Working storage variable as
W-PCTN W 6 A
W-PCT1 W-PCTN 3 P 2

In move is mentioned as

W-PCT1 = BUY-PERCENT (Read from Database)
OUT-PCT = W-PCTN

But I am getting the error message as
*******B055 INVALID LENGTH, TYPE OR DECIMAL PLACES for BUY-PERCENT.

Could someone please tell me how I should define the variables in Working-storage and the File output field.

Thanks & Regards,
Girish a
aripalli
 
Posts: 5
Joined: Sun Jan 29, 2012 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help for Packed Decimal

Postby BillyBoyo » Mon Jan 30, 2012 2:20 pm

What do you want your output on your file to look like, exactly? Do you want an actual decimal place or an implied decimal place?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Help for Packed Decimal

Postby aripalli » Mon Jan 30, 2012 2:53 pm

As the fields is required exactly as it is in the database, with decimal place.
The complete database layout is actually stored as Panvalet, this specifc filed BUY-PERCENT is mentioned as 3 A. Buy using this layout only i am trying to read the data. Not sure because this filed is defined as A in layout and comp-3 variable in actual database is resulting the problem
aripalli
 
Posts: 5
Joined: Sun Jan 29, 2012 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help for Packed Decimal

Postby BillyBoyo » Mon Jan 30, 2012 3:14 pm

You have to do something like the following. Easytrieve only expects "numeric edited" fields on printed output, not on files. So you have to do it yourself. You have some extra because on the DB it is 3 A, not 3 P 2, so you have to make it that in your "library section".

It seems a long way round, but necessary to avoid getting signs added to the fields (an Easytrieve field with decimal places is signed).

This is a "basic" way of doing it. Include the code. Test it. Understand it. Document it so someone looking at it later (might even be you) knows what is going on.

W-ALPHA-PACKED W 3 A
W-PACKED W-ALPHA-PACKED 3 P 2

W-DECIMAL-PART-FROM-PACKED W 2 N 2
W-DECIMAL-AS-INTEGER W-DECIMAL-PART-FROM-PACKED 2 N

W-OUT-WITH-DECIMAL-PLACE W 6 A
W-INTEGER-PART W-OUT-WITH-DECIMAL-PLACE 3 N
W-DECIMAL-PLACE W-OUT-WITH-DECIMAL-PLACE +3 1 A
W-DECIMAL-PART W-OUT-WITH-DECIMAL-PLACE +4 2 N

W-ALPHA-PACKED = db-field
W-DECIMAL-PART-FROM-PACKED = W-PACKED
W-INTEGER-PART = W-PACKED
W-DECIMAL-PLACE = '.'
W-DECIMAL-PART = W-DECIMAL-AS-INTEGER

output-number = W-OUT-WITH-DECIMAL-PLACE
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post