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
 

 

Unpack and round down packed decimals

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Unpack and round down packed decimals
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 24, 2008 8:54 pm    Post subject:
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 Moderator


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

PostPosted: Thu Apr 24, 2008 9:24 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 24, 2008 10:05 pm    Post subject:
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    Post subject: Reply to: Unpack and round down packed decimals
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    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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts conversion from char to packed decimal Musab Ahmed DFSORT/ICETOOL 7 Fri Apr 08, 2016 1:12 pm
No new posts NDM Packed Data file from Mainframes ... santhosh5983 IBM Tools 2 Wed Mar 30, 2016 2:36 am
No new posts packed decimal field value in table t... sakrat DB2 10 Thu Jun 25, 2015 12:22 pm


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