report writing



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

report writing

Postby ramesh reddy » Tue Aug 02, 2011 8:16 pm

i have one file like.
branch a/c no
1408 123456
1408 123456
1408 123456
1407 456789
1407 456789
1407 456789
like i have no.of records with same a/c no.
now i want to generate a report
Expected result:
branch >20(repeated a/c's count) <20(repeated a/c's count)
1408 0 3
1407 0 3
i want a report repeated accounts count under particular branch.
plz help me........can u give code....
ramesh reddy
 
Posts: 9
Joined: Fri Jan 28, 2011 7:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: report writing

Postby Robert Sample » Tue Aug 02, 2011 8:52 pm

We help you with code, but we typically don't provide you with code since you are not learning if you are given what you want. So what have you tried so far and what are you having trouble with?

Is this a homework assignment?

Are you using the COBOL REPORT WRITER or are you using regular COBOL statements to accomplish this report?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: report writing

Postby dick scherrer » Tue Aug 02, 2011 10:47 pm

Hello,

Is this a homework assignment?
It is quite allright it this is homework - one of the maine reasons this forum was opened was to help students.

As Robert mentoned, we will help - sometimes in great detail - but we do not intend to post entire solutions. We expect people to work and learn.

With only a few exceptions, if someon posts "the code" it is deleted . . .

Good luck,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: report writing

Postby ramesh reddy » Wed Aug 03, 2011 3:20 am

yes..this is homework assignment.
no need entire code..just i need how to do this ..a brief explain.
i am tying ,but not correct result.somewhere i am doing mistake.
thanks.
ramesh reddy
 
Posts: 9
Joined: Fri Jan 28, 2011 7:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: report writing

Postby dick scherrer » Wed Aug 03, 2011 3:27 am

Hello,

If you post what you have done so far, someone should be able to help resolve any problems. When posting, use the Code tag - we have a Preview option that wioll let you see your post as it will appera to the forum. When you are satisfied with how the post appears, Submit.

It iwll also help if you post a bit of the problem output and what it should have been.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: report writing

Postby Robert Sample » Wed Aug 03, 2011 3:54 am

Define a WORKING-STORAGE variable to hold the current branch id. Open the files, read the first record, set the count to one, move the branch id to the hold variable. Then loop until end of file: read the file, compare the branch id to the held branch id. If they are the same, add 1 to the count. If they are not the same, write a report line with the branch id and the count, move the read branch id to the hold branch variable, set the count back to 1.

When you're through with the loop, you'll need to write out the last branch id and count, close the files, then you're don.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: report writing

Postby BillyBoyo » Wed Aug 03, 2011 4:41 am

If you google for "cobol report writer manual" you should find an easy-to-use manual from IBM for the product.

The Report Writer does a lot of stuff for you that you'd normally have to code explicitly. The trick is to discover what it can do, and then how to use it, and then to let the Report Writer do it how it wants, with you having provided the information for control fields, sum fields, titles, detail lines etc.

Look up the manual, check out how to do what you want, give it a go and let us know if you get stuck with something, or can't understand how something is working, even if it does.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: report writing

Postby dick scherrer » Wed Aug 03, 2011 7:36 am

Hello,

Most of the sites i work with have not used the COBOL Report Writer for many years.

Whether it may be used for this would also depend on if the instructor will permit it. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: report writing

Postby BillyBoyo » Wed Aug 03, 2011 12:02 pm

Hello,

Same here. Got confused by the title and I assumed an affirmative to Robert's question. I even thought it was odd, but didn't double-check. Silly me.

Ramesh, unless you are learning the Report Writer, avoid it. It is a paid-for extra, and most sites don't. So people don't get experience with it. So site's don't use it. So they don't pay fort it. So people don't get... you get the picture.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: report writing

Postby ramesh reddy » Fri Aug 05, 2011 4:28 am

hi,
k..thanks for the information.
now i want to write the count in to file...
ramesh reddy
 
Posts: 9
Joined: Fri Jan 28, 2011 7:50 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post