View previous topic :: View next topic
|
Author |
Message |
vnktrrd
New User
Joined: 12 Jan 2010 Posts: 34 Location: New York
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
vnktrrd
New User
Joined: 12 Jan 2010 Posts: 34 Location: New York
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
vnktrrd
New User
Joined: 12 Jan 2010 Posts: 34 Location: New York
|
|
|
|
with hex on it looks like below.
Code: |
FFFFFFFFFFFFFFD
000003772306939
|
[/code] |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
We know. And it is correct. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
vnktrrd
New User
Joined: 12 Jan 2010 Posts: 34 Location: New York
|
|
|
|
The number of decimal places see always 2. Multiplying it with 10 will solve my problem. |
|
Back to top |
|
|
|