View previous topic :: View next topic
|
Author |
Message |
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi All,
I have numeric value in my input file as mentioned below
Code: |
----+----1----+----2
AB12CED123456.789
|
In my easytrieve program I have a file layout defined as
Code: |
KEY-CODE 1 07 A
RATE-VAL 8 10 A
|
I want to convert/move RATE-VALUE in to a packed variable defined as
Can anyone suggest me how can I achieve this?
Thanks in advance for your kind help.
Thanks,
Sati |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What does it say in the manual ?
What have you tried yourself so far, and what results did you get. |
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Thanks Expat for your quick reply.
I tried to redefine with a numeric varible like
but I got data exception error.
Thanks,
Sati |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Sati,
you are not thinking.
a value of nnnnn.nnn is and numeric edited or simply an alpha field.
either read the manual and find an ezytrieve equivalent to a COBOL NUMVAL, if there is such a thing. or simply
Code: |
KEY-CODE 1 07 A
RATE-VAL-HI 8 06 N 0
DEC-PD 15 01 A
RATE-VAL-LO 16 03 N 3
|
and
add rate-val-hi, rate-val-lo giving rate-val-pd
or move rate-val-hi to rate-val-pd
and add rate-val-lo to rate-val-pd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
dbz is right.
Only thing I'd say is to drop off that last zero below.
Code: |
RATE-VAL-HI 8 06 N 0 |
The 0 forces the field to be signed. Since it is unsigned, leave it so.
To add to the possibilities, you can do it with the data:
Code: |
s-rate-val S 10 N 3
s-rv-integer s-rate-val 6 N
s-rv-decimal-places s-rate-val +6 3 N 0
s-packed-decimal 5 p 3
...
s-rv-integer = rate-val-hi
s-rv-decimal-places = rate-val-lo
s-packed-decimal-rate = s-rate-val |
Here the zero is included for the decimal-places, since the 3 decimal places specified forces it to be signed, so might as well do it as early as possible. |
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Thanks a lot Dick & Bill for your kind help.
It worked for me.
Thanks again!
Regards,
Sati |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks for the feedback. Good to know. |
|
Back to top |
|
|
|