IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to create reports using COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sripriya

New User


Joined: 19 Apr 2005
Posts: 26

PostPosted: Mon Nov 28, 2005 7:25 pm
Reply with quote

Hi all,

Can I know how to generate reports using COBOL programs.

Thanks in advance,
Priya.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Mon Nov 28, 2005 9:42 pm
Reply with quote

Hi sripriya,

In order to generate reports you must make use of FILLER to design your screen in the form of a report.

NOTE

When the program is not intended to use selected fields in a record structure, define them as FILLER. FILLER items cannot be initialized or used in any operation of the procedure division

P.S.

Please search our forum for more details.

I have attached a sample program which generates report. The code uses Accept(lin,col) and Display(lin,col).
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Nov 28, 2005 9:43 pm
Reply with quote

Sripriya,

This is one of the main functions of a COBOL program, along with manipulating data.

To generate a report to sysout or a ps file, you need to do the following things in your program.

1 ? define an output file. Generally lrecl 133 in the file division ?FD? along with the associated SELECT.

In the JCL define the report as RECFM=FBA (REPORT is a reserved word pick something else)

2 ? in the working storage section, you need to define each type of line to be written to the file.
a) ? Headers (usually multiple, these contain Titles, Column names, editing line to make the report reader friendly [i.e. underscores for column names, etc]), detail lines, sub-totals and totals line (if appropriate)

3 ? also in working storage you need to define variables for line-count and page-count.

4 ? As you progress through your COBOL program you probably want edit the headers in the initialization paragraph with date, time, program name, starting page # = 1, etc. and write the headers to the file. Set the page-count = 1 and the line-count = however many lines of headers you wrote. (You?ll want to do a search in the forum for line carriage control characters)

Before you write each detail line, you?ll want to check the line-counter, and if greater than a specified value of # lines you want on a page re-write the headers incrementing the page-count and re-setting the line-count.

After each detail line you write, increment the line-count

Note: it?s also good to write a line out if there is nothing to report on a particular run ?i.e. ?NOTHING TO REPORT TODAY? It looks better than a blank report.

Hope this is what you were looking for. There is no magic bullet for creating reports.
Back to top
View user's profile Send private message
sripriya

New User


Joined: 19 Apr 2005
Posts: 26

PostPosted: Sat Dec 10, 2005 6:40 pm
Reply with quote

Thanks a lot. The answer was brief enough to get a clear idea.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top