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
 

 

DIV operation round down

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

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Thu Nov 12, 2009 4:35 am    Post subject: DIV operation round down
Reply with quote

Hi,

I have an FB file of length 80 that has a key field, a value field and a multiple field. I need to sort the file in the order of the lowest unit value field record. Unit value is the value field divided by the multiple.

Key field - numeric 10 bytes
Value field - numeric 15 bytes
Multiple feild - numeric 5 bytes

000000000100000000000010100003
000000000100000000000010000003
000000000100000000000007500001

I am using a sort card to divide the value/multiple and then sort on the divided value.

Code:

  INREC FIELDS=(1,30,(11,15,ZD,DIV,26,5,ZD))
  SORT FIELDS=(1,10,ZD,A,31,15,CH,A)       


When i am doing this, i am facing issues with rounding down in the division operation. Value 100 with a multiple of 3 and value 101 with a multiple of 3 both give 33 as output, although i want the sorted order to have 100 with value 3 to come first.

Is there a way around this?

Thanks,
Aneesh.
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 Nov 12, 2009 4:55 am    Post subject:
Reply with quote

You aren't really having trouble with rounding down. You're having trouble with the integer result DFSORT gives for DIV.

You can scale the value by +100 to get more significance in the integer result. For example (assuming you don't really want to keep the unit value):

Code:

  INREC OVERLAY=(81:(11,15,ZD,MUL,+100),     
      DIV,26,5,ZD,TO=ZD,LENGTH=15)           
  SORT FIELDS=(1,10,ZD,A,81,15,CH,A)         
  OUTREC BUILD=(1,80)                       


Now the unit value will be 000000000003333 for 100/3 and 000000000003366 for 101/3, so it will sort correctly, and your output will be:

Code:

000000000100000000000010000003   
000000000100000000000010100003   
000000000100000000000007500001   


If you want something else for the output, you need to show what you want exactly.
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Thu Nov 12, 2009 6:03 am    Post subject: Reply to: DIV operation round down
Reply with quote

Thanks a lot, Frank icon_smile.gif. That works fine for my purposes.
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 Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Joinkeys operation betwen VB and FB file Susanta SYNCSORT 4 Sun Sep 25, 2016 9:49 pm
No new posts how to eliminate records from operati... PUMA DFSORT/ICETOOL 5 Tue Dec 23, 2014 4:42 pm
No new posts Operation with 3 files sun_job DFSORT/ICETOOL 5 Wed Oct 15, 2014 6:46 pm
No new posts File operation sakthikumarT CICS 6 Sun Oct 12, 2014 10:03 pm


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