Blog Archive

RPGLE Day of the Week example

RPGLE Sample Code to get day of week for the Current Date or any given date


d Day_Of_Week     s              1p 0                                  
D My_date         S               D   inz(d'2011-03-15')               
D My_date2        S              8s 0 inz(20110415)                    
                                                                       
 /free                                                                 
    // *Mon = 0 ... Sun = 6                                            
    Day_Of_Week = %rem(%diff(%date():d'0001-01-01':*days):7);          
                                                                       
    Day_Of_Week = %rem(%diff(My_date:d'0001-01-01':*days):7);          
                                                                       
    Day_Of_Week = %rem(%diff(%date(My_date2):d'0001-01-01':*days):7); 
                                                                      

    SELECT;                                                            
          WHEN Day_Of_Week = 0;                                        
            dsply '*MON';                                              
          WHEN Day_Of_Week = 1;                                        
            dsply '*TUE';                                              
          WHEN Day_Of_Week = 2;                                        
            dsply '*WED';                                              
          WHEN Day_Of_Week = 3;                                        
            dsply '*THU';                                              
          WHEN Day_Of_Week = 4;                                        
            dsply '*FRI';                                              
          WHEN Day_Of_Week = 5;             
            dsply '*SAT';                   
          WHEN Day_Of_Week = 6;             
            dsply '*SUN';                   
          OTHER;                            
    ENDSL;                                  
                                            
 /end-free               

4 comments :

  1. Thanks! Works great!

    ReplyDelete
  2. http://bantalsilikon01.blogspot.com/2014/10/perumahan-baru-di-tangerang-graha-raya.html
    http://bantalsilikon01.blogspot.com/2014/11/bantal-silikon.html
    http://bantalsilikon01.blogspot.com/2014/10/rekomendasi-untuk-cloud-dedicated.html
    http://bantalsilikon01.blogspot.com/
    http://marinir-seo.blogspot.com/2014/10/marinir-seo.html
    http://marinirseo.blogspot.com/2014/10/perumahan-baru-di-tangerang-graha-raya.html
    http://kopiluwakliar01.blogspot.com/2014/10/perumahan-baru-di-tangerang-graha-raya.html

    lkmnprapto@gmail.com
    http://vvty.in
    http://marinir-seo-konsultan-12a.blogspot.com/2014/10/aaa.html
    http://asdf-14.blogspot.com/2014/10/hhh.html
    http://vvtiin.blogspot.com/2014/10/iii.html
    http://marinir-seo-8.blogspot.com/2014/10/jjj.html
    http://bantaljkt1.blogspot.com/2014/10/sss.html
    http://dfes12.blogspot.com/2014/10/rrr.html
    http://seo-guru01.blogspot.com/2014/10/qqq.html
    http://jksbindo.blogspot.com/2014/10/ppp.html
    http://jkt-49.blogspot.com/2014/10/ooo.html
    http://seokonsultan1.blogspot.com/2014/10/nnn.html
    http://guru-seo-malang.blogspot.com/2014/10/mmm.html
    http://seo-aaa.blogspot.com/2014/10/lll.html
    http://seo-konsultasi-mudah.blogspot.com/2014/10/kkk.html
    http://bantal-silikon15.blogspot.com/2014/10/ggg.html
    http://agen-seo16.blogspot.com/2014/10/fff.html
    http://agen-seo17.blogspot.com/2014/10/eee_30.html
    http://agen-seo18.blogspot.com/2014/10/ddd.html
    http://agen-seo19.blogspot.com/2014/10/ccc.html
    http://agen-seo20.blogspot.com/2014/10/bbb.html
    http://bumbu-pecel01.blogspot.com/2014/10/xxx.html

    bumbupecel1.blogspot.com
    http://bantalasdf.blogspot.com/2014/10/aaa.html
    http://seo-malang-19.blogspot.com/2014/10/bbb.html
    http://agenseomalang18.blogspot.com/2014/10/ccc.html
    http://marinirseo17.blogspot.com/2014/10/ddd.html
    http://bumbupecel16.blogspot.com/2014/10/eee.html
    http://domainhosting15.blogspot.com/2014/10/fff.html
    http://bumbupecel15.blogspot.com/2014/10/ggg.html
    http://marinirseo14.blogspot.com/2014/10/hhh.html
    http://bantalsilikon12a.blogspot.com/2014/10/iii.html
    http://marinirseo12.blogspot.com/2014/10/jjj.html
    http://bumbu-pecel-hz.blogspot.com/2014/10/kkk.html
    http://marinir-seo-001.blogspot.com/2014/10/lll.html
    http://bantal-silikon-murah.blogspot.com/2014/10/mmm.html
    http://vvty-ine.blogspot.com/2014/10/nnn.html
    http://give-a-power.blogspot.com/2014/10/ooo.html
    http://bumbupecel-12.blogspot.com/2014/10/ppp.html
    http://marinir-seo-konsultan.blogspot.com/2014/10/qqq.html
    http://guru-seo-praktisi-123.blogspot.com/2014/10/rrr.html
    http://guru-seminar-online01.blogspot.com/2014/10/sss.html
    http://kopiluwakmalang11.blogspot.com/2014/10/ttt.html

    ReplyDelete
  3. Thanks! Saved my a lot of work and works great.

    ReplyDelete