IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Convert +9999999999999.99 to S9(12)V9(3)


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vnktrrd

New User


Joined: 12 Jan 2010
Posts: 34
Location: New York

PostPosted: Thu Nov 17, 2016 8:15 pm
Reply with quote

Hi,

I have a value like +9999999999999.99 which I want to convert to S9(12)V9(3).

After the conversion it should like 99999999999999{

Please advise how to achieve this using DFSORT.

Thanks,
Ramana.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 17, 2016 8:21 pm
Reply with quote

You have 13 9s before the decimal point in the example and you want to read it with 9(12)?. Anyways look here for examples on SFF format.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Nov 17, 2016 9:43 pm
Reply with quote

If that is your data, you can just hard-code the PD value.

Since that is unlikely, what do other examples of that data look like? Is the position fixed? Length fixed? Sign fixed? Always two decimals? We can't tell much from one piece of example data.
Back to top
View user's profile Send private message
vnktrrd

New User


Joined: 12 Jan 2010
Posts: 34
Location: New York

PostPosted: Thu Nov 17, 2016 10:17 pm
Reply with quote

Hi Bill,

Yes the data is fixed except for the sign which may be + or - . I have to retain the sign always.

I have tried with the below OUTREC but I am not getting the expected output.

Code:

OUTREC BUILD=(1,17,SFF,TO=ZD,LENGTH=15)


Input :
-0000037723069.39
Output :
00000377230693R

and when I move this value to S9(12)V9(3) it is being stored as 3772306.93 instead of 37723069.39.

Thanks,
Ramana.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Nov 17, 2016 10:33 pm
Reply with quote

How do you define the field you MOVE to the S9(12)V9(3)? Your BUILD is working, bearing in mind that you don't have three decimal places in your data. I
Back to top
View user's profile Send private message
vnktrrd

New User


Joined: 12 Jan 2010
Posts: 34
Location: New York

PostPosted: Thu Nov 17, 2016 10:34 pm
Reply with quote

with hex on it looks like below.


Code:

FFFFFFFFFFFFFFD
000003772306939
[/code]
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Nov 17, 2016 10:41 pm
Reply with quote

We know. And it is correct.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 17, 2016 11:38 pm
Reply with quote

If you have 3 decimal places in your target field, I suspect you might need to Multiply the value by 10 and then convert it to ZD.

Code:
 OUTREC BUILD=(1,17,SFF,MUL,+10,TO=ZD,LENGTH=15)

Code:
           ZD 1:15     
 <---+----1----+->     
     -37723069.390     


But can you answer Bill's question on the number of decimal places. If those are variable, there will be more to this, than just multiplying 10 for all records. It might be worth considering all possible input scenarios.
Back to top
View user's profile Send private message
vnktrrd

New User


Joined: 12 Jan 2010
Posts: 34
Location: New York

PostPosted: Fri Nov 18, 2016 12:07 am
Reply with quote

The number of decimal places see always 2. Multiplying it with 10 will solve my problem.
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 -> DFSORT/ICETOOL

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COnvert a column with mix of hex ,cha... DB2 5
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
No new posts how to convert Hex String t char hex PL/I & Assembler 6
This topic is locked: you cannot edit posts or make replies. DFSORT-How to convert ZD to ZS in DFSORT DFSORT/ICETOOL 2
No new posts Convert a packed decimal value to zon... DB2 6

Back to Top