Because I am new to RPGIV (existing using RPGIII) . Recently I need to write a sub-program using RPGIV (or RPGILE ? ).
This sub-program will receive two parmerter (X , Y) and output one parmeter (Z) (which are in numeric format - BTW what is the
max precision for numeric format in RPGIV / RPGILE? (i.e. max no of decimal points supported) )
The value of Y can be a negative number or number in value between 0 and 1 (ie. Y is a fraction number of 1/n) or number of value > 1)
The function of this sub-pgm is to calculate X to the power of Y and then return Z.
I have this in mind - > 4 cases:
(1) If Y < 0 (ie. -Y) , then Z = 1/ X to the power of +Y)
(2) If Y = 0 , then Z = 0
(3) If Y between 0 and 1 (a fraction of 1/n) , then Z= X to the power of n (with decimal digit)
(4) If Y > 1, then Z = X to the power of n
Examples as below:
if X=9 and n=2 then X**n = 81 (i.e 9**2)
if x=9 and n=0.5 (i.e. 1/2) then X**n =3 (i.e. square root)
Can anyone give some idea to me : How to implement this login in RPGIV (if possible, can it be show in source code ?)
Beside , Can this sub-program written in RPGIV / RPGILE be called by a traditional RPGIII program ?
Many many thanks
You can send directly to my mail box : email@example.com
April 22, 2005 1:39 AM
April 23, 2005 8:31 PM