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

Syncsort - rounding while dividing


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Sat Mar 22, 2008 1:53 am
Reply with quote

I have a fb/80 file, where column 9 to 17 has binary digits and I need 90% of that number. The problem I am facing is that it is rounding down the result to the integer. Suppose if I have 1, then the result of
Code:
OUTREC FIELDS=(1,8,                       
               ((9,8,BI,MUL,+90),DIV,+100))

is 0. The .9 is getting rounded to 0. Is there any way to round it up to 1, if the decimal is greater than 0.5 and round it down to 0 if the decimal is less than or equal to 0.5.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 22, 2008 2:06 am
Reply with quote

Hello,


From the Syncsort manual:
Quote:
The results of division will be rounded down to an integer.


As i read it, it isn't actually "rounded", but simply truncated at the integer.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Sat Mar 22, 2008 7:53 am
Reply with quote

hi,
sorry to say that i am not aware of any such option to get the data rounded while using Syncsort.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Tue Mar 25, 2008 11:38 pm
Reply with quote

Hi,
You can get the desired results with a round about.Please let me know if you are interested,I will pu the answer by tomorrow.

Thanks
Krishy
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Mar 26, 2008 2:31 am
Reply with quote

Yes, I am interested to see a solution for this issue.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Mar 26, 2008 5:15 pm
Reply with quote

die7nadal,

Please check the below code.You can modify the format to have
the desired output.

Code:


//PS020    EXEC PGM=SYNCTOOL                                 
//SYSOUT   DD  SYSOUT=*                                     
//TOOLMSG  DD  SYSOUT=*                                     
//DFSMSG   DD  SYSOUT=*                                     
//IN       DD  *                                             
12345678                                                     
01234567                                                     
00123456                                                     
00012345                                                     
00001234                                                     
00000123                                                     
00000012                                                     
00000001                                                     
//T1       DD DSN=XXXXXXX.T,UNIT=SCRPK,SPACE=(CYL,5),       
//            DISP=(NEW,CATLG,DELETE)                       
//OUT2     DD DSN=YYYYYYY.TEST.REPOR,DISP=(NEW,CATLG,DELETE),
//            VOL=REF=*.T1,SPACE=(TRK,(25,25),RLSE)         
//TOOLIN   DD  *                                             
   SORT FROM(IN) USING(CTL1)                                 
   SORT FROM(T1) TO(OUT2) USING(CTL2)                       
//CTL1CNTL DD  *                                             
   SORT FIELDS=COPY                                         
   INREC FIELDS=((1,8,ZD,MUL,+90),EDIT=(TTTTTTTTTT))         
   OUTFIL FNAMES=T1,                                         
   OUTREC=(1,8,C'.',9,2,80:X)                               
//CTL2CNTL DD  *                                             
   SORT FIELDS=COPY                                         
   OUTFIL IFTHEN=(WHEN=(10,2,CH,GT,C'50'),                   
               BUILD=(1,8,ZD,ADD,+1,EDIT=(TTTTTTTT),2X)),   
              IFTHEN=(WHEN=NONE,                   
               BUILD=(1,8,ZD,EDIT=(TTTTTTTT),2X)) 


Code:

Outout (OUT2):

11111110
01111110
00111110
00011110
00001111
00000111
00000011
00000001



Thanks
Krishy
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
No new posts Arithmetic division using Syncsort SYNCSORT 6
Search our Forums:

Back to Top