Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

More on daylight savings time

This addition information on daylight savings time is sure to save you time.

There's something else you need to change when changing the system time on the iSeries. It's a system value called "Coordinated universal time offset" QUTCOFFSET. I wrote a CL to change both the time and the QUTCOFFSET. I have it scheduled to run in the System Job Scheduler (WRKJOBSCDE) each month the 1st Sunday of the month and the last Sunday of the month and just test for the month being April or October in the CL.


WRKJOBSCDE Fall Code:

 
Frequency  . . . . . . . . . . . FRQ            *MONTHLY     
Schedule date, or  . . . . . . . SCDDATE        *NONE        
Schedule day . . . . . . . . . . SCDDAY         *SUN         
                          + for more values                  
Schedule time  . . . . . . . . . SCDTIME        '02:00:00'   
                   
Relative day of month  . . . . . RELDAYMON      *LAST 
                          + for more values           

WRKJOBSCDE Fall Code:
Frequency  . . . . . . . . . . . FRQ            *MONTHLY   
Schedule date, or  . . . . . . . SCDDATE        *NONE      
Schedule day . . . . . . . . . . SCDDAY         *SUN       
                          + for more values                
Schedule time  . . . . . . . . . SCDTIME        '02:00:00' 
Relative day of month  . . . . . RELDAYMON      1        


Program Code:            PGM                                                        
            DCL        VAR(&HOUR) TYPE(*CHAR) LEN(2)                   
            DCL        VAR(&HOURNUM) TYPE(*DEC) LEN(2 0)               
            DCL        VAR(&MONTH) TYPE(*CHAR) LEN(2)                  
            DCL        VAR(&DAY) TYPE(*CHAR) LEN(2)                    
            DCL        VAR(&GMTIME) TYPE(*CHAR) LEN(5) /* +            
                         'Greenwich MeanTime - CST is -06:00 hrs +     
                         diff & CDT is -05:00 hrs diff COLON IS +      
                         NOT PART OF THE FIELD, IT'S A *DATTIM TYPE */ 
                                                                       
            CHGJOB     LOGCLPGM(*YES)                                  
                                                                       
            RTVSYSVAL  SYSVAL(QHOUR) RTNVAR(&HOUR)                     
            RTVSYSVAL  QMONTH RTNVAR(&MONTH)                           
            RTVSYSVAL  QDAY RTNVAR(&DAY)                               
            RTVSYSVAL  QUTCOFFSET RTNVAR(&GMTIME)                      
                                                                       
 /* CHANGE NUMERIC HOUR TO BE SAME AS HOUR RETRIEVED */                
             CHGVAR     VAR(&HOURNUM) VALUE(&HOUR)                     
                                                                       
/* SEND QSYSOPR MSG SHOWING WHAT IT WAS BEFORE THE CHANGE          */  
             SNDMSG     MSG('DAYSAVTIME MO=' *CAT &MONTH *BCAT +       
                          'DAY=' *CAT &DAY *BCAT 'NEW HR=' *CAT +      
                          &HOUR *BCAT 'MEANTIME=' *CAT &GMTIME) +      
                          TOUSR(QSYSOPR) MSGTYPE(*INFO)                
                                                                       
/* IF IT'S THE 1ST SUNDAY IN APRIL, SPRING FOWARD                   */ 
APR1STSUN:   IF         COND((&MONTH *EQ '04') *AND +                  
                            (&DAY *LT '10')) THEN(DO)                  
             CHGVAR     VAR(&HOURNUM) VALUE(&HOURNUM + 1) /* SPRING +  
                                                   FORWARD */          
             CHGVAR     VAR(&GMTIME) VALUE('-0500') /* DIFFENCE +      
                          BETWEEN CDT AND GREENWICH MEAN TIME */       
             ENDDO                                                     
                                                                       
/* IF IT'S THE LAST SUNDAY IN OCT, FALL BACK                         */
 OCTLASTSUN: IF         COND((&MONTH *EQ '10') *AND   +                
                          (&DAY *GT '20')) THEN(DO)                    
             CHGVAR     VAR(&HOURNUM) VALUE(&HOURNUM - 1) /* FALL   +  
                                                   BACK    */          
             CHGVAR     VAR(&GMTIME) VALUE('-0600') /* DIFFENCE +      
                          BETWEEN CST AND GREENWICH MEAN TIME */       
             ENDDO                                                     
                                                                       
/* NOW ACTUALLY CHANGE THE SYSTEM VALUES                            */ 
APROROCT:    IF         COND(((&MONTH *EQ '04') *AND +                 
                            (&DAY *LT '10')) *OR   +                   
                            ((&MONTH *EQ '10') *AND +                  
                            (&DAY *GT '20')) ) THEN(DO)                
 /* CHANGE ALPHA HOUR TO NEW TIME  */                                  
             CHGVAR     VAR(&HOUR) VALUE(&HOURNUM)                     
                                                                      
/* CHANGE SYSTEM VALUES */                                            
             CHGSYSVAL  SYSVAL(QHOUR) VALUE(&HOUR)                    
             CHGSYSVAL  SYSVAL(QUTCOFFSET) VALUE(&GMTIME)             
                                                                      
/* SEND QSYSOPR MSG SHOWING WHAT IT IS AFTER THE CHANGE            */ 
             SNDMSG     MSG('DAYSAVTIME MO=' *CAT &MONTH *BCAT +      
                          'DAY=' *CAT &DAY *BCAT 'NEW HR=' *CAT +     
                          &HOUR *BCAT 'MEANTIME=' *CAT &GMTIME) +     
                          TOUSR(QSYSOPR) MSGTYPE(*INFO)               
             ENDDO                                                    
                                                                      
             ENDPGM       

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: Tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Read this Search400.com Featured Topic: Managing your iSeries.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

Dig Deeper on iSeries system performance and monitoring

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close