Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
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
References
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 1199
Location: At my desk

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: 4621
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: 1199
Location: At my desk

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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1