View previous topic :: View next topic
|
Author |
Message |
suganthyprabha
New User
Joined: 28 Jul 2005 Posts: 58
|
|
|
|
Hi friends,
I want to write a outputfile reading from Inputfile.
Input file willbe having the data's like.
Partno unit cost
32567 8885 2.37 ---this is for 2005 year
for 2006,2007.2008,2009,2010 we have to calculate based on the 2005 year
2005 2006 2007 2008 2009 2010
0.98 0.991 0.999 1.059 1.0352 1.057
Output file should be like.
Partno unit cost
32567 8885 2.37 (-----2005)
32567 8885 2.3487 ( ------2006( 2.37 * 0.991))
32567 8885 2.3676 (-----2007(2.3487 * 0.999))
32567 8885 2.5098 (------2008(2.3676 * 1.059))
like this I should get output file for 5 years.
how to do this using loop, i can do perfom 1 by 1 until i=5, but the rate .991, .999 will be changing. howto use this in loop
can you give some idea for this.
Thanks and Regards,
Suganthy. |
|
Back to top |
|
|
veenag_gopal
New User
Joined: 14 Nov 2005 Posts: 14 Location: India
|
|
|
|
There is a input file having 3 columns.
fetch the cost and multiply it with the numbers to give a new cost.
1.You can use an accept statement to accept the various values inside the loop and inside the loop itself you can use the display statements to display various values for your reference .
2.you can send all the values through parm in jcl and use reference modification to take those values and calculate.
This is quite cumbersome so i suggest you stick to the first method .
3.You can also use a file which has year and the numbers and use the file using the read statement and calculate.
And then using variables for the hyphens and opening and the closing brackets or hardcoding the brackets you can string the values into a variable and write it into the output file.If still any doubts please tell.
I think while stringing the asterics you have to use back slash to avoid any compile error; i think logic error.
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
suganthyprabha,
Is there any reason behind the values given for each years.
or any relationship between the values by which you can find values for next year.
Regards,
Priyesh. |
|
Back to top |
|
|
suganthyprabha
New User
Joined: 28 Jul 2005 Posts: 58
|
|
|
|
Hi Priyesh,
Actually this is not my requirement. One of my friend asked to me.
So i don't know the relationship. So i will ask her, Then i will post it.
Thanks and Regards,
Suagnthy. |
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
If the rate is fixed the store in working storage. otherwise read from file and store in 'ws-rate-d' elements
01 ws-rate-d.
05 rate1 pic 9v999 value 0.991
05 rate2 pic 9v999 value 0.999
........
01 ws-rate redefines ws-rate-d.
05 ws-rate occurs 5 times pic 9v999
Perform varying i from 2 by 1 until i > 5
amt(i) = amt(i-1) * ws-rate(i-1)
*** 2.3487=( 2.37 * 0.991) ********
end-perform
is that you are looking for. |
|
Back to top |
|
|
|