Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time on a AS400 server

Status
Not open for further replies.

deadbeef

IS-IT--Management
Jul 31, 2001
39
CA
Hi,

Explication:
I have Tivoli distributed monitoring agents on an as400.
Tivoli Distributed monitoring is on a AIX server.
When i send a job from the AIX server everything seems to be fine. But when I do a WLSENG -L command the result that i got from the AS400 is one hour before what I have scheduled it. I saw the problem a few days ago. But i am sure that it wasn't there at the implementation. I think that it happend when we got out of the daylight saving time.

Question:
Hoe to set up an AS400 to be able to use the daylight saving time ? If not, how to solve the problem on the AS400 side ? The AIX server has change his time and it is fine.

Thanks

Ben
 
at a command line,,, type the following,,
wrksysval qhour,,, then follow the directions, and change the system hour.
 
Explanation:
I don't want to change the hour to solve the problem.
The problem reside on the GMT -5. On the AIX machine we are at GMT -5, May. 06, 02:47:38 PM EDT. Since we are in EDT it's GMT -5 +1. So it is like GMT -4 for the AS400. So when i scedule a job for 07:00 am it runs on the AS400 at 06:00 am.

Question:
How do you folks change the hour on an AS400 for the daylight saving time or standard time ? Do you change the system time or do you change tto GMT -X ? Is there a way that an AS400 can take care by itself for the daylight saving time or standard time like the Unix Servers or Windows NT servers does ?

Thanks
Ben
 
You also have to update QUTCOFFSET on the AS/400.

WRKSYSVAL QUTCOFFSET and change the value if necessary.

We have a program to change the time and the UTC offset automatically when DST starts and ends on our AS/400s. It's not done by the operating system.

