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

Unpack and round down packed decimals


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

New User


Joined: 24 Apr 2008
Posts: 2
Location: Saint Joseph

PostPosted: Thu Apr 24, 2008 8:04 pm
Reply with quote

Hello,

Input file structure is :
1) first 23 characerts ( all are of type PIC X)
2) position 41 to 8 characters are packed decimal values of PIC S9(08) V9(06) COMP-3.

My requirement is to
1) sort the file on first 23 characters
2) SUM the packed decimal values ( starting position 41 to 8)
3) Unpacked the summarized value, to 9(08).9(3) . Please note that , I want to round down the decimal values from 6 decimals to 3. (i.e. from S9(08)V9(06) to 9(08).9(3)

The SORT card, that I have is doing all the above things, except rounding down 6 decimals to 3 decimals.
Please let us know, whether DFSORT can do summarize and round down the result , simultaneously.

Thank you.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 24, 2008 8:54 pm
Reply with quote

Wouldn't outrecing the summed value into a truncated edit mask get you what you want?
What do you have so far?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Apr 24, 2008 9:24 pm
Reply with quote

Quote:
Wouldn't outrecing the summed value into a truncated edit mask get you what you want?


Actually, it won't. For example, if the PD value is:

X'012345678123456C'

EDIT=(TTTTTTTT.TTTTTT) would give you:

12345678.123456

The value if rounding down from 6 decimal places to 3 would be:

12345678.123

but EDIT=(TTTTTTTT.TTT) would give you:

45678123.456

because the digits are filled into the pattern from right to left (6 for the last T, then 5 for the next to last T, etc)

The correct way to do this is to divide by 1000, e.g.

41,8,PD,DIV,+1000,EDIT=(TTTTTTTT.TTT)
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 24, 2008 10:05 pm
Reply with quote

Right, right justify vs left justify.........
Not thinking too clearly without the first cup of coffee....grin.....
Back to top
View user's profile Send private message
Imthiyaz

New User


Joined: 24 Apr 2008
Posts: 2
Location: Saint Joseph

PostPosted: Fri Apr 25, 2008 1:16 am
Reply with quote

Thanks for the help, Frank.
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

 


Similar Topics
Topic Forum Replies
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
No new posts Numeric check on packed signed and un... COBOL Programming 4
Search our Forums:

Back to Top