Page 1 of 1

how to round signed packed decimal using icetool

PostPosted: Sun Oct 03, 2010 8:46 pm
by B1CV8HH
input
char format  hex format
input        pic s9(05)v9(04) comp-3


char format   hex format
-00000.0490  000000490D
-00000.0495  000000495D
-00000.2990  000002990D
-00000.4490  000004490D
-00000.4995  000004995D
-00000.2135  000002135D


output after rounding
-00000.0500  000000500D
-00000.0500  000000500D
-00000.3000  000003000D
-00000.4500  000004500D
-00000.5000  000005000D
-00000.2100  000002100D

Re: how to round signed packed decimal using icetool

PostPosted: Mon Oct 04, 2010 2:01 am
by Frank Yaeger
You can use these DFSORT control statements to do what you asked for. I assumed that your 5-byte PD field starts in position 1. You only showed negative values, so that's all I coded for.

  OPTION COPY
  INREC BUILD=(((1,5,PD,ADD,-50),DIV,+100),MUL,+100,
    TO=PD,LENGTH=5)