Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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: 161
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: 8619
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: 161
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: 6970
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: 7314

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: 161
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: 7314

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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 1 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us