Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Converting Alphanumeric Data to Numeric Data in Easytrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 160
Location: India

PostPosted: Thu Dec 08, 2011 5:59 pm    Post subject: Converting Alphanumeric Data to Numeric Data in Easytrieve
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: 8593
Location: Back in jolly old England

PostPosted: Thu Dec 08, 2011 6:09 pm    Post subject:
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: 160
Location: India

PostPosted: Thu Dec 08, 2011 6:15 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Thu Dec 08, 2011 7:22 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Dec 08, 2011 8:55 pm    Post subject: Re: Converting Alphanumeric Data to Numeric Data in Easytrie
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: 160
Location: India

PostPosted: Fri Dec 09, 2011 1:58 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Dec 09, 2011 2:17 pm    Post subject: Reply to: Converting Alphanumeric Data to Numeric Data in Ea
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Extract Data till prev hour balaji81_k DB2 16 Fri Aug 25, 2017 9:25 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us