IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SYNCSORT Character (Numeric Value) to Fixed Decimal


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
y3mvl

New User


Joined: 19 Dec 2007
Posts: 4
Location: chennai

PostPosted: Thu Feb 24, 2011 8:46 pm
Reply with quote

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!!! icon_smile.gif

attached images were deleted, they added nothing to the info provided,
and just wasted space
Back to top
View user's profile Send private message
y3mvl

New User


Joined: 19 Dec 2007
Posts: 4
Location: chennai

PostPosted: Fri Feb 25, 2011 11:20 am
Reply with quote

No Reply?!!!!!!!!!!!!!!!!!!!! icon_cry.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Feb 25, 2011 8:07 pm
Reply with quote

Hello,

Possibly because your output doesn not even reflect the input. . . icon_confused.gif

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Feb 25, 2011 9:20 pm
Reply with quote

dick scherrer wrote:
You have a decimal point alignment problem

Yes, Dick. That exactly is his problem icon_smile.gif

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
View user's profile Send private message
y3mvl

New User


Joined: 19 Dec 2007
Posts: 4
Location: chennai

PostPosted: Mon Feb 28, 2011 6:56 pm
Reply with quote

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. icon_smile.gif
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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Feb 28, 2011 7:08 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 28, 2011 8:46 pm
Reply with quote

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. . . icon_sad.gif

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Mar 01, 2011 7:42 pm
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top