View previous topic :: View next topic
|
Author |
Message |
y3mvl
New User
Joined: 19 Dec 2007 Posts: 4 Location: chennai
|
|
|
|
INP FILE (using s.3.4):
Code: |
9----+----0----+----1---
7.26
24.2
12.1
11.0
|
SORT CARD:
SORT FIELDS=(301,11,CH,A)
OUTREC FIELDS=(1,8,9,10,30,11,94,9,SFF,TO=PD,
114,8,215,11,301,11,100:X)
OUT FILE (using File-Aid):
5/DFX
(30-34)
Code: |
- 5----------
6.05
1.21
1.10
9.68 |
The input field is CH with numeric value
And
I need the output as FIXED DEC(9,2) (as in PL/1). Length of 5
So I used SFF,TO=PD, but ended with wrong decimal places.
Here 12.1 and 11.0 got changed to 1.21 and 1.10 respectively. (Ignore 6.05 & 9.68 in the image, as records got sorted)
After going thorugh manuals and google, I (blindly) kept trying many options like, UFF/SFF,PD/ZD,FS/SI,etc.... But no use.
P.S.:
1) To=PD is the only option giving me an output closer to my expectation
2) My knowledge of datatypes is very limited
Hope you got the question!!!
attached images were deleted, they added nothing to the info provided,
and just wasted space |
|
Back to top |
|
|
y3mvl
New User
Joined: 19 Dec 2007 Posts: 4 Location: chennai
|
|
|
|
No Reply?!!!!!!!!!!!!!!!!!!!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Possibly because your output doesn not even reflect the input. . .
Suggest you post the output from the exact input.
You mention position 301, but the "input" posted does not start in 301. . .
The 12.1 and 11.1 values did NOT get changed. You have a decimal point alignment problem. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
dick scherrer wrote: |
You have a decimal point alignment problem |
Yes, Dick. That exactly is his problem
As per my understanding he is trying to sort on a 11 byte field which is at pos-301. After sorting, he wants to convert the 9-byte numeric data field which starts at pos-94(as shown in the sample data) to PD.
This seems to be a candidate for a PARSE application. |
|
Back to top |
|
|
y3mvl
New User
Joined: 19 Dec 2007 Posts: 4 Location: chennai
|
|
|
|
HI PPL,
Thanks for the replies....
Checked with my team, and it seems I'm not suppose to post the entire input data.
The problem is not with postition 301. It gets sorted correctly.
The problem is when trying to move Numerals in CH data type (at position 94) to a Numeric Format.
The field in problem starts from 94, length is 9, Type is CHAR and Alignment is Right.
Here, when converting using 'SFF,TO=PD', no matter how many digits are there behind the decimal point, it just gives out two digits after the decimal point.
So my question is how can I overcome this problem, and retain the number of digits before and after the decimal point.
P.S. I tried with PARSE, but not sure whether it is suppoted in SYNCSORT. I just got confused there and stopped looking at it.
Thanks again!
Regards, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
and it seems I'm not suppose to post the entire input data. |
there is no need to post the true data,
what has to be accurate is the layout, the content can be reasonably obfuscated!
but if also the layout cannot be shown, You/Your organization should not seek help on a public forum ! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Here, when converting using 'SFF,TO=PD', no matter how many digits are there behind the decimal point, it just gives out two digits after the decimal point. |
Not true. . .
The "two digits" are your doing - not the "sort". A packed decimal value has no "decimal places" - it is just a packed value. "You" cause the insertion of decimal places by how you define and use the field.
x'1234567C' could be 12.34567 or 1234.567 or 12345.67 etc based on your use. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
y3mvl wrote: |
I tried with PARSE, but not sure whether it is suppoted in SYNCSORT. I just got confused there and stopped looking at it |
You can achieve what you want using 'PARSE' and AFAIK PARSE is supported even by older versions of Syncsort.
(IIRC since Syncsort 1.3) Which version do you have there? |
|
Back to top |
|
|
|