Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help regarding conversion in sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Mon Apr 09, 2012 4:44 pm    Post subject: Need help regarding conversion in sort.
Reply with quote

I/P Field PIC S9(14).
O/P Field PIC S9(13)V9(02) COMP-3.

There is no decimal point or value (after decimal point) in input.
But output need to have the decimal point (and 2 zeros after point).

COBOL move example:
Code:

I/P
0000000009476F
FFFFFFFFFFFFFC
00000000094766

O/P
     mÎ-
00009760
0000460C



Sort card I used:
OVERLAY=(X:Y,14,ZD,TO=PD,LENGTH=8

O/P I got
Code:

.....mÎ%
00000976
0000046C


The O/P from SORT is missing the 00 after decimal point.

This is what I see in the manual.

Quote:

deccon,to or (deccon),to
specifies that a converted decimal constant is to appear in the reformatted
OUTFIL output record. The decimal constant must be in the form +n or −n
where n is 1 to 31 decimal digits. The sign (+ or −) must be specified. A
decimal constant produces a signed, 31-digit zoned decimal (ZD) result to be
converted as specified.
The default number of digits (d) used for conversion is 15 for a decimal
constant with 1 to 15 significant digits, or 31 for a decimal constant with 16 to
31 significant digits.
See to under p,m,f,to for further details on the to fields you can use.
Sample Syntax:
OUTFIL FNAMES=OUT1,
OUTREC=(6:+0,TO=PD,LENGTH=6,+0,TO=PD,LENGTH=6,/,
6: (-4096),ZD,LENGTH=12)


But I am not able to apply this to my problem.
Your guidance is much appreciated. Thanks in advance.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 09, 2012 5:01 pm    Post subject: Reply to: Need help regarding DECCON in sort.
Reply with quote

You aren't trying to convert a Constant, so forget that bit.

There are no decimal places in fields which Sort supports, therefore all decimal places are implied.

To imply two decimal places in your packed field, you can multiply by +100. Something like the following:

Code:

OVERLAY=(X:Y,14,ZD,MUL,+100,TO=PD,LENGTH=8
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Mon Apr 09, 2012 5:52 pm    Post subject:
Reply with quote

Thanks a lot Bill.
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Mon Apr 09, 2012 9:13 pm    Post subject:
Reply with quote

Is there any other way to do this...?

Just curious... if somebody adds decimal to the input file then the output value will be different than expected.

Please correct me if my understanding is wrong!!
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Apr 09, 2012 9:57 pm    Post subject:
Reply with quote

abdul.faras wrote:
I/P Field PIC S9(14).
O/P Field PIC S9(13)V9(02) COMP-3.

There is no decimal point or value (after decimal point) in input.
But output need to have the decimal point (and 2 zeros after point).



What is the expected output for the input value 12345678901234?

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Apr 09, 2012 10:57 pm    Post subject:
Reply with quote

Quote:
But output need to have the decimal point (and 2 zeros after point).


You said this in your first post and somebody showed you how to do what you asked for.

Quote:
Just curious... if somebody adds decimal to the input file then the output value will be different than expected.


Now you are saying something else and it's not even clear what you're saying. Please describe your COMPLETE requirement clearly with examples of input and expected output for ALL cases you have to handle. Then somebody can give you a COMPLETE solution without wasting their time or yours.
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Apr 10, 2012 12:49 pm    Post subject:
Reply with quote

sqlcode1 wrote:

What is the expected output for the input value 12345678901234?

Thanks,


its: 12345678901234.00

By Somebody, I meant someone else in our team.

I am considering a hypothetical situation if the i/p fields PIC clause is changed to 9(12)V9(2) then in that case the sort card would definitely need to be revisited.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Apr 10, 2012 1:13 pm    Post subject: Reply to: Need help regarding conversion in sort.
Reply with quote

You are unclear about whether an actual decimal point exists in your input or should exist in your output.


Code:
123456789    No Decimal Point (implied to right of last digit)
12345678900  Two implied decimal places, Decimal Point implied to left of (in this example) trailing zeros


If "someone" changes the input to the second from the first, then you have to change the processing of the output (to nothing).

No data, except "edited" data, data formatted for output, contains actual decimal places. "Formats" are defined to interpret the data, with implied decimal places. In your task as stated you are reformatting the data to match a description in a program which has two decimal places but you are starting with an integer. So you add two zeros to the right (and you could do it that exact way) so that the next program down the line finds it lined-up for two implied decimal places.

If you have an "actual" decimal point in the data, then there is no need to do anything, whatever is processing the data must (if it is working) already understand the decimal point.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us