ILE RPG Floor()

This subprocedure implements a floor function: the largest integer value less than or equal to value, given a scaling factor.


     d floor           pr            10i 0
     d  value                        15s 5 const
     d  factor                       15s 5 const

     p floor           b
     d floor           pi            10i 0
     d  value                        15s 5 const
     d  factor                       15s 5 const
      /free
         if factor=0;
            return 0;
         else;
            return (%int(value/factor)*factor);
         endif;
      /end-free
     p floor           e