Disclaimer
This software is provided as is. All responsibility for determining fitness of purpose 
rests with you.

No liability is accepted for any loss or damage or consequential loss or damage 
arising directly or indirectly out of the use of the software or for any other reason.  It 
is entirely your responsibility to take all necessary precautions to safeguard against 
any such loss or damage before, during and after the evaluation period.

Functionality
The provided external allows some additional string handling functions.
As there is a limitation in numbers of EXTERNALS, all functions are accessible from 
one major function name FX. The first parameter identifies the function, to be used.

Defining the External
Before the functions can be used they must be declared with an EXTERNAL 
statement:

EXTERNAL VDSXFN

Using the new Functions
The primary function name is @FX followed by the function name, and is 
parameters:
i.e.	%x = @FX(REPSTR,%a,%b,%c)

Functions
All following functions are case sensitive. You can switch automatically to upper 
cases using the command:

FX PARSING,UPPER

To switch it back use:

FX PARSING,MIXED
 
All functions which work with strings, have a maximum limit of 255 character. 

COMPARE or CLC
Returns a value, depending on a compare result. The compare takes place between 
the first two parameters. The result may be less, than value1 will be returned, or 
equal than value2 will be returned ,or greater than value3 will be returned. Value1 
defaults to -1, value2 defaults to 0, value3 defaults to 1. In comparisons between 
numeric and alphanumeric strings, numeric strings are always smaller.
Syntax:
@FX(COMPARE,string1,string2,value1,value2,value3)
Example:
@FX(COMPARE,15,20,0,1,2)		returns	0

GOTO @FX(COMPARE,%A,%B,XLT,XEQ,XGT)	creates a dynamic branch,
depending on the compare
result
%c = @FX(COMPARE,%A,%B,1,10,0)			sets depending on the compare
result the variable 
a becomes 1, if %a<%b
a becomes 10, if %a=%b a
becomes 0, if %a>%b

COPIES
Concatenates a provided string with itself, the number specifies the number of 
concatenations.
Syntax:
@FX(COPIES,string,number)
Example:
@FX(COPIES,12345,4)			returns 12345123451234512345

LASTPOS
Returns the last postion of a sub string in a string.

Syntax:
@fx(LASTPOS,sub-string,string)

Example:
@fx(LASTPOS,DEF,ABCDEFABCDEF)		returns 10

LEFT
Justifies a string to the left, if the requested length is greater than the string, the 
returned string is padded with the padding character at the right. If the requested 
length is less than the string length, the string is truncated at the right. The padding 
characters defaults to blank, if not defined.

Syntax:
@FX(LEFT,string,length,pad-char)
Example:
@FX(LEFT,12345,7,x)			returns 12345xx

MAX
Returns the largest value from the list of passed arguments

Syntax:
@FX(MAX,value,value,value,...)

Example:
@FX(MAX,1,2,3,4,5,6,7,8,9,10,99,12,13,14,100)	returns 	100

MIN
Returns the smallest value from the list of passed arguments

Syntax:
@FX(MIN,value,value,value,...)

Example:
@FX(MIN,1,2,3,4,5,6,7,8,9,10,99,12,13,14,100)	returns 	1

OVERLAY
The OVERLAY function returns source string which is overlayed by a substring.

Syntax:
@fx(OVERLAY,sub-string,string,offset[,length])
the optional length parameter defaults to the length of sub-string.

Example:
@fx(OVERLAY,1234567890123,ABC,7,5)		returns	123456ABC  23

REVERSE
Reverses a given string

Syntax:
@fx(REVERSE,string)

Example:
@fx(REVERSE,1234567890)		returns 0987654321

REPSTR
Replaces in a source string a search string by a replace string. Further replaces can 
be invoked, by specifying a next search and replace string. There is no explicit limit 
for search and replace strings, but the complete function definition must not exceed 
255 characters.

Syntax:
@FX(REPSTR,source-string,search-string,replace-string[,s-string,r-string[,..]])

Example:
@FX(REPSTR,ABCDEFG,AB,12345,DE,3456)	returns	12345C3456FG
@FX(REPSTR,ENGLISH IS SPOKEN BY THE ENGLISH,ENGLISH,FRENCH)
					returns FRENCH IS SPOKEN BY THE FRENCH

RIGHT
Justifies a string to the right, if the requested length is greater than the string, the 
returned string is padded with the padding character at the left. If the requested 
length is less than the string length, the string is truncated at the left. The padding 
characters defaults to blank, if not defined.

Syntax:
@FX(RIGHT,string,length,pad-char)
Example:
@FX(RIGHT,12345,7,x)			returns xx12345
TABLE
Checks if a value, is part of a list of values, 0 is returned if value is not part of the 
list, otherwise the list index is returned.
Syntax:
@FX(TABLE,source-string,value1,value2,value3...)

Example:
@FX(TABLE,READ,UPDATE,WRITE,READ)			returns	3
@FX(TABLE,WRITE,SYSTEM,HIDDEN,ARCHIVE)		returns	0

TIME
TIME returns the relative day time in milliseconds, it can be used within arithmetic 
expressions to calculate the elapsed time.

Syntax:
@FX(TIME)

TRANSLATE
The TRANSLATE function translates specified characters in a source string into 
other characters. The output translation table is padded with blanks or truncated to 
the length of the input table.

Syntax:
@FX(TRANSLATE,source-string,output-table,input-table)

Example:
This demonstrates how words can be separated, if more than one field separator is 
used:
@FX(TRANSLATE,first+second-third*fourth,;;;,+-*)
returns	 first;second;third;fourth

The returned string can be split up, using PARSE with ; as field separator.

VERSION
Returns the actual version of the DLL, just in case their might further versions. 

WORD
Returns the contents of the requested word in a string. Words are delimited by 
characters defined in the optional word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORD,string,word-number,word-delimiter)

Example:
@FX(WORD,"FX(123) + ABCD-12",3,"() +-")		returns ABCD

WORDDEL
Deletes the requested word in a string. Words are delimited by characters defined in 
the optional word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORDDEL,string,word-number,word-delimiter)
Example:
@FX(WORDDEL,"FX(123) + ABCD-12",4,"() +-")	returns FX(123) + ABCD-

WORDFIND
Finds the requested word in a string and returns the word number. If the word is not 
present, 0 is returned. Words are delimited by characters defined in the optional 
word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORDFIND,string,word-string,word-delimiter)
Example:
@FX(WORDFIND,"FX(123) + ABCD-12",ABCD,"() +-")	returns 3

WORDPOS
Returns the position of the requested word in a string. Words are delimited by 
characters defined in the optional word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORDPOS,string,word-number,word-delimiter)

Example:
@FX(WORDPOS,"FX(123) + ABCD-12",2,"() +-")		returns 123 
(second word)

WORDREP
Replaces the requested word by a new word. Words are delimited by characters 
defined in the optional word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORDREP,string,word-number,new-word,word-delimiter)
Example:
@FX(WORDFIND,"FX(123) + ABCD-12",2,new,"() +-")	returns 
"FX(new) + ABCD-12",2

WORDS
Returns the number of Words in a string. Words are delimited by characters defined 
in the optional word delimiter parameter. It defaults to blank.

Syntax:
@FX(WORDS,string,word-delimiter)

Example:
@FX(WORDS,"FX(123) + ABCD-12","() +-")		returns 4 

