Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
suganthyprabha

New User

Joined: 28 Jul 2005
Posts: 58

 Posted: Thu Dec 22, 2005 2:35 pm    Post subject: Logic help using perform Loops 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.

veenag_gopal

New User

Joined: 14 Nov 2005
Posts: 14
Location: India

 Posted: Thu Dec 22, 2005 3:11 pm    Post subject: Re: Logic help using perform Loops 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.
priyesh.agrawal

Senior Member

Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

 Posted: Thu Dec 22, 2005 4:28 pm    Post subject: Re: Logic help using perform Loops 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.
suganthyprabha

New User

Joined: 28 Jul 2005
Posts: 58

 Posted: Thu Dec 22, 2005 4:34 pm    Post subject: Re: Logic help using perform Loops 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.
raghunathns

Active User

Joined: 08 Dec 2005
Posts: 127
Location: rochester

 Posted: Thu Dec 22, 2005 7:49 pm    Post subject: 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Removing the period or dot from the v... gopinak COBOL Programming 6 Wed May 09, 2018 1:53 pm Logic to skip Maximum time-stamp and ... vickey_dw DB2 2 Thu Feb 01, 2018 11:15 pm Is CICS BMS logic on z/OS different ... Andi1982 CICS 2 Fri Dec 01, 2017 1:56 pm Need help in building a logic Benchwarmer All Other Mainframe Topics 4 Wed Feb 22, 2017 2:49 am Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us