EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  Rounding in EGL

    Posted Fri February 10, 2017 04:55 PM

    I have a procedure I wrote in RPG that I would like to adapt to an EGL application I'm working on. The procedure I wrote takes a variable that is defined as packed(4:2) which contains a time element and rounds it up to the next quarter hour.  The problem I am having is that some of the built in functions I am using in RPG don't exists in EGL such as converting a field to an integer with a half adjust (or at least I can't find such a function).  How do I go about converting what I've written in RPG to an EGL function?

    //--------------------------------------------------      
    // Procedure name: RoundHrs                               
    // Purpose:        Round hours to the next quarter hour   
    // Returns:        Time rounded to the quarter hour       
    // Parameter:      TimeIn => Time reported                
    //--------------------------------------------------      
     dcl-proc RoundHrs ;                                      
       dcl-pi *n packed(4:2) ;                                
         TimeIn packed(4:2) ;                                 
       end-pi;                                                
                                                              
    // Local fields                                           
     dcl-s TimeOut packed(4:2) ;                              
     dcl-s Minutes zoned(2:0) ;                               
                                                              
     Minutes = (((TimeIn- %INT(TimeIn)) / .25) * 15);        
     TimeOut = (%INT(TimeIn) + (%INTH(Minutes / 15) * .25));  
                         
     Return TimeOut;     
     end-proc ;         

    msoucy