Hi, A little REXX Code for TimeZone Offset.
signal on syntax
/*
|| ====================================================================
|| Function: Timezone : Calculates the offset from GMT
|| Arguments: (none) : nothing is required
|| Return: offset : offset in (-)HHMM format
|| Exposed vars: (none) : nothing is exposed
||
|| Note: Decode Minutes Into foramt HH:mn
|| ====================================================================
*/
Call TimeZone
/*
|| ====================================================================
|| Function: Push : Push the Word
|| Arguments: (none) :
||
|| Note: Nothing
|| ====================================================================
*/
Parse Value TIME() with Hours ':' Minutes ':' Seconds
Tmezone.1 = 'Date: 'DATE() Hours':'Minutes':'Seconds zone
/*
|| ====================================================================
|| Function: Timezone : Calculates the offset from GMT
|| Arguments: (none) : nothing is required
|| Return: offset : offset in (-)HHMM format
|| Exposed vars: (none) : nothing is exposed
||
|| Note: Uses the CVTLDTO field in one of the CVT extensions. It look
|| like this field was added sometime in 1991, so this routine
|| will not work on any OS version older than that.
|| ====================================================================
*/
Timezone:
/* ==================================================================
|| We're gonna have a big number
*/
NUMERIC DIGITS 21
/* ==================================================================
|| Get current CVTLDTO (Local Date Time Offset in STCK format))
*/
cvt = C2d( Storage( D2x( 16 ), 4 ) )
cvttz = C2d( Storage( D2x( cvt + 304 ), 4 ) )
cvtext2 = C2d( Storage( D2x( cvt + 328 ), 4 ) )
cvtldto = C2d( Storage( D2x( cvtext2 + 56 ), 8 ), 8 )
/* ==================================================================
|| Calc the current offset in hours and minutes (work with absolute)
*/
absldto = Abs( cvtldto )
hours = absldto % x2d('D693A400000' )
minutes = ( absldto % x2d('3938700000') ) // 60
/* ==================================================================
|| Format to ANSI standard X3.51-1975
*/
zone = Right( hours, 2, "0" )Right( minutes, 2, "0" )
IF cvtldto < 0 THEN DO
zone = "-"zone
END
ELSE DO
zone = "+"zone
END
/* ==================================================================
|| Reset
*/
NUMERIC DIGITS
RETURN zone
/**************************************************************
* Trap uninitialized variables *
***************************************************************/
syntax:
say "Syntax error" rc "at line" sigl || ":"
say errortext(rc)
say sourceline(sigl)
exit
Francis Godin
Renault IT - Data Centers
Networking Expert & WAN
Paris - France
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

