[Toc][Index]

REXX Tools


Name     REXX Tools - a collection of REXX 
                      routines 
Version  3 Jan 2003 
Author   Toby Thurston 
         (see EMail Addresses)
Distrib. Freeware 
Type     REXX Routines 
Price    -
Note     - 
Source   Internet 
         Name: rextools1.00.* 

This is a collection of misc routines for in REXX (date, time, 
mathematical, and strings). They are written for Object REXX but with some 
little work you can include them in Classic REXX programs also. 
The routines included are: 
 
 base(y,m,d) 
    Base returns base day number from year, month, and day. 
 base_from_julian(y,m,d) 
    This is just like base, except that the year, month, and day values 
    are interpreted as dates in the Julian calendar system. 
 base_from_iso_week(y,w,d) 
    This also returns a base date, but the input parameters are a year (in 
    the Gregorian calendar), an ISO week number, and an ISO weekday 
    number. 
 easter(y) 
    Easter returns the base date of Easter Sunday in any given Gregorian 
    year, according to the modern rules. 
 gregorian(d) 
    Gregorian returns `y m d' from a base number according to normal 
    Gregorian calendar rules. 
 julian(d) 
    Julian also returns `y m d' from a base number, but according to the 
    Julian calendar rules. 
 iso_week(d,sep) 
    Iso_week returns `year week day' from a base date according to ISO 
    2015:1976 rules. If the optional argument, sep is set to `-', then the 
    result is returned in the ISO string form yyyy-Www-d. 
 iso_day_of_year(d,sep) 
    Returns `year day_of_year' from a base date. If the optional argument 
    is set to `-' then the date is returns in the ISO standard form 
    yyyy-ddd. 
 iso_sorted(d,sep) 
    Returns a date in ISO sorted form given a base date. If you set the 
    optional argument to '-' the date will be returned in the alternative 
    ISO sorted form with '-' between the year, month, and date parts. 
 b2s 
    Same as iso_sorted(). 
 b2i 
    Same as iso_sorted with the optional argument set to '-'. 
 b2d 
    Returns day of year. 
 b2e 
    Returns date in European format (dd/mm/yy). 
 b2o 
    Returns date in Ordered format (yy/mm/dd). 
 b2u 
    Returns date in USA format (mm/dd/yy). 
 b2m 
    Returns full name of month in English. 
 b2n 
    Returns date in Rexx `normal' form: dd Mmm yyyy 
 b2w 
    Returns the full name of the day of the week in English 
 window(y) 
    Returns a full four digit year number from a two digit one. 
 shortdate(basedate|y,m,d) 
    Shortdate() returns (by default) the current date in the user's 
    selected short date form. 
 longdate(basedate|y,m,d) 
    Longdate() is just the same except that it uses the long date setting 
    from the Control Panel. 
 makedate( format, basedate|y,m,d ) 
    Makedate() will return a date in an arbitrary format, a bit like 
    strftime() on UNIX. 
 parsedate(s) 
    Parsedate() is a generic routine to read a date in any normal form and 
    return a corresponding base date. 
 hms(s, sep) 
    Convert seconds to hh:mm:ss. 
 sec('nn:mm:ss') 
    Convert hh:mm:ss.  to seconds. 
 tzo 
    Returns the current time zone offset for the system in the form +hhmm 
    or -hhmm where hh and mm represent the number of hours and minutes 
    that GMT is ahead of your current local time. 
 alphabet() 
    Returns 'abcdefghijklmnopqrstuvwxyz'. 
 lower(s) 
    Equivalent to 
    translate
    (s,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'). 
 upper(s) 
    Equivalent to translate(s). 
 wordsort(s, fn) 
    Return the blank-delimited words in the string sorted in ASCII 
    ascending order. 
 sort(s, fn) 
    Return the string s sorted, by default in ASCII order. 
 Replace(new,string,n) 
    Replaces the nth blank delimited word in string with new. 
 caesar(s,n) 
    Apply a `Caesar' rotation to the string. 
 rot13(s,n) 
    A synonym for caesar() with the second parameter set to 13. The name 
    is traditional and is short for "rotate 13 places". 
 permute(s) 
    Returns a random permutation of a string by shuffling the letters. 
 just(s, chars, squash ) 
    Returns only those characters in s that are also in chars. Useful for 
    picking numbers out of dates and times and so on. By default all the 
 choose(n,s,t) 
    Select s or t based on the value of n. If n is 1 (true) then choose s, 
    if n is 0 then choose t. 
 md5(s) 
    Returns a 256 bit (32 character) digest from a string using the well 
    known MD5 hash algorithm. 
 Trigonometric functions 
    Implemented are: 
    sin(), cos(), and tan(): These trigonometric functions take arguments 
    in radians, and return the appropriate value. 
    The inverse functions asin(), acos(), and atan() return values in 
    radians. The results will always be the first quadrant so asin(sin(x)) 
    does not always equal x sind(), cosd(), and tand(): These 
    trigonometric functions take arguments in degrees, and return the 
    appropriate value. 
    And there are the corresponding inverse functions: asind(), acosd(), 
    and atand(). 
    The two argument form of arctan is also provided as atan2. radians() 
    takes an angular measure in degrees and returns radians. degrees() 
    takes an angular measure in radians and returns degrees. 
 Roots, logs, and powers 
    Implemented are: 
    sqrt(x) square root of x, 0 is returned for negative numbers. 
    cbrt(x) cube root. 
    log(x) natural logarithm. For common logs divide the answer by 
    log(10). (Save it as a constant, don't keep calling the function). 
    exp(x) ex The opposite of log() in some senses. 
    pow(x,y) xy. A generalized implementation of the REXX ** operator that 
    allows fractional exponents. 
 Integer functions 
    Implemented are: floor, ceiling, mod, fact, perm, comb,gcd, round, 
    commify 
   

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs