%INTH Built-In Functions in rpgle

%INTH function is used to Convert to Integer Format with Half Adjust.

%INTH is very much similar to %INT except that if the expression is a decimal, float or character value, half adjust is applied to the value of the expression while converting it to integer type.


Example –%inth built-in function in rpgle

 




 Columns . . . :    6  80                                              AMIT/QRPGSRC
 SEU==>                                                                     TESTRPG
 FMT *   *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
        *************** Beginning of data *****************************************
    0001.00 DA                S              5P 3 INZ(12.348)                          
0002.00 DB                S              5S 3 INZ(12.555)                          
0003.00 DC                S              8F   INZ(13.555)                          
0004.00 DINT1             S              2  0 INZ(*ZEROS)                          
0005.00 C                   EVAL      INT1=%INTH(A)                                
0006.00 C     INT1          DSPLY                                                  
0007.00 C                   EVAL      INT1=%INTH(B)                                
0008.00 C     INT1          DSPLY                                                  
0009.00 C                   EVAL      INT1=%INTH(C)                                
0010.00 C     INT1          DSPLY                                                  
0011.00 C                   SETON                                        LR        
        ****************** End of data ********************************************


Output

12
13
14











User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy