This REXX program runs on all REXX platforms and is an easy tool to convert monetary amounts among the different EURO currencies.
Here is program EURO:
/* REXX - EURO */
/* Copyright Gerhard Mayer 2001,2002 */
/* Supply three values in the following sequence:
- source currency as a three character code
- target currency as a three character code
- monetary value or expression
Get the results on standard output (STDOUT) (usually terminal)
Note 1: All currencies must be specified using their ISO code:
EUR DEM FRF BEF NLG ESP PTE ITL ATS IEP FIM
Note 2: Decimal values MUST be supplied using American notation (using
DecimalPOINT), e.g. EURO DEM ITL 23.45
Note 3: The result will be computed using the official
reference
rate and is rounded to two decimal digits.
*/
Parse Upper Arg src trg line
Numeric Digits 20
/* Define constants */
currs = 'EUR DEM FRF
BEF NLG ESP
PTE ' ,
'ITL ATS IEP
FIM '
fakts = '1 1.95583 6.55957 40.3399 2.20371 166.386
200.482' ,
'1936.27 13.7603 .787564 5.94573'
If Wordpos(src,currs) = 0 Then Do
Say 'Source currency invalid:' src
Exit 12
End
If Wordpos(trg,currs) = 0 Then Do
Say 'Target currency invalid:' trg
Exit 12
End
nowords = Words(currs)
Do i=1 To nowords
dmy = Value(Word(currs,i),Word(fakts,i))
End
If line = '' Then line = 0
Interpret 'res = ' line
Interpret 'res = ' res * Value(trg) / Value(src)
res = Format(res,,2)
Say res
Exit
Examples:
EURO EUR DEM 100
==> 195.58
EURO DEM EUR 195.58
==> 100.00
EURO DEM ATS 100 * 2.5 ==>
1758.88
Conditions of Use | ©Gerhard Mayer 2001,2002 | |
Download | Back | Homepage |