Here it is. It must be called DAYLSAV and is set up for Central time (in the USA).
Code:
    1.00      0/************************************************************/
    2.00      0/* Call this program once before spring DST starts. It will */
    3.00      0/* add job schedule entries to automatically change the     */
    4.00      0/* system time and the UTC offset system value.             */
    5.00      0/* It also adds a job schedule entry to call itself on      */
    6.00      0/* Jan 1 of next year so intervention should be required.   */
    7.00      0/*                                                          */
    8.00      0/* UTC offset values are set for Central time (US).         */
    9.00      0/*                                                          */
   10.00      0/*                                                          */
   11.00      0/* This program uses QUSRTOOLS:  RTVDAT - ADDDAT            */
   12.00      0/************************************************************/
   13.00      0             PGM
   14.00      0             DCL        VAR(&DATFMT) TYPE(*CHAR) LEN(3)
   15.00      0             DCL        VAR(&YEAR) TYPE(*CHAR) LEN(2)
   16.00      0             DCL        VAR(&DAY3U) TYPE(*CHAR) LEN(3)
   17.00      0             DCL        VAR(&NEWYEAR) TYPE(*CHAR) LEN(6)
   18.00      0             DCL        VAR(&STRD) TYPE(*CHAR) LEN(6)
   19.00  40401             DCL        VAR(&STRDV) TYPE(*DEC) LEN(6)
   20.00      0             DCL        VAR(&ENDD) TYPE(*CHAR) LEN(6)
   21.00  40401             DCL        VAR(&ENDDV) TYPE(*DEC) LEN(6)
   22.00      0
   23.00      0             ADDLIBLE   LIB(TAATOOL)
   24.00      0             MONMSG     MSGID(CPF0000)
   27.00      0             RMVJOBSCDE JOB(STRDAYLSAV) ENTRYNBR(*ALL)
   28.00      0             MONMSG     MSGID(CPF0000)
   29.00      0             RMVJOBSCDE JOB(ENDDAYLSAV) ENTRYNBR(*ALL)
   30.00      0             MONMSG     MSGID(CPF0000)
   31.00      0             RMVJOBSCDE JOB(DAYLSAV) ENTRYNBR(*ALL)
   32.00      0             MONMSG     MSGID(CPF0000)
   33.00      0             RMVJOBSCDE JOB(STRDSTOFF) ENTRYNBR(*ALL)
   34.00      0             MONMSG     MSGID(CPF0000)
   35.00      0             RMVJOBSCDE JOB(ENDDSTOFF) ENTRYNBR(*ALL)
   36.00      0             MONMSG     MSGID(CPF0000)
   37.00      0
   38.00      0/* Check System Date Format */
   39.00  40401             RTVSYSVAL  SYSVAL(QDATFMT) RTNVAR(&DATFMT)
   40.00      0             IF         COND(&DATFMT *NE 'MDY') THEN(GOTO +
   41.00      0                          CMDLBL(END_PGM))
   42.00      0/* Initialse Variables */
   43.00      0             RTVSYSVAL  SYSVAL(QYEAR) RTNVAR(&YEAR)
   44.00      0             CHGVAR     VAR(&STRD) VALUE('0407' *CAT &YEAR)
   45.00      0             CHGVAR     VAR(&ENDD) VALUE('1031' *CAT &YEAR)
   46.00      0             CHGVAR     VAR(&STRDV) VALUE(&STRD)
   47.00      0             CHGVAR     VAR(&ENDDV) VALUE(&ENDD)
   48.00      0
   49.00      0/* Find First Sunday in April */
   50.00      0SUNAPR:      CHGVAR     VAR(&STRD) VALUE(&STRDV)
   51.00      0             SRSLIB/RTVDAT DATE(&STRD) DAY3U(&DAY3U)
   52.00      0             IF         COND(&DAY3U *NE 'SUN') THEN(DO)
   53.00  40401             CHGVAR     VAR(&STRDV) VALUE(&STRDV - 100)
   54.00      0             GOTO       CMDLBL(SUNAPR)
   55.00      0             ENDDO
   56.00      0
   57.00      0/* Add job to Job Scheduler with first Sunday in April */
   58.00      0             CHGVAR     VAR(&STRD) VALUE(&STRDV)
   59.00  40402             ADDJOBSCDE JOB(STRDAYLSAV) CMD(CHGSYSVAL SYSVAL(QHOUR) +
   60.00  40402                          VALUE('03')) FRQ(*ONCE) SCDDATE(&STRD) +
   61.00  40402                          SCDTIME(020000) USER(QSYSOPR) +
   62.00  40402                          TEXT('Beginning of DST (spring)')
   63.00      0             MONMSG     MSGID(CPF0000)
   64.00  40401             ADDJOBSCDE JOB(STRDSTOFF) CMD(CHGSYSVAL +
   65.00  40401                          SYSVAL(QUTCOFFSET) VALUE('-0500')) +
   66.00  40402                          FRQ(*ONCE) SCDDATE(&STRD) SCDTIME(020001) +
   67.00  40401                          USER(QSYSOPR) TEXT('Change UTC Offset +
   68.00  40401                          (spring)')
   69.00      0             MONMSG     MSGID(CPF0000)
   70.00      0
   71.00      0/* Find Last Sunday in October */
   72.00      0SUNOCT:      CHGVAR     VAR(&ENDD) VALUE(&ENDDV)
   73.00      0             SRSLIB/RTVDAT DATE(&ENDD) DAY3U(&DAY3U)
   74.00      0             IF COND(&DAY3U *NE 'SUN') THEN(DO)
   75.00  40401             CHGVAR     VAR(&ENDDV) VALUE(&ENDDV - 100)
   76.00      0             GOTO       CMDLBL(SUNOCT)
   77.00      0             ENDDO
   78.00  40401
   79.00      0/* Add job to Job Scheduler with last Sunday in October */
   80.00  40401             CHGVAR     VAR(&ENDD) VALUE(&ENDDV)
   81.00  40402             ADDJOBSCDE JOB(ENDDAYLSAV) CMD(CHGSYSVAL SYSVAL(QHOUR) +
   82.00  40402                          VALUE('01')) FRQ(*ONCE) SCDDATE(&ENDD) +
   83.00  40402                          SCDTIME(020000) USER(QSYSOPR) TEXT('End +
   84.00  40402                          of DST (fall)')
   85.00      0             MONMSG     MSGID(CPF0000)
   86.00  40401             ADDJOBSCDE JOB(ENDDSTOFF) CMD(CHGSYSVAL +
   87.00  40401                          SYSVAL(QUTCOFFSET) VALUE('-0600')) +
   88.00  40401                          FRQ(*ONCE) SCDDATE(&ENDD) SCDTIME(020001) +
   89.00  40401                          USER(QSYSOPR) TEXT('Change UTC Offset +
   90.00  40401                          (fall)')
   91.00      0             MONMSG     MSGID(CPF0000)
   92.00      0
   93.00      0/* Add job DAYLSAV to JOB Scheduler with 1/1 next year */
   94.00  40401             TAATOOL/ADDDAT DAYS(365) TOVAR(&NEWYEAR) DATE(&STRD) +
   95.00  40401                          TOVARFMT(*SYSVAL) DATEFMT(*SYSVAL)
   96.00      0             CHGVAR     VAR(&NEWYEAR) VALUE('0101' *CAT +
   97.00      0                          %SST(&NEWYEAR 5 2))
   98.00  40402             ADDJOBSCDE JOB(DAYLSAV) CMD(CALL PGM(DAYLSAV)) +
   99.00  40402                          FRQ(*ONCE) SCDDATE(&NEWYEAR) +
  100.00  40402                          SCDTIME(000001) USER(QSYSOPR) +
  101.00  40402                          TEXT('Maintains job scheduler entries for +
  102.00  40402                          next year')
  103.00      0             MONMSG     MSGID(CPF0000)
  104.00      0END_PGM:     ENDPGM

De mortuis nihil nisi bonum.

 
Basically you need to use the following 2 commands.
You can use the program posted above, write you own, or remember to do it manually.

This is for the Eastern time zone, NYC, Atlanta, etc...

CHGSYSVAL QHOUR
CHGSYSVAL QUTCOFFSET

In the Fall:
Change offset to -05:00
Change hour to 1 hour earlier

In the Spring:
Change offset to -04:00
Change hour to 1 hour later



T. Bishop
 
magicandmight said:
What library does that program need to be put in?
Any library which is in the library list of the job description used in the ADDJOBSCDE command (JOBD parameter). I didn't use that parameter in this program because the QSYSOPR user profile it runs under has that library in the job description.

Also, as the code notes, you need ADDDAT and RTVDAT from TAATOOLS. If you don't have them, you can probably come up with the equivalent stuff by writing an RPG program. You need to add 1 year to a date, and get the day of the week for a date, things which are a little kludgy to do in CL.

Me transmitte sursum, Caledoni!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top