4.6.3.3 Sample Library Functions

    This version of RES-Reach includes several library functions which can be used in conjunction with private and public variables. Please note that limited support is being provided for them. The general syntax for these SET tags is:

    
       <SET VARIABLE="varname" FUNCTION="someFunction" VALUE="functionInputValue">
    
    
    Before any of these functions can be used, the run-time variable LIBS must be assigned the RES-Reach library:
    
       <SET VARIABLE="_RUN.LIBS" VALUE="R32DLL.DLL">
    
    
    If you omit this run-time variable assignment, a parsing error will be triggered.

    Function

    Description

       

    URLENC

    URL encode the given string. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="URLENC" VALUE="{StringToConvert}">
    

    UPPER

    Uppercase the given string. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="UPPER" VALUE="{StringToConvert}">
    

    LOWER

    Lowercase the given string. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="LOWER" VALUE=" {StringToConvert}">
    

    ASC

    Return the ASCII code for the specified character. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new code string" FUNCTION="ASC" VALUE=" {a character string}">
    

    CHR

    Return the character for the specified ASCII code. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new character string" FUNCTION="CHR" VALUE=" {NumberString}">
    

    INCR

    Increment the number in the input string. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="INCR" VALUE="{Counter}">
    

    DECR

    Decrement the number in the input string. The VALUE element is not optional.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="DECR" VALUE=" {Counter}">
    

    TOGMT

    Convert the input time to GMT time of the form "Weekday, DD MMM YYYY HH:MM:SS GMT". Some acceptable input date formats are:

    1. mm/dd/yyyy hh:mm:ss
    2. dd/mm/yyyy hh:mm:ss
    3. hh:mm:ss
    4. hh:mm
    5. dd/mm/yyyy
    6. dd-mm-yyyy
    7. mmm dd, yyyy hh:mm:ss
    8. dd mmm yyyy

    Where mm/dd/yyyy and dd/mm/yyyy are indistinguishable, mm/dd/yyyy is assumed. Where information is missing, the current server date and time are assumed.

    The VALUE element is not optional. To get the current server date and time set the VALUE element to the empty string.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="TOGMT" VALUE=" {DATE} {TIME}">
    

    RANDOM

    Return a random number. The VALUE element is optional. If supplied, it is used as a random number generator seed.

    Syntax:

    <SET VARIABLE="new string" FUNCTION="RANDOM" VALUE=" {Seed}">
    

    Notes:

    1. Arguments sent to external functions cannot exceed approximately 4100 characters in length.
    2. The INCR and DECR functions operate correctly on long integer values only. If you supply
      a floating point number, the function will truncate any digits after the decimal point
      and try to increment the result.

    Example Statements:

    
       <SET VARIABLE="_RUN.LIBS" VALUE="R32DLL.DLL">
    
       <SET VARIABLE="UPVAR" FUNCTION="UPPER" VALUE="this was lowercase">
       UPPER("this was lowercase"): {UPVAR}<BR>
    
       <SET VARIABLE="TEMPVAR" FUNCTION="LOWER" VALUE="{UPVAR}">
       LOWER("{UPVAR}") : {TEMPVAR}<BR>
    
       <SET VARIABLE="URLSTR" FUNCTION="URLENC" VALUE="http://res12.res.ca/cgi-bin/member.exe?NBT=testsuites/res-reach/normal/funcs.nbt">
       URLENC("http://res12.res.ca/cgi-bin/member.exe?NBT=testsuites/res-reach/normal/funcs.nbt"): {URLSTR}<BR>
    
       <SET VARIABLE="ASCII" FUNCTION="ASC" VALUE="A">
       ASC('A') : {ASCII}<BR>
    
       <SET VARIABLE="CHR" FUNCTION="CHR" VALUE="97">
       CHR(97) : {CHR}<BR>
    
       <SET VARIABLE="INCVAR" FUNCTION="INCR" VALUE="12345">
       INCR(12345) : {INCVAR}<BR>
    
       <SET VARIABLE="DECVAR" FUNCTION="DECR" VALUE="987">
       DECR(987) : {DECVAR}<BR>
    
       <SET VARIABLE="RND" FUNCTION="RANDOM">
       RANDOM : {RND}<BR>
    
       <SET VARIABLE="RND" FUNCTION="RANDOM" VALUE="123">
       RANDOM(123) : {RND}<BR>
    
       <SET VARIABLE="GMT" FUNCTION="TOGMT" VALUE="19-08-2010 23:30">
       TOGMT("19-08-2010") : {GMT}<BR>
       <SET VARIABLE="GMT" FUNCTION="TOGMT" VALUE="Jun 9, 1999 16:32">
       TOGMT("Jun 9, 1999 16:32") : {GMT}<BR>
       <SET VARIABLE="GMT" FUNCTION="TOGMT" VALUE="23:32:30">
       TOGMT("23:32:30") : {GMT}<BR>