IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Converting Alphanumeric Data to Numeric Data in Easytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu Dec 08, 2011 5:59 pm
Reply with quote

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

Code:
RATE-VAL-PD 5 P 3


Can anyone suggest me how can I achieve this?

Thanks in advance for your kind help.

Thanks,
Sati
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 08, 2011 6:09 pm
Reply with quote

What does it say in the manual ?
What have you tried yourself so far, and what results did you get.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu Dec 08, 2011 6:15 pm
Reply with quote

Thanks Expat for your quick reply.

I tried to redefine with a numeric varible like
Code:
CHARGE   10 N 3
but I got data exception error.

Thanks,
Sati
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Dec 08, 2011 7:22 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 08, 2011 8:55 pm
Reply with quote

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
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Fri Dec 09, 2011 1:58 pm
Reply with quote

Thanks a lot Dick & Bill for your kind help.

It worked for me.

Thanks again!


Regards,
Sati
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Dec 09, 2011 2:17 pm
Reply with quote

Thanks for the feedback. Good to know.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top