Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Logic help using perform Loops

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Thu Dec 22, 2005 2:35 pm    Post subject: Logic help using perform Loops
Reply with quote

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
View user's profile Send private message

veenag_gopal

New User


Joined: 14 Nov 2005
Posts: 14
Location: India

PostPosted: Thu Dec 22, 2005 3:11 pm    Post subject: Re: Logic help using perform Loops
Reply with quote

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.
icon_rolleyes.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


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

PostPosted: Thu Dec 22, 2005 4:28 pm    Post subject: Re: Logic help using perform Loops
Reply with quote

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
View user's profile Send private message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Thu Dec 22, 2005 4:34 pm    Post subject: Re: Logic help using perform Loops
Reply with quote

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
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Thu Dec 22, 2005 7:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm
No new posts How to perform Digest Access Authenti... vasanthz All Other Mainframe Topics 0 Tue Mar 15, 2016 4:47 pm
No new posts Sort Logic to extract data scorp_rahul23 DFSORT/ICETOOL 13 Tue Mar 01, 2016 1:22 am
No new posts Need a logic to validate the data in ... sandeep kumar302 COBOL Programming 17 Mon Feb 01, 2016 3:30 pm
No new posts Tricky sort logic required pgopi92 DFSORT/ICETOOL 3 Mon Jan 25, 2016 3:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us