Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message

Active User

Joined: 23 Mar 2005
Posts: 156

Posted: Sat Mar 22, 2008 1:53 am    Post subject: Syncsort - rounding while dividing

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.

dick scherrer

Site Director

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

Posted: Sat Mar 22, 2008 2:06 am    Post subject:

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.
the_gautam

Active User

Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

 Posted: Sat Mar 22, 2008 7:53 am    Post subject: hi, sorry to say that i am not aware of any such option to get the data rounded while using Syncsort.
sril.krishy

Active User

Joined: 30 Jul 2005
Posts: 183

 Posted: Tue Mar 25, 2008 11:38 pm    Post subject: Reply to: Syncsort - rounding while dividing 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

Active User

Joined: 23 Mar 2005
Posts: 156

 Posted: Wed Mar 26, 2008 2:31 am    Post subject: Reply to: Syncsort - rounding while dividing Yes, I am interested to see a solution for this issue.
sril.krishy

Active User

Joined: 30 Jul 2005
Posts: 183

Posted: Wed Mar 26, 2008 5:15 pm    Post subject:

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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Reformatting and adding additional fi... Badbeef SYNCSORT 6 Thu Apr 05, 2018 4:45 pm Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us