|
|
| Author |
Message |
die7nadal
Active User
Joined: 23 Mar 2005 Posts: 152
|
|
|
|
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 |
|
 |
References
|
Posted: Sat Mar 22, 2008 1:53 am Post subject: Re: Syncsort - rounding while dividing |
 |
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7517 Location: 221 B Baker St
|
|
|
|
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 |
|
 |
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 169 Location: Bangalore
|
|
|
|
hi,
sorry to say that i am not aware of any such option to get the data rounded while using Syncsort. |
|
| Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 161 Location: hyderabad
|
|
|
|
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 |
|
 |
die7nadal
Active User
Joined: 23 Mar 2005 Posts: 152
|
|
|
|
| Yes, I am interested to see a solution for this issue. |
|
| Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 161 Location: hyderabad
|
|
|
|
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 |
|
 |
|
|
|