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
 

 

Syncsort - rounding while dividing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort - rounding while dividing
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

Site Director


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

PostPosted: Sat Mar 22, 2008 2:06 am    Post subject:
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    Post subject:
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    Post subject: Reply to: Syncsort - rounding while dividing
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    Post subject: Reply to: Syncsort - rounding while dividing
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


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