:oops:
Just can’t see the error here. Running on Windows XP with Natural 6.3
I get the following message :
NAT0245 Invalid use/order of clauses in DEFINE DATA statement.
Here’s the code;
DEFINE DATA
PARAMETER
1 #AMOUNT (N18.2)
1 REDEFINE #AMOUNT
2 #FIXED (N18)
2 REDEFINE #FIXED
3 #VALUE (N3/1:6)
2 #CENTS (N0.2)
1 #TEXT (A250)
1 #CURRENCY (A20)
LOCAL
1 #GROUPS (A11/1:6) INIT
(05) <‘Thousand’> (04) <‘Million’> (03) <‘Billion’>
(02) <‘Trillion’> (01) <‘Quadrillion’>
1 #I (I1)
1 #UNITS (A15/0:19) INIT (00) <‘Zero’>
(01) <‘One’> (02) <‘Two’> (03) <‘Three’>
(04) <‘Four’> (05) <‘Five’> (06) <‘Six’>
(07) <‘Seven’> (08) <‘Eight’> (09) <‘Nine’>
(10) <‘Ten’> (11) <‘Eleven’> (12) <‘Twelve’>
(13) <‘Thirteen’> (14) <‘Fourteen’> (15) <‘Fifteen’>
(16) <‘Sixteen’> (17) <‘Seventeen’> (18) <‘Eighteen’>
(19) <‘Nineteen’>
1 #TENS (A15/1:10) INIT
(01) <‘Twenty’> (02) <‘Thirty’> (03) <‘Forty’>
(04) <‘Fifty’> (05) <‘Sixty’> (06) <‘Seventy’>
(07) <‘Eighty’> (08) <‘Ninety’>
1 #TEMP (N3)
1 REDEFINE #TEMP
2 #TEMP-H (N1)
2 #TEMP-TU (N2)
2 REDEFINE #TEMP-TU
3 #TEMP-T (N1)
3 #TEMP-U (N1)
1 #TEMP-DESC (A50)
END-DEFINE
*
RESET #TEXT
*
/* Process the Integer Value first
IF #FIXED NE 0
FOR #I = 1 TO 6
#TEMP := #VALUE(#I)
IF #TEMP NE 0 THEN
PERFORM GET-VALUE
COMPRESS #TEXT #TEMP-DESC #GROUPS(#I) INTO #TEXT
END-IF
END-FOR
COMPRESS #TEXT #CURRENCY INTO #TEXT
ELSE
MOVE 0 TO #TEMP
PERFORM GET-VALUE
COMPRESS ‘Zero’ #CURRENCY INTO #TEXT
END-IF
*
/* Process the Decimal Value last
#TEMP := #CENTS * 100
PERFORM GET-VALUE
*
COMPRESS #TEXT ‘and’ #TEMP-DESC ‘Cents’ INTO #TEXT
*
MOVE LEFT #TEXT TO #TEXT
DEFINE SUBROUTINE GET-VALUE
IF #TEMP-TU = 0 THRU 19
#TEMP-DESC := #UNITS(#TEMP-TU)
ELSE
IF #TEMP-U = 0 THEN
#TEMP-DESC := #TENS(#TEMP-T - 1)
ELSE
COMPRESS #TENS(#TEMP-T - 1) #UNITS(#TEMP-U) INTO #TEMP-DESC
END-IF
END-IF
IF #TEMP-H > 0 THEN
IF #TEMP-TU NE 0 THEN
COMPRESS #UNITS(#TEMP-H) ‘Hundred and’ #TEMP-DESC INTO #TEMP-DESC
ELSE
COMPRESS #UNITS(#TEMP-H) ‘Hundred’ INTO #TEMP-DESC
END-IF
END-IF
END-SUBROUTINE /* Get-Value
*
END