WRKROMNUM WORK ROMAN NUMERAL TAANBRF |
The Work Roman Numeral tool provides 3 commands. CVTFRMROM converts
from a Roman Numeral such as LX to a decimal value. CVTTOROM
converts from a decimal value to a Roman Numeral value. WRKROMNUM
provides a work display with both functions.
A typical series of commands to convert from a Roman numeral to a
decimal value would be:
DCL &DECVAL *DEC LEN(15 0)
.
CVTFRMROM ROMNUM(VLII) DECVAL(&DECVAL)
The &DECVAL return parameter would contain 47.
There are no definitive rules about how to write a decimal value.
For example, 'LL' or 'C' will produce a decimal value of 100 with 'C'
as the most normally used value. In general, the value for a digit 9
or 4 is created by using a prefix to subtract from the next value.
For example, 'IX' is equal to 9 and 'CM' is equal to 900. The value
'IV' is used instead of 4 single 'I's ('IIII'). A prefix can only
precede a higher value.
There is no Roman numeral for 5,000 or 10,000. 'MMMMM' would be used
for 5,000.
Valid Roman numeral characters
------------------------------
I = 1
V = 5
X = 10
L = 50
C = 100
D = 500
M = 1000
A date such as 1992 could be written as 'MCMXCII'
CVTFRMROM escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
CVTTOROM escape messages you can monitor for
--------------------------------------------
None. Escape messages from based on functions will be re-sent.
WRKROMNUM escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
CVTFRMROM Command parameters *CMD
----------------------------
ROMNUM The Roman numeral to be converted. It must contain
valid Roman numerals. Up to 19 characters may be
entered.
The value cannot begin with more than 7 M's.
If an illogical value such as M followed by 18 D's,
the code attempts to convert the value.
DECVAL The return decimal value. It must be specified as
*DEC LEN(15 0).
CVTTOROM Command parameters *CMD
---------------------------
DECVAL The decimal value to be converted. It must be in a
range of 0 to 8500.
ROMNUM The return Roman numeral value. It must be declared
as *CHAR LEN(19).
WRKROMNUM Command parameters *CMD
----------------------------
The command has no parameters and provides a work display.
Restrictions
------------
The 2 CVTxxx commands return variables and may only be used in a CL
like program.
The WRKROMNUM command may only be used in an interactive environment.
Prerequisites
-------------
The following TAA Tools must be on your system:
SNDESCINF Send escape information
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CVTFRMROM *CMD TAANBRF QATTCMD
WRKROMNUM *CMD TAANBRF2 QATTCMD
CVTTOROM *CMD TAANBRF3 QATTCMD
TAANBRFC *PGM CLP TAANBRFC QATTCL
TAANBRFC2 *PGM CLP TAANBRFC2 QATTCL
TAANBRFC3 *PGM CLP TAANBRFC3 QATTCL
TAANBRFD *FILE DSPF TAANBRFD QATTDDS
Structure
---------
CVTFRMROM Cmd
TAANBRFC CL pgm
CVTTOROM Cmd
TAANBRFC3 CL pgm
WRKROMNUM Cmd
TAANBRFC2 CL pgm
TAANBRFD Display file
|
Added to TAA Productivity tools October 15, 2012