Report writer program in cobol
First, you paint the report layouts, called mock-ups, in the Report Painter, which provides a free-form definition facility. You can define the mock-up by typing literals and output fields to visually represent the report output. You can specify both floating numeric and alphanumeric output edit masks directly within the report mock-up.
The mock-ups are available as report templates or for use in multiple programs. Report Writer structures let you automatically perform paging, calculate field values, test and execute control breaks, generate multiple reports, and generate all logic necessary to map fields between reports and databases or files.
You can include multiple reports in a single program. Using the Program Painter IO and FD keywords, you name the input data file, the output report file, and the report itself. There are two types of format entries:. APS categorizes the report lines into report groups, which are groups of report lines that make up the headings, body, and footings of the report. The entries defining the individual groups of a report are coded following the Report Description entry in the Report Section.
The syntax for the group definitions is very similar to that used to code group items in storage. In the next few paragraphs I will present the syntax and rules for coding report group entries.
Although I present all the clauses, including some quite advanced ones, they are not all required for all reports; in fact, many reports can be coded with only a few very simple entries. A report group is a set of data made up of one or more print lines with one or more data items.
This entry defines the characteristics of a report group. The placement of an item in relation to the entire report group, the hierarchy of a particular group within a report group, the format description of all items, and any control factors associated with the group -- all are defined in the entry.
The system of level numbers is employed here to indicate elementary items and group items within the range of Pictorially to the programmer, a report group is a line, or a series of lines, initially consisting of all spaces; its length is determined by the compiler based on the associated File Description specifications.
Within the framework of a report, the order of report groups specified is not significant. Within the framework of a report group. The description of a report group is analogous to the data record and consists of a set of entries defining the characteristics of the included elements.
However, unlike a data record, any positions in a report line for which no elementary item is defined will be filled with spaces. The report group description entry specifies the characteristics of a particular report group and of the individual data-names within a report group. A report group may be comprised of one or more report groups. Each report group is described by a hierarchy of entries similar to the description of the data record.
There are three types of report groups: heading, detail, and footing. A report group is considered to be one unit of the report consisting of a line or a series of lines that are printed or not printed under certain conditions. The LINE clause indicates the absolute or relative line number of a particular entry in reference to the page or a previous entry.
The syntax of the LINE clause is:. It indicates the fixed line of the page in which the line is to be printed. Integer-2 indicates a relative line number that specifies the number of lines to be skipped before printing the line.
The line is relative to the previous line printed or skipped. The TYPE clause specifies the particular type of report group that is described in any particular entry and indicates the time at which the report group is to be generated.
The syntax for the TYPE clause is:. There can be only one report group of this type for each identifier and for the FINAL specified in a report. There can be only one report group of this type in a report. The COLUMN clause indicates the absolute column number in the printed page of the leftmost character of an elementary item.
Integer-1 must be a positive integer. The clause can only be given at the elementary level within a report group. The clause must be specified only at the elementary level within a Detail report group.
The elementary item is not only group-indicated on the first Detail report group containing the item after a control break, but is also indicated on the first Detail report group containing the item on a new page, even though a control break did not occur.
The RESET clause may be used for programming totaling of identifiers where subtotals of identifiers may be desired without automatic resetting upon printing the report group. The syntax of the SUM clause is:. To code the entries, I refer back to the transaction record layout, for field names, and the layout for the report, for line and column positions, as well as literal values.
The entries required to produce the report are:. In this extremely simple report, all the information is provided with the VALUE clause and literal values. The report name is printed on the first line of each page, followed by column headings on the third line. As you see, even though the syntax and rules for the report group information is extensive and may initially seem confusing, you do not need to use all of the clauses for every report. It is quite easy to generate a simple report with very little coding.
This is called detail reporting. If the identifier is the name of a RD entry, the GENERATE statement does all the automatic operations of the Report Writer and updates the footing report group s within a particular report group without producing an actual detail report group associated with the report.
This is called summary reporting. As with other Declaratives Section statements, the USE statement must immediately follow a section header in the Declaratives Section of the Procedure Division, and must be followed by a period and a space. The remainder of the section must consist of one or more procedural paragraphs that define the procedures to be processed.
Data-name represents a report group named in the Report Section. The data-name must not be used in more than one USE statement. Otherwise the RWCS executes page advance processing. For all other cases the RWCS computes a trial sum in a work location.
The last line number on which the page footing report group can be presented is the line number specified by integer-1 of the PAGE clause. The report footing presentation rules are as follows:. Otherwise the first line number on which the report footing report group can be presented is the line number obtained by adding one and the value of integer-5 of the PAGE clause.
The last line number on which the report footing report group can be presented is the line number specified by integer-1 of the PAGE clause. The level-number indicates the position of a data item in the hierarchical structure of a report group.
Neither integer-1 nor integer-2 can be specified in such a way as to cause any line of a report group to be presented outside the vertical subdivision of the page designated for that report group type, as defined by the PAGE clause. See the section Presentation Rules Tables earlier in this chapter. The SIGN clause specifies the position and the mode of representation of the operational sign when it is necessary to describe these properties explicitly.
The SOURCE clause identifies the sending data item that is moved to an associated printable item defined in a report group description entry.
If the UPON phrase is omitted, any identifiers in the associated SUM clause which are themselves sum counters must be defined either in the same report group that contains this SUM clause or in a report group which is at a lower level in the control hierarchy of this report. When one of the addends is the sum counter defined by the data description entry in which that SUM clause appears, the initial value of that sum counter at the time of summation is used in the summing operation.
Sum counters are initially set to zero by the report writer control system during the execution of the INITIATE statement for the report containing the sum counter. The TYPE clause specifies the particular type of report group that is described by this entry and indicates the time at which the report group is to be processed by the RWCS. Except where otherwise stated in the general rules below, the terms "reel" and "unit" are equivalent and completely interchangeable in the CLOSE statement.
Treatment of sequential mass storage files is logically equivalent to the treatment of a file on tape or analogous sequential media. If label records are specified for the report file, the labels are processed according to the implementor's standard label convention.
The behavior of the CLOSE statement when label records are specified but not present, or when records are not specified but are present, is undefined. Closing operations specified by the implementor are executed. If label records are not specified for the report file, label processing does not take place but other closing operations specified by the implementor are executed.
The current reel or unit is rewound, when applicable, and the reel or unit is logically removed from the run unit; however, the reel or unit can be accessed again, in its proper order of reels or units in the report file, if a CLOSE statement without the REEL or UNIT phrase is subsequently executed for this report file followed by the execution of an OPEN statement for the report file. The report file is locked and cannot be opened again during this execution of this run unit.
Execution of this statement is considered successful. The file remains in the open mode, and no action takes place except as specified in general rule 4. All rights reserved. This document and the proprietary marks and names used herein are protected by international law.
A blank entry in column 1 or column 2 indicates that the named clause is totally absent from the report group description entry. If the PAGE clause is omitted from the report description entry, then a page heading report group can not be defined. If the PAGE clause is omitted from the report description entry, then a page footing report group can not be defined. Note for the browsable PDF edition. This version is a true rendering of the original printeddocument, but with color replacing lines and arrows, and many cross-references or hotspots inserted.
When reading text that refers elsewhere, please probe for these hot spotsto get there automatically. Also, these Preface sheets were simplified for convenience. This publication is intended for programmers engaged in the writing of new COBOL programs usingReport Writer, or the maintenance of old ones.
Most of the text is intended for the generalapplication programmer, but there is also information in part 5 for the systems programmer engagedin writing user extensions, such as for special output devices.
The language described in this eigth edition includes all the extensions to the Report Writer featuredescribed in the ANS standard and enhancements to the language made up to May The tutorial is a step-by-step introduction, containing sufficient detail to enable programmers to writeor maintain simple Report Writer code, while giving them an appreciation of what is possible usingthe more advanced features.
The language description contains a formal explanation of the syntax and illustrated explanation ofthe usage of each clause and statement. You can obtain notification of your use of anyextensions by means of a precompiler option see Installation and Operation.
0コメント