Order:
setting the control breaks
Dropping
on a Normal Line (not Detail)
Dragging
data to the Detail Line
Line
Tags (Control Characters)
Reports
with Repeating (Table) Fields
Table
Cross-sections and Partial Extents.
PROCESS
statement and ROUTINE statements
Special
rules: $R-End-xxx routines
With PRINT most basic data reporting can be simply accomplished with basic Jazz, but what if you want more? How do you print averages for a region? Or handle arrays (tables)? The Jazz report designer allows you do graphically design a report as you would a screen, specifying logic executed on control break, and getting exactly the result that you want. Think Crystal Reports™ but using your mainframe data. This video shows you how it works.
To create a report, start the Jazz workbench and select dialog New/Logic/Report Designer: -
The Report Form allows you to set overall report characteristics such as the report files, title, line width, etc. Click here for details of this form.
When [Finish] is clicked the Report Form must be turned into a report program. Jazz needs some more information: for example we told Jazz that we want the data ordered, but we didn’t say what the sequence fields were. It gets this extra information via queries as it goes from the form to a report program and layout. Jazz resolves each query and then generates a Jazz report program and a report layout, and opens the Report Editor.
With the form as above, when we click [Finish]: -
We’ve checked WHERE. In this example we want to filter records by IN1.SalesYTD > 1000. From the form Jazz only knows that the program logic is going to use a statement “PROCESS IN1” with a WHERE condition, so it starts with a statement like this: -
PROCESS IN1 WHERE (IN1.? = ?) …
causing Jazz to invoke its query dialog.
Hint: drag the form’s right boundary to widen it if Mode [ ] obscures part of the Jazz statement
We expand the tree and select SalesYTD. Click [Finish]
The query dialog now moves on to the next “?”. Type 1000 and click [Finish] again.
This is NOT actually what we want: we now have a WHERE condition with “=”, where we want “>”. We’ll have to edit the PROCESS statement later.
On reaching ORDER(In1.?) the query dialog appears again. We expand In1 in the treeview and select the sequence fields. With each sequence field we’re asked if we want the field in descending order, and whether this is to be a control break field.
We select Region and District as Break fields, and Name as a sequence field without break. The report sequence will be in ascending order Region, District within Region, and Name within (Region and District).
By putting FR into Lookup File 1 Jazz knows that at the start of the first control break we’ll want to GET something from FR, but what? Jazz generates
GET FR WHERE(FR.? = ?);
and the Select Data dialog appears twice. We resolve FR.? by selecting FR.Region, and we resolve ? by selecting IN1.Region,
resulting in GET FR WHERE (FR.Region
= IN1.Region);
When all queries are resolved Jazz generates a program, and then opens the Report editor.
At this stage Jazz has created a program, and then opened the report editor to show the report layout. We can easily move between the two views. From the Report Editor [Close] (or [Cancel]) takes us back to the normal Jazz workbench. From the workbench [Report] will open the report editor, where we can drop further data on to the report, and drag data around to get exactly the appearance that we want. There are some things that we can only do in the Workbench, such as changing the WHERE condition from
PROCESS
In1 WHERE(IN1.SalesYTD
= 1000)
ORDER(IN1.Region BREAK,IN1.District BREAK) REPORT;
END
PROCESS In1;
to
PROCESS
In1 WHERE(IN1.SalesYTD
> 1000)
ORDER(IN1.Region BREAK,IN1.District BREAK) REPORT;
END
PROCESS In1;
Conversely, while it is possible to edit the PLINE statements, it is usually better to use the Report Editor to add, delete, and move fields and lines.
There are some special features of the Jazz statements that are used within Report programs. If you are planning to make more than minor changes to the Jazz logic you should read the section Jazz Report Programs later in this document so that you know what you can change and what you must not change.
Here is the Report Editor displaying newly-generated report REPORTX.
Expand the treeview to locate the data that we want. Click on the field that you want, and drag this to the position that we want on the report. You can’t drop on a tag (for example, #$R-Detail, they start with #), on to a Jazz statement (like *GET FR WHERE (FR.Region = IN1.Region); nor on another item, but you can drop anywhere in the filler space (...) or +Add another line …
The $R-Head-Region is created like this
It
contains logic to get a record from FR according to the relationship that we
gave: -
GET
FR WHERE (FR.Region
= IN1.Region);
Also a print line that will print the Region number. We can edit this line, for example dropping the FR.Name value that corresponds to IN1.Region. Here we’ve expanded FR, and dragged Name to the position shown in the $R-Head-Region section.
There are extra rules when data is dragged to the detail line. Here I’ve dragged IN1.Name to the detail line, dropping it on to “Add Another Line”. Because I’m dropping something into the detail section I may want to place a heading above it, and in other cases I may want to calculate subtotals.
I click [Close], and as well as the field Name being dropped on the line, another line with the field’s heading is placed in the PageHead routine. The heading is arranged so that it is aligned with the data field in the detail section, and the control character is “D” giving you a visual clue that these two lines are related: -
SalesLastMonth and SalesYTD are numeric fields, so when I drop them on to the detail line I have the option of summing the field: -
With SalesThisMonth and SalesYTD added to the report with Sum checked the report layout is now: -
Note that these numeric fields have been added so that
1. The heading, detail value, and total values are right-aligned
2. Because SalesThisMonth is a quite a long heading the whole group is moved to the right. There was a message about this. We might have edited the heading when we were asked if we wanted it, but an easier solution is to drag the field further right – we’ll do that shortly.
3. The totals fields have space for another four digits compared to the detail value. This should be enough to avoid overflow.
So far we’ve dropped individual fields. We can also drag and drop a group or a complete record: -
|
|
These are treated as a series of individual drag and drops, i.e. dropping RDKey is equivalent to dropping Region and then District. The second field is dropped on the same line. The Space value in the Group Drop section above the layout: -
dictates the minimum number of spaces between items.
If a group or record is dropped on to the detail line then each field triggers the dialog asking whether you want a heading and totals.
Relocating a single item – either a field or text such as the report title – is easy. Just drag the item to its new position and drop it. You can move an item from one routine to another. Of course it is your responsibility to ensure that the new position makes sense. For example, you could drag FR.Name from its present position in the $R-Head-Region routine to the $R-Head routine, but then its value may be blank because at this stage your program hasn’t read the FR record.
When you click on one of the items resulting from a detail-line drop you’ll see that all of the related items are selected. You don’t have to click the item in the detail line: the same result as below results from clicking the heading, the detail item, or any of the total fields: -
With a multiple selection like this the item group is moved together, preserving the alignment. The item group can only be moved sideways, it cannot be moved to a different line.
A single item can be moved wherever there is space. With multiple selections this must be true for all items of the group. If you’ve grabbed the detail item it looks as if you can move this 4 spaces to the left, but the heading is hard up against “*----Name-----*” so it can’t be moved left. Also, there’s only two characters on the right before the total fields run into SalesYTD’s total fields so that’s its maximum right drag. When drag limits are exceeded you’ll get one or more messages like: -
Reply [Yes] and the drag continues with the reduced shift. [No] and the drag&drop is abandoned. There may be further messages: for example a shift of 8 is allowable for the heading and detail lines, but not for the total lines because this would run into the total fields of SalesYTD. Jazz checks all the shifts before starting. If a later message reduces the shift to 4 then this is what is used for all lines, preserving alignment.
If you click another item in the report the existing selection is cleared. However if you hold down the Alt key while you click the item then the newly-clicked item is added to the selection list. If it is a member of an item group then the whole group is added. For example, with the selection above, if you hold down Alt and click one of the SalesYTD fields both item groups are selected. A drag will now drag both groups right or left, preserving their relative spacing.
If you click an item that is already selected while pressing Alt the selection toggles. Thus if you want to move the heading SalesThisMonth without moving the detail or total fields you could click it (selecting all 5 items), then alt-click the other four items leaving only the title selected. It can then be moved individually by alt-clicking it. You need to use alt-click because a normal click will select the related items again. If it was already selected (for example, you’ve done as above and unselected the other items) then it may appear to be unselected, but you’ll see the cursor change to the “Move” effect as you start the drag.
You can delete items with the Delete key, the Backspace key, or the Delete (trashcan) button.
You cannot delete tags (for example, #$R-Detail), nor +Add another line … You can delete text characters, filler characters, and control characters, and you can delete selected items.
When the cursor is positioned in filler, or within a text item, then deleting with the Delete or Backspace key deletes one character. If the cursor is positioned within a field then the delete keys function in the same way as the delete button, deleting all selected items.
You have a choice about the way that following items are handled. The default is “Fixed Mode”. In this mode following items retain their position: Jazz inserts filler into the line to replace the deleted item. With “Close up” mode the following items move left. Alignment of these items with their heading, detail, and totals may be lost, and so you may have to restore this with further editing. See Aligning Item Groups below.
If you click in filler and then press the Delete key or the Backspace key then a filler space is deleted, moving this item one space to the left. Note that this may put related items out of alignment. See Aligning Item Groups below to see how to restore alignment.
If you click on a text field then you can delete individual characters with the Delete or Backspace keys. The Delete button will delete the whole text field, plus any other selected items.
With one or more item(s) selected press the Delete key, or click the Delete (trashcan) button. If several items are selected, then they’ll all be deleted.
Select the control character, and delete it. This deletes the line. Note that just as detail-line fields are linked to headings and totals, so are the control characters of “D” lines, and when you click on one “D” control character the control characters of related lines are also selected. If you delete one of these lines all the related lines will also be deleted. If this is not what you want you should de-select them with CtrlClick before deleting the line(s) that you want to delete.
When lines are spaced you can reduce the spacing amount by clicking on the control character to select it, and then using the Delete or Backspace key to reduce the space by one. Do not use the Delete button: this will delete the whole control character, meaning that the whole line is deleted. Be careful that the line is not linked to others (see above). See Line Spacing and New Pages for more information.
Click the Undo button , or ctrl-Z, to undo the latest editing change. This applies to any editing changes, not just deletion.
If you exit from the Report Editor with [Cancel] then none of the editing changes will be saved, in effect undoing all changes. Especially when you’re new to the Report Designer and you’ve made a mess, this is a useful way of starting again from your last save point.
We can right-click an item on the report and a form appears describing the item. Here we’ve clicked on the Region Name field that we dropped on to the line in the $R-Head-Region section. The form shows that this item is a field displayed with picture (format) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, the source field is FR.Name, and it is placed on line 9, column 15. This is only information – we can’t change any of this here – but in other cases this form offers opportunities to edit the report.
We can type text anywhere on the edit form where we’d be allowed to drop a field, and we can also over-type existing text (but not fields). Also, if we right-click a text field we can edit it from the properties form: -
Here we can simply edit the report title on line 2.
When we right-click one of a group of related items then the properties form shows extra information about the group, and offers alignment options: -
By clicking one of the alignment buttons the heading text, detail field, and total fields are left-aligned, centred, or right-aligned. The item clicked – in this case the heading – is not moved, it is the other items that are moved right or left to achieve the alignment result. There may be messages if an item can’t be moved enough.
You may have noticed that the first character of every line is not printed, but seems to be a code that has some kind of meaning. There are two special lines that start and end a section: -
· Sections start with “#”, e.g. “#R-Page-Head”. This will become the routine name. You cannot type or drop data on to this line.
· Sections end with “+Add another line …”. You can type or drop on this line, causing a new line to be created above this line.
Other lines have a variety of codes. You can right-click the code and in some cases edit it.
The first line in #R-Page-Head starts with “P”. This indicates that this line is the first of a new page, and if you right-click this control character you see: -
Other report lines in the example start with blank or “D”. “D” is a visual clue that this line is related to a detail line – you see “D” on the item headings, the detail line itself, and the total lines. There may be several such lines.
Right-click the control character and you’ll see (for example): -
The Space value must be 1 or greater. By increasing the Space value here you’ll cause the line to be printed with one or more preceding blank lines. You can also increase spacing simply by clicking at the extreme left of a print line and then pressing Enter. If Space is greater than 1 the report editor will display these space lines: -
Right-click on the left of this line and you’ll see: -
Suppose that you want to print a report with subtotals and totals, but you don’t actually want the detail line: for example you might want a report summarising a file. As with the PRINT statement, you want your PLINE statement to include the SUMMARY option, meaning that it can control SUM calculations, but is not actually printed. To achieve this you can either write SUMMARY into the PLINE statement, or you can have the report editor create this option for you: -
Right-click on the control character of a detail line to display the properties of the control character. Because it is a detail line there is now a checkbox labelled “Summary”: -
Check this and the control character changes to “S”. When you [Close] the editor the PLINE statement will include SUMMARY, and extra editing rules will be checked: the line should not contain non-numeric fields, and every numeric field should include SUM. These rules will also be checked as new items are dragged to the line in the editing session.
“*” indicates a Jazz line, for example
These lines are not editable in the report editor, they are displayed as comments only.
Handling dimensioned fields with PRINT statements can be quite tricky. For example, with a record layout like this: -
DEFINE
INDim VB DATA(
RDKey
GROUP,
Region
DECIMAL(3),
District
DECIMAL(3),
END GROUP,
Name CHAR(15),
Sales(2) GROUP,
Month SMALLINT,
SalesThisMonth DECIMAL(7,2),
NbrSales SMALLINT,
End GROUP,
SalesYTD
DECIMAL(7,2),
…
you cannot write (*) references to the repeating fields in a PRINT statement. This PRINT statement is invalid
PRINT
(INDim.Region,INDim.District,INDim.Name,
INDim.Month(*),INDim.SalesThisMonth(*),INDim.NbrSales(*)) ;
Instead you have to provide subscripts, probably enclosing the PRINT within a loop like this: -
FOR INDim.Sales(IX1);
PRINT
(INDim.Region,INDim.District,INDim.Name,
INDim.Month(JZ.IX1),INDim.SalesThisMonth(JZ.IX1),INDim.NbrSales(JZ.IX1)) ;
END FOR;
It gets even more complicated if you don’t want non-subscripted fields like INDim.Region to be printed on every line.
(Note the use of the TABLE form of the FOR statement. Click here to learn more.)
With edited reports and PLINE the logic is managed for you. When you drag a dimensioned group or field such as INDim.Sales or INDim.Month to a print line then the dialog will ask you to supply a subscript. If you give a number or a field name (of a numeric field, preferably SMALLINT) then the reference to INDim.Sales(3) is handled like a normal reference. However if you specify *, for example INDim.Sales(*), meaning “All”, then the dialog will change the * to an index variable IX1 (or IX2, IX3, etc for multi-dimensioned tables) and look for a surrounding loop. If it can’t find such a loop, it will enclose the print line in FOR/END FOR statements. When expressed as PLINE statements in the Jazz Workbench this will appear as: -
FOR INDim.sales(IX1);
PLINE
('L' INDEX(1),INDim.Region INDEX(2) COL(8),INDim.District INDEX(3) COL(16),INDim.Name INDEX(4) COL(25),
INDim.Month(JZ.IX1) INDEX(5)
INDim.NbrSales(JZ.IX1) INDEX(7) SUM COL(69));
END FOR;
In this case the FOR is equivalent to
FOR JZ.IX1 = 1 TO 2;
causing two lines of printing for each record: -
Printed 07 Sep 2017, 19:44:35 in1d Report Title Page
4
Region
District *----Name-----* *-Sales--*
3 7
COURTENAY,John 206.02
4,640.25
3 7
GIBBS,Ann 206.02
4,640.25
An advantage of the form FOR INDim.Sales(IX1) is that the array bounds will automatically change should the definition of INDim be changed and the program re-generated.
If INDim.Sales had had 2 dimensions then the FOR statement would have been
FOR INDim.Sales(IX1, IX2);
and so on up to the maximum of 7 dimensions.
There may be a variable number of lines, for example if INDim.Sales had been defined with variable occurrences: -
DEFINE
INDim VB DATA(
…
NbrSales
SMALLINT,
Sales(12(NbrSales)) GROUP,
Month TINYINT,
SalesThisMonth DECIMAL(7,2),
End GROUP,
Because several lines can be produced from a line within a loop, other fields (such as INDim.District) are printed on the first line but are not reprinted unless page overflow causes a new page.
Default logic manages the entire table, but we might want to print a cross-section – part of the array varying one dimension but holding another dimension constant – or print only part of the table: for example only Table(1) to Table(6), not 1 to 12. For these situations we’ll need to modify the default logic. For example, here IN1D2.Sales is defined Sales(3,7) DECIMAL(7,2), so with logic
ROUTINE
$R-Detail;
* Every Record
FOR IN1D2.Sales(JZ.IX1,JZ.IX2);
PLINE
('D' INDEX(1),IN1D2.District INDEX(2) SUM COL(11),IN1D2.Name INDEX(3) COL(19),IN1D2.Sales(JZ.IX1,JZ.IX2) INDEX(4) SUM COL(40));
END FOR;
END
ROUTINE $R-Detail;
each input record produces 21 lines of printing: -
Printed 07 Sep 2017, 20:04:47 in1d2 Report
Title
Page 1
District *----Name-----* *-Sales--*
Region 1
1 BLEE,ElliottLin 78.00
79.00
80.00
81.00
82.00
83.00
84.00
85.00
86.00
87.00
88.00
89.00
90.00
91.00
92.00
93.00
94.00
95.00
96.00
97.00
98.00
1 HANNAH,Honour 241.00
242.00
243.00
It would be better if we printed IN1D2.Sales(1,JZ.IX2), IN1D2.Sales(2,JZ.IX2), and IN1D2.Sales(3,JZ.IX2) side by side, like this: -
District *----Name-----* *Sales(1)* *Sales(2)* *Sales(3)*
Region 1
1 BLEE,ElliottLin 78.00 85.00 92.00
79.00 86.00 93.00
80.00 87.00 94.00
81.00 88.00 95.00
82.00 89.00 96.00
83.00 90.00 97.00
84.00 91.00 98.00
1 HANNAH,Honour 241.00 248.00 255.00
242.00 249.00 256.00
243.00 250.00 257.00
244.00 251.00 258.00
245.00 252.00 259.00
246.00 253.00 260.00
247.00 254.00 261.00
To achieve this we
· Change the FOR statement to FOR IN1D2.Sales(NULL,JZ.IX2) TESTNEW; so that only the 2nd dimension is processed.
·
Change the PLINE reference to IN1D2.Sales(JZ.IX1,JZ.IX2) to IN1D2.Sales(1,JZ.IX2).
If we were to print the report now it would look like this: -
District *----Name-----* *-Sales--*
Region 1
1 BLEE,ElliottLin 78.00
79.00
80.00
81.00
82.00
83.00
84.00
1 HANNAH,Honour 241.00
242.00
·
Drag Sales to the report twice more, each time
changing the subscript to a number (2 or 3), and checking Sum: -
·
Change the report’s column headings from *-Sales--* to *Sales(1)* etc. The report will now look like this.
District *----Name-----* *Sales(1)* *Sales(2)* *Sales(3)*
Region 1
1 BLEE,ElliottLin 78.00 85.00 92.00
79.00 86.00 93.00
80.00 87.00 94.00
81.00 88.00 95.00
82.00 89.00 96.00
83.00 90.00 97.00
84.00 91.00 98.00
1 HANNAH,Honour 241.00 248.00 255.00
242.00 249.00 256.00
…
Region 1 Subtotal
83 19,432.00 20,167.00 20,902.00
A line may be within a single FOR loop, or a nested series of loops, but items on one line cannot be controlled by different loops. Suppose that the input source has data like this: -
DEFINE
INDim2 VB DATA(
RDKey
GROUP,
Region
DECIMAL(3),
District
DECIMAL(3),
END GROUP,
Name CHAR(15),
Sales(12) GROUP,
Month TINYINT, [LIKE types.month,'
SalesThisMonth DECIMAL(7,2),
NbrSales SMALLINT,
End GROUP,
SalesYTD
DECIMAL(7,2),
RegionSales(5) GROUP,
SalesByRegion DECIMAL(7,2),
end GROUP,
Having dragged data from INDim2.Sales to the line, what would it mean to drag INDim2.SalesByRegion to the line? The PLINE is already within a loop, effectively FOR JZ.IX1 = 1 TO 12; so it can’t be within an alternative loop. But this code would be invalid: there are only 5 occurrences of INDim.SalesByRegion so references to INDim.SalesByRegion(6) and up will cause errors.
FOR INDim.sales(IX1);
PLINE
(…., INDim.NbrSales(JZ.IX1) …, INDim.SalesByRegion(JZ.IX1) …);
END FOR;
The problem can be solved like this. First put the PLINE within an IF condition: -
FOR INDim.sales(IX1);
IF IX1 < 6;
PLINE
(…., INDim.NbrSales(JZ.IX1) …, INDim.SalesByRegion(JZ.IX1) …);
END IF
END FOR;
Now add ELSE, and duplicate the PLINE statement but without INDim.SalesByRegion.
FOR INDim.sales(IX1);
IF IX1 < 6;
PLINE
(…., INDim.NbrSales(JZ.IX1) …, INDim.SalesByRegion(JZ.IX1) …);
ELSE;
PLINE
(…., INDim.NbrSales(JZ.IX1) …);
END IF
END FOR;
In this section we discuss the special features of the Jazz language designed to support Report programs, using Jazz program Report1 as our example. The first appendix Creating Program Report1 describes how this program is created, and Report 1 – Editor View shows the view when you click [Report] that you use to place data on the report. Report 1 – Jazz Program shows the final MANASYS Jazz program with the control logic and with the report layout defined by the PLINE statements that resulted from your Editor View editing. Finally Report 1 – Sample Report shows you the report that this program produces from some test data. You may edit the Jazz program, either directly in the Jazz workbench or in the report designer, but you cannot change the structure of the report – particularly the number and order of control breaks
This section highlights parts of the Jazz program, so that you can understand how it works.
A Report program has this structure: -
1. It starts with a PROGRAM statement with a REPORT option. For example: -
PROGRAM Report1 REPORT(132) PAGE(60);
2. From the PROGRAM to the PROCESS statements there are
probably only COPY and DEFINE statements. It is recommended that initialization
logic be written into the $R-Head routine, rather than before the PROCESS statement.
3. The PROCESS statement also has a
REPORT option. The next statement will be END PROCESS, there
will be no statements within the Process block.
PROCESS IN1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT;
END PROCESS IN1;
4.
Following
END PROCESS are a number of $R-xxx
routines. These will be invoked at appropriate
times as data is read from the input.
It is
important that you understand this structure and when the routines are invoked
so that you don’t refer to data when it is not correctly set. This is discussed
more below.
This is a SYSTEM definition, meaning that there is nothing generated into the COBOL program from this but the definitions are available to Jazz as the program is analysed and COBOL generated. Values such as RepNbrs.Width control the size of generated print lines. Don’t change this definition.
Program Report1 includes
COPY IN1;
COPY FR;
COPY JZSMth;
These are standard Jazz COPY statements, and are needed to defined data used in other statements. JZSMth was generated automatically into $R-PageHead. I moved it here for neatness.
You can of course add your own definitions, as either COPY or DEFINE statements, to support logic within your report routines.
PROCESS
in1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT;
END
PROCESS in1;
REPORT and ORDER combine to create a program structure where the PROCESS statement generates a loop that will invoke the appropriate routines. As records from the input are read data are tested for control breaks (in this example IN1.Region and IN1.District) and:
If there is a control break change then
If not first time, the $R-End-name routines are performed.
$R-End-name routines will perform $R-Sums-Rollup
Then the $R-Head routine(s) are performed
Then $R-Detail handles the current record
$R-PageHead is performed at the start of every page
$R-PageFoot is performed at the end of every page
Since all the logic is generated into the routines, there is no need for logic between PROCESS and END PROCESS.
If you modify the PROCESS statement you should be very careful. There is no problem adding further options such as WHERE or COUNT, but you may not change the structure of the report. Thus you cannot add or remove control breaks, nor change their order. However you can add or remove DESC options to reverse data sequence. If in doubt, create a new report.
You shouldn’t write logic within the PROCESS loop, for example
DEFINE
W DATA(
PROCESS
in1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT;
W.N += 1;
END
PROCESS in1;
The assignment is executed AFTER the input record has been processed by the routines. This statement should have been written within the $R-Detail routine.
It is recommended that you write first-time initialization logic within the $RHead routine instead of before the PROCESS statement.
A REPORT program will have a series of routines as shown above. You can write any logic you like within the generated ROUTINE statements, and you can write your own ROUTINE statements and PERFORM them as you would normally. You should avoid using names starting with “$” for your own routines.
Routine $R-Head is executed before ANY data has been read from IN1, or any of the secondary files like FR, so you should not refer to any file data unless your $R-Head routine first reads it with its own GET statement.
For a report with control breaks there will be sections for the start of each control break. Thus, in our example there are
ROUTINE $R-Head-Region;
And
ROUTINE $R-Head-District;
These are where you place logic for the start of the control section, such as reading lookup files, and printing section headings.
Report1 uses this PROCESS statement
PROCESS
in1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT
When a record is read for a new Region then routine $R-Head-Region is executed before the detail record is processed. The detail record is then processed. Within the set of records for a Region, similar logic applies to District. To understand what data is available in the Head and End routines, it helps to imagine that the execution sequence is the top-to-bottom order of the routines as displayed on the Report Designer. For example, $R-Head-Region has logic: -
ROUTINE $R-Head-Region;
* Start of control break: Region
GET FR WHERE (FR.Region
= IN1.Region);
PLINE
(' ','Region ',IN1.Region,FR.Name COL(16));
END ROUTINE $R-Head-Region;
You can refer to data like FR.Name from FR within $R-HEAD-Region and any of the following routines to (and including) $R-END-Region, i.e. $HEAD-District, $R-Detail, $R-END-District and $R-END-Region. FR values may also be appropriate with PageHead and PageFoot routines, although it’s not clear whether values here would refer to the previous or the current Region value. FR values will be inappropriate in $R-HEAD, as they will refer to a control break that hasn’t started yet, and so FR will not have been read yet.
Similarly, if there were a similar FRD file giving district names, we’d write this within the $R-Head-District routine
GET FRD WHERE (FRD.Region
= IN1.Region & FRD.District = IN1.district);
We should not refer to FRD.DistrictName in either $R-HEAD-Region or $RHead.
Routines like $R-End-Region are invoked at the end of a control break. At this stage you should not refer to the input record: if an IN1 record exists it will be the first record of the next control break section. There mightn’t even be such a record, as these routines (and $R-End) are invoked on endfile also.
Thus
ROUTINE
$R-End-Region;
* End of control break:
Region
PLINE
(' ','Region ',Break.Region,' Subtotal');
PLINE
('D' INDEX(1),Sums.SalesThisMonth(2) INDEX(5)
END
ROUTINE $R-End-Region;
does NOT refer to IN1.Region as this would be an irrelevant value. Within the $R-End routines you should refer to Break or Sums fields, other working data of your own or look-up files, but not data from the primary file. It would be valid to refer to data from a look-up file such as FR, because at this stage $R-Head-Region has not been executed.
Break fields refer to the control break values relevant to the current control break section, they are set before the $R-Head-xxx routine is executed, and remain valid to the end of the $R-End-xxx routine. Sums fields hold the accumulators for summed fields, and for the record count if you use PROCESS … INDEX variable BREAK, as we have here. If you expand these definitions in the report designer, for Report1 you’ll see this: -
Values are accumulated into Sums.SalesThisMonth(1) and
Sums.SalesYTD(1), and INDEX Sums.ix
BREAK causes the record count to be accumulated in Sums.ix(1). $R-End-District is executed when District
changes: -
ROUTINE $R-End-District;
* End of control break: District
Break.Sub
= 1;
PLINE
('D' INDEX(1),'District ',Break.District,' Subtotal',Sums.SalesThisMonth(1) INDEX(3) COL(50),Sums.SalesYTD(1) INDEX(4) COL(71));
END ROUTINE $R-End-District;
Note that it prints the Sums.xxx(1) values. END ROUTINE $R-End-District; executes $R-Sums-Rollup, causing xxx(1) values to be added to xxx(2) and cleared.
Within the $R-xxx routines PLINE statements are used to print data. Each PLINE will print a single line: unlike a PRINT statement, headings and totals are not implied from a PRINT statement, but are handled through the report editing process which creates semi-independent PLINE statements in the appropriate sections.
PLINE statements are designed to hold the results of report editing. Whenever you click [Report], make changes to the report, and then [Close] to return to the Jazz workbench, all the PLINE statements are re-created from the report layout. It is possible to edit the PLINE statements within the workbench – it is a normal Jazz statement – but it is usually better to use the report editor.
You can write any logic you like within a $R-xxx routine, provided that you understand when the routine is invoked, and what data is available to it. Thus, you can perform calculations, CALL subroutines, PERFORM routines, do FOR loops, and GET and PROCESS files. Since a ROUTINE statement cannot be enclosed in any other logic, FOR and PROCESS loops must be closed by their corresponding END before the END routine statement. The following notes suggest how you’d handle some common situations.
In Report1 fields IN1.SalesThisMonth and IN1.SalesYTD are summed: when we placed these fields on the detail line we checked “sum”: -
This added the SUM option into the PLINE statement: -
PLINE (…,IN1.SalesThisMonth
INDEX(3) SUM COL(55),IN1.SalesYTD INDEX(4) SUM COL(76));
To calculate an average, we need to count records. We can add a COUNT option to the PROCESS statement. Where there are no control breaks, COUNT may name any SMALLINT or INTEGER field: -
PROCESS IN1 ORDER(IN1.Region,IN1.District,IN1.Name) REPORT COUNT JZ.IX1
With control breaks, Jazz can maintain counts by control break. First we add a COUNT option like this: -
PROCESS IN1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT Count ix Break;
Click [Check] and MANASYS colours the keywords, and recognizes that ix needs to be within the Sums record. The statement becomes
PROCESS IN1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT COUNT Sums.ix BREAK;
The accumulated sums, plus the count
required by the INDEX option,
are not single values but are arrays, with values for the current control
level, for completed districts, and for completed regions. As discussed in Special rules: $R-End-xxx routines, we
can specify (1) to refer to the value so far for this control section, (2) for
the completed districts in this region, and (3) for the completed regions so
far.
Calculating averages is easy if the PROCESS
statement includes an option like COUNT Sums.ix BREAK to give us the record count for each break section: -
1. Define
fields for the calculated averages: add this into Report1: -
COPY JZSMth;
Define Averages data(
SalesThisMonth like In1.SalesThisMonth,
SalesYTD like In1.SalesYTD);
=>
DEFINE Averages DATA(
SalesThisMonth
LIKE IN1.SalesThisMonth,
SalesYTD
LIKE IN1.SalesYTD);
2.
Calculate
the averages in the $R-End routines. In
$R-End-Detail, write
Averages.SalesThisMonth
= Sums.SalesThisMonth(1) / sums.ix(1);
Averages.SalesYTD
= sums.salesYTD(1)/Sums.ix(1);
Write the same logic in $R-End-Region with
subscript (2), and in $R-End with subscript (3).
3.
Click
[Report] and add a line to display the count, plus these averages, on change of
Detail: -
4.
When
Sums.ix
was dropped on to the line, the subscript wasn’t added: -
ROUTINE $R-End-District;
…
Averages.SalesYTD
= sums.salesYTD(1)/Sums.ix(1);
PLINE
(' ','Count' COL(4),Sums.ix(1) COL(11),'Averages' COL(27),Averages.SalesThisMonth
COL(55),Averages.SalesYTD COL(76));
#049 S
Subscript(s) expected for Sums.ix
#530 S ix has
too few subscripts
END ROUTINE $R-End-District;
Close the
report designer and correct this error by adding (1), as shown above.
5.
Copy
this PLINE statement into routine
$R-End-Region and $R-END, with subscripts 2 and 3 respectively. Here’s a case where it’s easier to create
lines by editing the program than using the report designer.
A report
program offers an easy way of writing a summary file. For example, suppose we wanted to write
summary records containing the count, total, and average values of SalesYTD data in each district, all we’d have to do is: -
1.
Define
a suitable record format.
DEFINE RDSmry FB DATA(
Region DECIMAL(3),
District DECIMAL(3),
Count SMALLINT,
SumSalesYTD
MONEY(10,2),
AvgSalesYTD
MONEY (7,2))
DSNAME 'JAZZUSER.FILES.RDSMRY';
2.
Write
logic in the $R-End-District routine to assign data to this record, and write
it out
COPY
RDSmry;
RDSmry.Region
= Break.region;
RDSmry.District
= Break.district;
RDSmry.Count
= sums.ix(1);
RDSmry.SumSalesYTD
= Sums.salesYTD(1);
RDSmry.AvgSalesYTD
= Averages.SalesYTD;
WRITE
RDSmry;
#378 W Batch
WRITE used - you may need to edit the JCL
You’d
probably write COPY RDSmry; earlier in the Report program, and your program probably includes more
data (such as the Region and District names, and other fields).
Report Program Report1 was created starting with the New/Logic/Report Designer dialog: -
Clicking [Finish] invoked a dialog, first to resolve ORDER ? and then the key relationship for FR.
ORDER was resolved as above – see Order: setting the control breaks – and FR as in Look-up files.
This created the basic program structure. Clicking [Report] then showed the Editor View, and fields were placed on the report.
Clicking close saved the report layout as a series of PLINE statements within the report’s routines. This was then edited to add logic to count records and calculate averages, first by adding the text as shown with this highlighting.
[Report] as clicked and the 2nd print line within ROUTINE $R-End-District defined in the report designer. Closing the Report Designer and returning to the Jazz program, text was added as shown with this highlighting. A subscript was added to the Sums.ix reference, and calculations and the PLINE statement were copied into ROUTINE $R-End-Region and ROUTINE $R-End, with appropriate subscript values. This was a case where it was easier to copy/paste the PLINE statement than to use the Report Designer, as this is a very simple way of ensuring that the data are correctly aligned. Here is the program after all editing: -
*# Last
Updated by JAZZUSR at 28/02/2021 4:24:40 PM
PROGRAM Report1 REPORT(132) PAGE(60);
DEFINE RepNbrs
SYSTEM DATA(
Width SMALLINT VALUE 132 CONSTANT,
Page SMALLINT VALUE 60 CONSTANT,
Title CHAR(16) VALUE 'IN1 Report Title'
CONSTANT);
COPY IN1;
COPY FR;
COPY JZSMth;
DEFINE Averages
DATA(
SalesThisMonth
LIKE IN1.SalesThisMonth,
SalesYTD
LIKE IN1.SalesYTD);
PROCESS IN1 ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) REPORT COUNT Sums.ix BREAK;
END PROCESS IN1;
ROUTINE $R-PageHead;
* Top of every page
PLINE
('P','Printed ',JAZZ.$Today,'IN1 Report Title'
COL(57),'Page ' COL(123),JAZZ.$PageNbr) PAGE;
PLINE
('D' INDEX(1),'*-----------------Name-----------------*' INDEX(2) COL(9),'SalesThisMonth' INDEX(3) COL(53),'*-SalesYTD-*' INDEX(4) COL(76));
END ROUTINE $R-PageHead;
ROUTINE $R-Head;
* Before first record has been
read
END ROUTINE $R-Head;
ROUTINE $R-Head-Region;
* Start of control break: Region
GET FR WHERE (FR.Region
= IN1.Region);
PLINE
(' ','Region ',IN1.Region,FR.Name COL(16));
END ROUTINE $R-Head-Region;
ROUTINE $R-Head-District;
* Start of control break:
District
PLINE
(' ','District ',IN1.District);
END ROUTINE $R-Head-District;
ROUTINE $R-Detail;
* Every Record
PLINE
('D' INDEX(1),IN1.Name INDEX(2) COL(9),IN1.SalesThisMonth
INDEX(3) SUM COL(55),IN1.SalesYTD
INDEX(4) SUM COL(76));
END ROUTINE $R-Detail;
ROUTINE $R-End-District;
* End of control break: District
Break.Sub
= 1;
PLINE
('D' INDEX(1),'District ',Break.District,' Subtotal',Sums.SalesThisMonth(1) INDEX(3) COL(50),Sums.SalesYTD(1) INDEX(4) COL(71));
Averages.SalesThisMonth =
Sums.SalesThisMonth(1) / sums.ix(1);
Averages.SalesYTD
= sums.salesYTD(1)/Sums.ix(1);
PLINE
(' ','Count' COL(4),Sums.ix(1) COL(11),'Average' COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD COL(76));
END ROUTINE $R-End-District;
ROUTINE $R-End-Region;
* End of control break: Region
Break.Sub
= 2;
PLINE
('D' INDEX(1),'Region ',Break.Region,' Subtotal',Sums.SalesThisMonth(2) INDEX(3) COL(50),Sums.SalesYTD(2) INDEX(4) COL(71));
Averages.SalesThisMonth =
Sums.SalesThisMonth(2) / sums.ix(2);
Averages.SalesYTD
= sums.salesYTD(2)/Sums.ix(2);
PLINE (' ','Count' COL(4),Sums.ix(2) COL(11),'Average' COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD COL(76));
END ROUTINE $R-End-Region;
ROUTINE $R-End;
* End of Records
PLINE
(' ','Grand Total');
PLINE
('D' INDEX(1),Sums.SalesThisMonth(3) INDEX(3) COL(50),Sums.SalesYTD(3) INDEX(4) COL(71));
Averages.SalesThisMonth =
Sums.SalesThisMonth(3) / sums.ix(3);
Averages.SalesYTD
= sums.salesYTD(3)/Sums.ix(3);
PLINE (' ','Count' COL(4),Sums.ix(3) COL(11),'Average' COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD COL(76));
END ROUTINE $R-End;
ROUTINE $R-PageFoot;
* Page Footer
PLINE
(' ','Printed ',JAZZ.$Today,'IN1 Report Title'
COL(57),'Page ' COL(123),JAZZ.$PageNbr) SPACE(2);
END ROUTINE $R-PageFoot;
ROUTINE $R-Sums-Rollup;
* Roll up counts and subtotals
END ROUTINE $R-Sums-Rollup;
1Printed 01 Mar 2021, 11:32:18 IN1 Report
Title
Page 1
*-----------------Name-----------------* SalesThisMonth *-SalesYTD-*
Region 1
New Zealand
District 1
REEDE,
Phillip
$468.55 $4,685.50
District 1 Subtotal $468.55 $4,685.50
Count 1 Average $468.55 $4,685.50
…
District 3
CAMPBELL,
Dennis
$5,662.44
$56,624.40
CORLETT, Norton
Hesse
$9,197.76
$10,373.12
ROBERTS,
Adelaide $4,138.56 $37,247.04
ROBERTS, Margaret
Annie
$8,138.51
$73,246.59
WILLIAMSON,
Catherine $5,554.20 $33,325.20
District 3 Subtotal $32,691.47 $210,816.35
Count 5
Average $6,538.29 $42,163.27
…
District 7
POLAND, Lorna Aroha $7,103.77 $71,037.70
District 7 Subtotal $7,103.77 $71,037.70
Count 1 Average $7,103.77 $71,037.70
Region 1 Subtotal
$83,215.58 $497,852.63
Count 15 Average $5,547.70 $33,190.17
Region 2
Australia
…
1Printed 01 Mar 2021, 11:32:18 IN1 Report
Title
Page 10
*-----------------Name-----------------* SalesThisMonth *-SalesYTD-*
District 7
GLANVILLE,
Ann
$6,157.62 $73,891.44
GOULD, John
$3,496.42
$31,467.78
WILLIAMS, Claude
William $5,380.12 $21,520.48
WILLIAMSON,
Norman Herbert James
$52.97 $423.76
District 7 Subtotal $15,087.13 $127,303.46
Count 4 Average $3,771.78 $31,825.86
Region 10 Subtotal $100,533.67 $688,678.96
Count 21 Average $4,787.31 $32,794.23
Grand Total
$1,550,347.73
$10,140,367.60
Count 300 Average $5,167.82 $33,801.22
With MANASYS configured for z/OS a job will be submitted that will compile and run the report so you don’t even need to see this. When configured for Micro Focus the COBOL is written into the cbl folder of the COBOL project, and a few clicks will compile and execute the program. In both cases, the COBOL compiles first time.
000010* C:\tutorials\TSTSQL\cbl\Report1.CBL
000020 IDENTIFICATION
DIVISION.
Report1
000030 PROGRAM-ID. Report1.
Report1
000040 AUTHOR. JAZZUSR (Using Jazz from Visual
Studio) Report1
000050 DATE-WRITTEN. 1/03/2021 11:31:16 AM Report1
000060 ENVIRONMENT
DIVISION.
Report1
000070*# Last Updated by
JAZZUSR at 1/03/2021 11:31:16 AM Report1
000080*PROGRAM Report1
REPORT(132) PAGE(60);
Report1
000090*DEFINE RepNbrs SYSTEM DATA( Report1
000100* Width SMALLINT VALUE 132 CONSTANT, Report1
000110* Page SMALLINT VALUE 60 CONSTANT, Report1
000120* Title CHAR(16) VALUE 'IN1 Report Title'
CONSTANT); Report1
000130*COPY IN1;
Report1
000140*COPY FR;
Report1
000150*COPY JZSMth;
Report1
000160*DEFINE Averages
DATA(
Report1
000170* SalesThisMonth LIKE
IN1.SalesThisMonth,
Report1
000180* SalesYTD LIKE
IN1.SalesYTD);
Report1
000190*PROCESS IN1
ORDER(IN1.Region BREAK,IN1.District BREAK,IN1.Name) Report1
000200* REPORT COUNT Sums.ix
BREAK; Report1
000210*END PROCESS
IN1;
Report1
000220*ROUTINE $R-PageHead;
Report1
000230** Top of every page Report1
000240* PLINE ('P','Printed
',JAZZ.$Today,'IN1 Report Title' COL(57),Report1
000250* 'Page ' COL(123),JAZZ.$PageNbr) PAGE; Report1
000260* PLINE ('D' INDEX(1), Report1
000270*
'*-----------------Name-----------------*' INDEX(2) Report1
000280* COL(9),'SalesThisMonth'
INDEX(3) COL(53),'*-SalesYTD-*' Report1
000290* INDEX(4) COL(76)); Report1
000300*END ROUTINE $R-PageHead;
Report1
000310*ROUTINE
$R-Head;
Report1
000320** Before first record has been read Report1
000330*END ROUTINE $R-Head;
Report1
000340*ROUTINE
$R-Head-Region;
Report1
000350** Start of control break: Region Report1
000360* GET FR WHERE (FR.Region
= IN1.Region);
Report1
000370* PLINE (' ','Region ',IN1.Region,FR.Name
COL(16)); Report1
000380*END ROUTINE
$R-Head-Region; Report1
000390*ROUTINE
$R-Head-District;
Report1
000400** Start of control break: District Report1
000410* PLINE (' ','District ',IN1.District); Report1
000420*END ROUTINE
$R-Head-District; Report1
000430*ROUTINE
$R-Detail;
Report1
000440** Every Record
Report1
000450* PLINE ('D' INDEX(1),IN1.Name INDEX(2)
COL(9), Report1
000460* IN1.SalesThisMonth INDEX(3) SUM
COL(55),IN1.SalesYTD Report1
000470* INDEX(4) SUM COL(76)); Report1
000480*END ROUTINE
$R-Detail;
Report1
000490*ROUTINE $R-End-District;
Report1
000500** End of control break: District Report1
000510* Break.Sub =
1;
Report1
000520* PLINE ('D' INDEX(1),'District ',Break.District,' Subtotal',
Report1
000530* Sums.SalesThisMonth(1)
INDEX(3) COL(50),Sums.SalesYTD(1) Report1
000540* INDEX(4) COL(71)); Report1
000550* Averages.SalesThisMonth
= Sums.SalesThisMonth(1) / Report1
000560* sums.ix(1);
Report1
000570* Averages.SalesYTD
= sums.salesYTD(1)/Sums.ix(1); Report1
000580* PLINE (' ','Count' COL(4),Sums.ix(1) COL(11),'Average' Report1
000590* COL(44),Averages.SalesThisMonth
COL(55), Report1
000600* Averages.SalesYTD
COL(76));
Report1
000610*END ROUTINE
$R-End-District; Report1
000620*ROUTINE
$R-End-Region;
Report1
000630** End of control break: Region Report1
000640* Break.Sub =
2;
Report1
000650* PLINE ('D' INDEX(1),'Region ',Break.Region,' Subtotal', Report1
000660* Sums.SalesThisMonth(2)
INDEX(3) COL(50),Sums.SalesYTD(2) Report1
000670* INDEX(4) COL(71)); Report1
000680* Averages.SalesThisMonth
= Sums.SalesThisMonth(2) / Report1
000690* sums.ix(2);
Report1
000700* Averages.SalesYTD
= sums.salesYTD(2)/Sums.ix(2); Report1
000710* PLINE (' ','Count' COL(4),Sums.ix(2) COL(11),'Average' Report1
000720* COL(44),Averages.SalesThisMonth
COL(55), Report1
000730* Averages.SalesYTD
COL(76));
Report1
000740*END ROUTINE
$R-End-Region; Report1
000750*ROUTINE
$R-End;
Report1
000760** End of Records
Report1
000770* PLINE (' ','Grand Total'); Report1
000780* PLINE ('D' INDEX(1),Sums.SalesThisMonth(3)
INDEX(3) COL(50), Report1
000790* Sums.SalesYTD(3)
INDEX(4) COL(71));
Report1
000800* Averages.SalesThisMonth
= Sums.SalesThisMonth(3) / Report1
000810* sums.ix(3);
Report1
000820* Averages.SalesYTD
= sums.salesYTD(3)/Sums.ix(3); Report1
000830* PLINE (' ','Count' COL(4),Sums.ix(3) COL(11),'Average' Report1
000840* COL(44),Averages.SalesThisMonth
COL(55), Report1
000850* Averages.SalesYTD
COL(76));
Report1
000860*END ROUTINE
$R-End;
Report1
000870*ROUTINE $R-PageFoot;
Report1
000880** Page Footer
Report1
000890* PLINE (' ','Printed ',JAZZ.$Today,'IN1
Report Title' COL(57),Report1
000900* 'Page ' COL(123),JAZZ.$PageNbr) SPACE(2); Report1
000910*END ROUTINE $R-PageFoot;
Report1
000920*ROUTINE
$R-Sums-Rollup;
Report1
000930** Roll up counts and subtotals Report1
000940*END ROUTINE
$R-Sums-Rollup; Report1
000950******************************************************************Report1
000960**
**Report1
000970** INPUT-OUTPUT
Section/File-Control
**Report1
000980**
**Report1
000990******************************************************************Report1
001000 INPUT-OUTPUT
Section.
Report1
001010 FILE-CONTROL.
Report1
001020 SELECT IN1
ASSIGN TO IN1 Report1
001030 FILE STATUS IS IN1-STATUS. Report1
001040 SELECT SORTWORK ASSIGN TO SORTWK01. Report1
001050 SELECT FR
ASSIGN TO FR Report1
001060 ORGANIZATION IS INDEXED ACCESS IS DYNAMIC Report1
001070 RECORD KEY IS Region OF
JZ-FR Report1
001080 FILE STATUS IS FR-STATUS. Report1
001090 SELECT RepFile ASSIGN TO RepFile Report1
001100 FILE STATUS IS RepFile-STATUS. Report1
001110******************************************************************Report1
001120**
**Report1
001130** Data Division **Report1
001140** **Report1
001150******************************************************************Report1
001160 DATA
DIVISION.
Report1
001170******************************************************************Report1
001180**
**Report1
001190** File Section. **Report1
001200** **Report1
001210******************************************************************Report1
001220 File SECTION.
Report1
001230******************************************************************Report1
001240**
**Report1
001250** IN1 **Report1
001260**
**Report1
001270******************************************************************Report1
001280 FD IN1
Report1
001290 RECORDING MODE V.
Report1
001300* Report1
001310 01 JZ-IN1.
Report1
001320 03 Region PIC S9(3) COMP-3. Report1
001330 03 District PIC S9(3) COMP-3. Report1
001340 03 JZ-Name PIC X(40). Report1
001350 03 SalesThisMonth
PIC S9(5)V9(2) COMP-3.
Report1
001360 03 SalesYTD PIC
S9(5)V9(2) COMP-3. Report1
001370 03 BillingCycle
PIC X.
Report1
001380 03 DateCommenced
PIC S9(9) COMP.
Report1
001390******************************************************************Report1
001400**
**Report1
001410** SORTWORK **Report1
001420** **Report1
001430******************************************************************Report1
001440*
Report1
001450 SD SORTWORK. Report1
001460*
Report1
001470 01 JZ-SORTWORK.
Report1
001480 03 Region PIC S9(3) COMP-3. Report1
001490 03 District PIC S9(3) COMP-3. Report1
001500 03 JZ-Name PIC X(40). Report1
001510 03 SalesThisMonth
PIC S9(5)V9(2) COMP-3. Report1
001520 03 SalesYTD PIC
S9(5)V9(2) COMP-3.
Report1
001530******************************************************************Report1
001540**
**Report1
001550** FR **Report1
001560**
**Report1
001570******************************************************************Report1
001580 FD FR Report1
001590 RECORD IS VARYING IN SIZE. Report1
001600*
Report1
001610 01 JZ-FR. Report1
001620 03 Region PIC 999.
Report1
001630 03 JZ-Name PIC X(30). Report1
001640 03 Fill PIC X(47). Report1
001650******************************************************************Report1
001660**
**Report1
001670** RepFile **Report1
001680**
**Report1
001690******************************************************************Report1
001700 FD RepFile
Report1
001710 RECORDING MODE F.
Report1
001720*
Report1
001730 01 JZ-RepFile PIC X(132). Report1
001740******************************************************************Report1
001750**
**Report1
001760** Working Storage Section: General
Program Data **Report1
001770** **Report1
001780******************************************************************Report1
001790*
Report1
001800 WORKING-STORAGE
SECTION. Report1
001810******************************************************************Report1
001820**
**Report1
001830** General Program
Information **Report1
001840**
**Report1
001850******************************************************************Report1
001860*
Report1
001870* Status Flags and control data Report1
001880 01 JZ-FileControl.
Report1
001890 03
SORTWORK-ENDFILE PIC X VALUE 'N'. Report1
001900 03
IN1-ENDFILE PIC X VALUE 'N'. Report1
001910 03
IN1-STATUS PIC XX VALUE '00'. Report1
001920 03
FR-ENDFILE PIC X VALUE 'N'. Report1
001930 03
FR-STATUS PIC XX VALUE '00'. Report1
001940 03
FR-FOUND-FLAG PIC X VALUE 'Y'. Report1
001950 88
FR-FOUND VALUE 'Y'. Report1
001960 03
FR-UPDATEPENDING-FLAG PIC X VALUE 'N'. Report1
001970 88
FR-UPDATEPENDING VALUE 'Y'. Report1
001980 03
FR-Get4Update-FLAG PIC X VALUE 'N'. Report1
001990 88
FR-Get4Update VALUE 'Y'. Report1
002000 03
FR-HighKey PIC X(3) VALUE HIGH-VALUES. Report1
002010 03 RepFile-STATUS PIC XX VALUE '00'. Report1
002020 03 RepFile-PageNbr PIC 99999 COMP-3 VALUE 0. Report1
002030 03 RepFile-LineCount PIC 9999 COMP VALUE 1000. Report1
002040 03 RepFile-Space PIC 9999 COMP VALUE 1. Report1
002050 03 RepFile-NewPage-Enabled PIC X
VALUE 'Y'. Report1
002060 03 RepFile-NewPage PIC X VALUE 'Y'. Report1
002070*
Report1
002080 01 JZ-TODAY. Report1
002090 05
JZ-DATETIMEGMT.
Report1
002100 10
JZ-DATETIME PIC 9(16). Report1
002110 10
JZ-GMTDIFF PIC S9(4). Report1
002120 05
JZ-DATETIME-1 REDEFINES
JZ-DATETIMEGMT. Report1
002130 10
JZ-DATE PIC 9(8). Report1
002140 10
JZ-TIME PIC 9(8). Report1
002150 10
FILLER PIC S9(4). Report1
002160 05
JZ-DATETIME-2 REDEFINES
JZ-DATETIMEGMT. Report1
002170 10
JZ-YEAR PIC 9(4). Report1
002180 10
JZ-MONTH PIC
9(2).
Report1
002190 10
JZ-DAY PIC 9(2). Report1
002200 10
JZ-HOUR PIC 9(2). Report1
002210 10
JZ-MINUTE PIC 9(2).
Report1
002220 10
JZ-SECOND PIC 9(2). Report1
002230 10
JZ-MS PIC 9(2). Report1
002240 10
FILLER PIC S9(4). Report1
002250 05
JZ-DATETIME-3 REDEFINES
JZ-DATETIMEGMT. Report1
002260 10
FILLER PIC 9(12). Report1
002270 10
JZ-SECONDS PIC 99V99. Report1
002280 10
FILLER PIC S9(4). Report1
002290* Report Time Stamp
Report1
002300*
Report1
002310 01 JZ-ReportTS.
Report1
002320 10
JZ-DAY PIC 9(2). Report1
002330 10
FILLER PIC X VALUE SPACE. Report1
002340 10
JZ-MONTH-NAME PIC X(3). Report1
002350 10
FILLER PIC X VALUE SPACE. Report1
002360 10
JZ-YEAR PIC 9(4). Report1
002370 10
JZ-COMMA PIC XX VALUE ', '. Report1
002380 10
JZ-HOUR PIC 9(2). Report1
002390 10
JZ-SEPCHAR1 PIC X VALUE ':'. Report1
002400 10
JZ-MINUTE PIC 9(2).
Report1
002410 10
JZ-SEPCHAR2 PIC X VALUE ':'. Report1
002420 10
JZ-SECOND PIC 9(2). Report1
002430*
Report1
002440 01 JZ-ReportTimeStamp
REDEFINES JZ-ReportTS PIC X(21). Report1
002450*
Report1
002460 LOCAL-STORAGE
SECTION.
Report1
002470******************************************************************Report1
002480**
**Report1
002490** RepFile
Print Lines **Report1
002500** **Report1
002510******************************************************************Report1
002520*
Report1
002530* Save line while headings are printed Report1
002540 01 JZ-RepFile-Save PIC X(132). Report1
002550*
Report1
002560 01 JZ-PLINE24. Report1
002570 03 FILLER PIC X(8) VALUE 'Printed '. Report1
002580 03 JZ-Today PIC X(21). Report1
002590 03 FILLER PIC X(27) VALUE SPACES. Report1
002600 03 FILLER PIC X(16) VALUE 'IN1 Report
Title'. Report1
002610 03 FILLER PIC X(50) VALUE SPACES. Report1
002620 03 FILLER PIC X(5) VALUE 'Page '. Report1
002630 03 JZ-PageNbr PIC ZZZZ9. Report1
002640*
Report1
002650 01 JZ-PLINE25.
Report1
002660 03 FILLER
PIC X(8) VALUE
SPACES. Report1
002670 03 FILLER PIC X(40) VALUE
'*-----------------Name-Report1
002680- '----------------*'. Report1
002690 03 FILLER PIC X(4) VALUE SPACES. Report1
002700 03 FILLER PIC X(14) VALUE 'SalesThisMonth'.
Report1
002710 03 FILLER PIC X(9) VALUE SPACES. Report1
002720 03 FILLER PIC X(12) VALUE '*-SalesYTD-*'.
Report1
002730*
Report1
002740 01 JZ-PLINE31.
Report1
002750 03 FILLER PIC X(7) VALUE 'Region '. Report1
002760 03 Region PIC ---9. Report1
002770 03 FILLER PIC X(4) VALUE SPACES. Report1
002780 03 JZ-Name PIC X(30). Report1
002790*
Report1
002800 01 JZ-PLINE34.
Report1
002810 03 FILLER PIC X(9) VALUE 'District '. Report1
002820 03 District PIC ---9. Report1
002830*
Report1
002840 01 JZ-PLINE37.
Report1
002850 03 FILLER PIC X(8) VALUE SPACES. Report1
002860 03 JZ-Name PIC X(40). Report1
002870 03 FILLER PIC X(6) VALUE SPACES. Report1
002880 03 SalesThisMonth PIC $$$,$$9.99CR. Report1
002890 03 FILLER PIC X(9) VALUE SPACES. Report1
002900 03 SalesYTD PIC $$$,$$9.99CR. Report1
002910*
Report1
002920 01 JZ-PLINE41.
Report1
002930 03 FILLER PIC X(9) VALUE 'District '. Report1
002940 03 District PIC ---9. Report1
002950 03 FILLER PIC X(9) VALUE ' Subtotal'. Report1
002960 03 FILLER PIC X(27) VALUE SPACES. Report1
002970 03 SalesThisMonth PIC $$$$,$$$,$$9.99CR. Report1
002980 03 FILLER PIC X(4) VALUE SPACES. Report1
002990 03 SalesYTD PIC $$$$,$$$,$$9.99CR. Report1
003000*
Report1
003010 01 JZ-PLINE44. Report1
003020 03 FILLER PIC X(3) VALUE SPACES. Report1
003030 03 FILLER PIC X(5) VALUE 'Count'. Report1
003040 03 FILLER PIC X(2) VALUE SPACES. Report1
003050 03 ix PIC ---,--9. Report1
003060 03 FILLER PIC X(26) VALUE SPACES. Report1
003070 03 FILLER PIC X(7) VALUE 'Average'. Report1
003080 03 FILLER PIC X(4) VALUE SPACES. Report1
003090 03 SalesThisMonth PIC $$$,$$9.99CR. Report1
003100 03 FILLER PIC X(9) VALUE SPACES. Report1
003110 03 SalesYTD PIC $$$,$$9.99CR. Report1
003120*
Report1
003130 01 JZ-PLINE48.
Report1
003140 03 FILLER PIC X(7) VALUE 'Region '. Report1
003150 03 Region PIC ---9. Report1
003160 03 FILLER PIC X(9) VALUE ' Subtotal'. Report1
003170 03 FILLER PIC X(29) VALUE SPACES. Report1
003180 03 SalesThisMonth PIC $$$$,$$$,$$9.99CR. Report1
003190 03 FILLER PIC X(4) VALUE SPACES. Report1
003200 03 SalesYTD PIC $$$$,$$$,$$9.99CR. Report1
003210*
Report1
003220 01 JZ-PLINE51.
Report1
003230 03 FILLER PIC X(3) VALUE SPACES. Report1
003240 03 FILLER PIC X(5) VALUE 'Count'. Report1
003250 03 FILLER PIC X(2) VALUE SPACES. Report1
003260 03 ix PIC ---,--9. Report1
003270 03 FILLER PIC X(26) VALUE SPACES. Report1
003280 03 FILLER PIC X(7) VALUE 'Average'. Report1
003290 03 FILLER PIC X(4) VALUE SPACES. Report1
003300 03 SalesThisMonth PIC $$$,$$9.99CR. Report1
003310 03 FILLER PIC X(9) VALUE SPACES. Report1
003320 03 SalesYTD PIC $$$,$$9.99CR. Report1
003330* Report1
003340 01 JZ-PLINE54.
Report1
003350 03 FILLER PIC X(11) VALUE 'Grand Total'. Report1
003360* Report1
003370 01 JZ-PLINE55.
Report1
003380 03 FILLER PIC X(49) VALUE SPACES. Report1
003390 03 SalesThisMonth PIC $$$$,$$$,$$9.99CR. Report1
003400 03 FILLER PIC X(4) VALUE SPACES. Report1
003410 03 SalesYTD PIC $$$$,$$$,$$9.99CR. Report1
003420*
Report1
003430 01 JZ-PLINE58.
Report1
003440 03 FILLER PIC X(3) VALUE SPACES. Report1
003450 03 FILLER PIC X(5) VALUE 'Count'. Report1
003460 03
FILLER PIC X(2) VALUE
SPACES. Report1
003470 03 ix PIC ---,--9. Report1
003480 03 FILLER PIC X(26) VALUE SPACES. Report1
003490 03 FILLER PIC X(7) VALUE 'Average'. Report1
003500 03 FILLER PIC X(4) VALUE SPACES. Report1
003510 03 SalesThisMonth PIC $$$,$$9.99CR. Report1
003520 03 FILLER PIC X(9) VALUE SPACES. Report1
003530 03 SalesYTD PIC $$$,$$9.99CR. Report1
003540*
Report1
003550 01 JZ-PLINE61. Report1
003560 03 FILLER PIC X(8) VALUE 'Printed '. Report1
003570 03 JZ-Today PIC X(21). Report1
003580 03 FILLER PIC X(27) VALUE SPACES. Report1
003590 03 FILLER PIC X(16) VALUE 'IN1 Report
Title'. Report1
003600 03 FILLER PIC X(50) VALUE SPACES. Report1
003610 03 FILLER PIC X(5) VALUE 'Page '. Report1
003620 03
JZ-PageNbr
PIC ZZZZ9.
Report1
003630******************************************************************Report1
003640**
**Report1
003650** JZ - Jazz Sundry fields **Report1
003660**
**Report1
003670******************************************************************Report1
003680* Report1
003690 01 JZ.
Report1
003700 03 JZ-AL PIC S9(4) COMP VALUE ZERO. Report1
003710 03 JZ-ALIM PIC S9(4) COMP VALUE
ZERO. Report1
003720 03 JZ-NOFML PIC S9(4) COMP VALUE
ZERO. Report1
003730 03 JZ-INDEX PIC S9(4) COMP VALUE
ZERO. Report1
003740 03 JZ-INDEX2 PIC S9(4) COMP VALUE
ZERO. Report1
003750 03 JZ-IXMth PIC
S9(4) COMP VALUE ZERO.
Report1
003760 03 IX1 PIC S9(4) COMP VALUE ZERO. Report1
003770 03 IX2 PIC S9(4) COMP VALUE ZERO. Report1
003780 03 IX3 PIC S9(4) COMP VALUE ZERO. Report1
003790 03 IX4 PIC S9(4) COMP VALUE ZERO. Report1
003800 03 IX5 PIC S9(4) COMP VALUE ZERO. Report1
003810 03 IX6 PIC S9(4) COMP VALUE ZERO. Report1
003820 03 IX7 PIC S9(4) COMP VALUE ZERO. Report1
003830 03 JZ-ST PIC S9(4) COMP VALUE ZERO. Report1
003840 03 JZ-SL PIC S9(4) COMP VALUE ZERO. Report1
003850 03 JZ-BLANK PIC XXXX VALUE SPACES. Report1
003860 03 JZ-CHAR80 PIC X(80) VALUE SPACES. Report1
003870 03 JZ-FNAME PIC X(30) VALUE SPACES. Report1
003880 03 JZ-KL PIC S9(4) COMP VALUE ZERO. Report1
003890 03 JZ-MLTH PIC S9(4) COMP VALUE
ZERO. Report1
003900 03 JZ-INT PIC S9(9) COMP VALUE ZERO. Report1
003910 03 JZ-TRUEFALSE PIC XXXXX VALUE
SPACES. Report1
003920 03 JZ-TinyNbr
PIC S9(9) COMP VALUE ZERO.
Report1
003930 03 JZ-TinyGr
REDEFINES JZ-TinyNbr. Report1
003940 05 FILLER PIC XXX. Report1
003950 05 JZ-Tiny PIC X.
Report1
003960 03 JZ-Error PIC X VALUE 'N'. Report1
003970 03 JZ-NBR1 PIC 9999 VALUE ZERO. Report1
003980 03 JZ-NBR1X REDEFINES JZ-NBR1 PIC
XXXX. Report1
003990 03 JZ-NBR2 PIC 9999 VALUE ZERO. Report1
004000 03 JZ-NBR2X REDEFINES JZ-NBR2 PIC
XXXX. Report1
004010 03 JZ-SUBVAL PIC ZZZZZ9 VALUE ZERO. Report1
004020 03 JZ-SUBVALR REDEFINES JZ-SUBVAL PIC
X(6). Report1
004030 03
JZ-SUBDIGIT PIC S9(4) COMP VALUE ZERO. Report1
004040 03 JZ-INDEXES OCCURS 7 INDEXED BY
JZIX1 PIC X(6) VALUE Report1
004050 SPACES.
Report1
004060 03 JZ-INDEXPR PIC X(6) VALUE SPACES. Report1
004070 03 FR-Region PIC 999 VALUE ZERO. Report1
004080******************************************************************Report1
004090** **Report1
004100** JZSMth **Report1
004110**
**Report1
004120******************************************************************Report1
004130*
Report1
004140 01 JZSMth.
Report1
004150 03 SMth PIC
S9(4) COMP VALUE ZERO.
Report1
004160******************************************************************Report1
004170**
**Report1
004180** Averages **Report1
004190** **Report1
004200******************************************************************Report1
004210*
Report1
004220 01 Averages. Report1
004230 03 SalesThisMonth
PIC S9(5)V9(2) COMP-3 VALUE ZERO.
Report1
004240 03 SalesYTD PIC
S9(5)V9(2) COMP-3 VALUE ZERO.
Report1
004250******************************************************************Report1
004260**
**Report1
004270** Break **Report1
004280**
**Report1
004290******************************************************************Report1
004300*
Report1
004310 01 Break.
Report1
004320 03 Level PIC S9(4) COMP VALUE ZERO. Report1
004330 03 Sub PIC S9(4) COMP VALUE ZERO. Report1
004340 03 Rec-Count PIC S9(4) COMP VALUE
ZERO. Report1
004350 03
Region PIC S9(3) COMP-3 VALUE ZERO. Report1
004360 03 District PIC S9(3) COMP-3 VALUE
ZERO. Report1
004370******************************************************************Report1
004380** **Report1
004390** Sums **Report1
004400**
**Report1
004410******************************************************************Report1
004420*
Report1
004430 01 Sums.
Report1
004440 03 ix OCCURS 4 INDEXED BY JZIX2 PIC S9(4) COMP VALUE ZERO. Report1
004450 03 SalesThisMonth
OCCURS 4 INDEXED BY JZIX3 PIC S9(9)V9(2)
Report1
004460 COMP-3 VALUE ZERO. Report1
004470 03 SalesYTD
OCCURS 4 INDEXED BY JZIX4 PIC S9(9)V9(2)
COMP-3Report1
004480 VALUE ZERO.
Report1
004490******************************************************************Report1
004500**
**Report1
004510** Code Tables **Report1
004520**
**Report1
004530******************************************************************Report1
004540* Report1
004550* JZSMth.SMth
Report1
004560 01 JZCodes-JZSMth-SMth.
Report1
004570 03 JZValues. Report1
004580 05 FILLER PIC X(3) VALUE 'Jan'. Report1
004590 05 FILLER PIC X(3) VALUE 'Feb'. Report1
004600 05 FILLER PIC X(3) VALUE 'Mar'. Report1
004610 05 FILLER PIC X(3) VALUE 'Apr'. Report1
004620 05 FILLER PIC X(3) VALUE 'May'. Report1
004630 05 FILLER PIC X(3) VALUE 'Jun'. Report1
004640 05 FILLER PIC X(3) VALUE 'Jul'. Report1
004650 05 FILLER PIC X(3) VALUE 'Aug'. Report1
004660 05 FILLER PIC X(3) VALUE 'Sep'. Report1
004670 05 FILLER PIC X(3) VALUE 'Oct'. Report1
004680 05 FILLER PIC X(3) VALUE 'Nov'. Report1
004690 05 FILLER PIC X(3) VALUE 'Dec'. Report1
004700 03
JZTABLE REDEFINES JZValues. Report1
004710 05
ITEM-VALUES OCCURS 12 INDEXED BY JZIX-JZSMth-SMth. Report1
004720 07
CODE-VALUE PIC X(3). Report1
004730 03
FILLER.
Report1
004740 05
SEARCH-FOR PIC S9(4) COMP. Report1
004750 05
FOUND-VALUE PIC X(3) VALUE '***'. Report1
004760******************************************************************Report1
004770**
**Report1
004780** Procedure Division. **Report1
004790** **Report1
004800******************************************************************Report1
004810*
Report1
004820 PROCEDURE
DIVISION. Report1
004830 MOVE FUNCTION CURRENT-DATE TO
JZ-DATETIMEGMT OF JZ-TODAY. Report1
004840 PERFORM JZDT01.
Report1
004850 OPEN INPUT IN1. Report1
004860 IF IN1-Status IS NOT = '00' AND IN1-Status
IS NOT = '41' AND Report1
004870 IN1-Status IS NOT = '97' Report1
004880 DISPLAY 'PROGRAM TERMINATED. Invalid
Status Code on OPEN Report1
004890- 'IN1. CODE=' IN1-Status Report1
004900 GOBACK
Report1
004910 END-IF . Report1
004920 Move ZERO TO Region OF JZ-IN1. Report1
004930 Move ZERO TO District OF JZ-IN1. Report1
004940 Move SPACES TO JZ-Name OF JZ-IN1. Report1
004950 Move ZERO TO SalesThisMonth
OF JZ-IN1. Report1
004960 Move ZERO TO SalesYTD
OF JZ-IN1.
Report1
004970 Move LOW-VALUE TO BillingCycle
OF JZ-IN1. Report1
004980 Move ZERO TO DateCommenced
OF JZ-IN1. Report1
004990 OPEN INPUT FR.
Report1
005000 IF FR-Status IS NOT = '00' AND FR-Status
IS NOT = '41' AND Report1
005010 FR-Status IS NOT = '97' Report1
005020 DISPLAY 'PROGRAM TERMINATED. Invalid
Status Code on OPEN Report1
005030- 'FR. CODE=' FR-Status Report1
005040 GOBACK
Report1
005050 END-IF .
Report1
005060 Move ZERO TO Region OF JZ-FR. Report1
005070 Move 'No Record found' TO JZ-Name OF
JZ-FR. Report1
005080 Move SPACES TO Fill OF JZ-FR. Report1
005090 OPEN OUTPUT RepFile.
Report1
005100 IF RepFile-Status
IS NOT = '00' AND RepFile-Status IS NOT = 'Report1
005110- '41' AND RepFile-Status
IS NOT = '97' Report1
005120 DISPLAY 'PROGRAM TERMINATED. Invalid
Status Code on OPEN Report1
005130- 'RepFile.
CODE=' RepFile-Status Report1
005140 GOBACK
Report1
005150 END-IF .
Report1
005160* Main Program Logic Report1
005170 PERFORM JZ-Main-Program-Logic. Report1
005180*
Report1
005190
JZ-Normal-Exit.
Report1
005200 PERFORM JZR-END-District. Report1
005210 PERFORM JZR-END-Region. Report1
005220 PERFORM JZR-END.
Report1
005230* Logical end-of-program Report1
005240 GOBACK.
Report1
005250******************************************************************Report1
005260** **Report1
005270** Main Program Logic **Report1
005280**
**Report1
005290******************************************************************Report1
005300*
Report1
005310
JZ-Main-Program-Logic.
Report1
005320* PROCESS IN1 ORDER(IN1.Region
BREAK,IN1.District Report1
005330* BREAK,IN1.Name) REPORT
COUNT Sums.ix BREAK;Report1
005340 Move ZERO TO ix OF Sums(1). Report1
005350 SORT SORTWORK
Report1
005360 ON ASCENDING KEY Region OF
JZ-SORTWORK Report1
005370 ON ASCENDING KEY District OF
JZ-SORTWORK Report1
005380 ON ASCENDING KEY JZ-Name OF
JZ-SORTWORK Report1
005390 INPUT PROCEDURE IS
JZ-21-PROCESSGroup-INPUT
Report1
005400 OUTPUT PROCEDURE IS
JZ-21-PROCESSGroup-OUTPUT.
Report1
005410*
Report1
005420
JZ-21-PROCESSGroup-INPUT. Report1
005430 PERFORM JZ-21-PROCESSGroup-INPUT1 UNTIL
IN1-ENDFILE = 'Y'. Report1
005440*
Report1
005450
JZ-21-PROCESSGroup-INPUT1. Report1
005460 READ IN1 NEXT RECORD AT END MOVE 'Y' TO
IN1-ENDFILE. Report1
005470 IF IN1-STATUS IS NOT = '00' AND IN1-STATUS
IS NOT = '10' Report1
005480 DISPLAY 'PROGRAM TERMINATED. STATUS
CODE NOT 00 FOR READ Report1
005490- 'IN1. Code=' IN1-STATUS Report1
005500 MOVE 'Y' TO IN1-ENDFILE Report1
005510 END-IF. Report1
005520 IF IN1-ENDFILE = 'N'
Report1
005530 ADD 1 TO ix OF Sums(1) Report1
005540* Move referenced fields to Sortwork Report1
005550 Move Region OF JZ-IN1 TO Region OF
JZ-SORTWORK Report1
005560 Move District OF JZ-IN1 TO District OF
JZ-SORTWORK Report1
005570 Move JZ-Name OF JZ-IN1 TO JZ-Name OF
JZ-SORTWORK Report1
005580 Move SalesThisMonth
OF JZ-IN1 TO SalesThisMonth OF Report1
005590 JZ-SORTWORK
Report1
005600 Move SalesYTD
OF JZ-IN1 TO SalesYTD OF JZ-SORTWORK Report1
005610 RELEASE JZ-SORTWORK Report1
005620 END-IF.
Report1
005630*
Report1
005640 JZ-21-PROCESSGroup-OUTPUT. Report1
005650 Move ZERO TO ix OF Sums(1). Report1
005660 PERFORM JZ-21-PROCESSGroup-OUTPUT1 UNTIL
SORTWORK-ENDFILE = 'Report1
005670- 'Y'. Report1
005680*
Report1
005690
JZ-21-PROCESSGroup-OUTPUT1. Report1
005700 RETURN SORTWORK AT END MOVE 'Y' TO SORTWORK-ENDFILE Report1
005710 END-RETURN.
Report1
005720 IF SORTWORK-ENDFILE = 'N' Report1
005730* Move referenced fields back from Sortwork Report1
005740 Move Region OF JZ-SORTWORK TO Region
OF JZ-IN1 Report1
005750 Move District OF JZ-SORTWORK TO
District OF JZ-IN1 Report1
005760 Move JZ-Name OF JZ-SORTWORK TO JZ-Name
OF JZ-IN1 Report1
005770 Move SalesThisMonth
OF JZ-SORTWORK TO SalesThisMonth OF Report1
005780 JZ-IN1
Report1
005790 Move SalesYTD
OF JZ-SORTWORK TO SalesYTD OF JZ-IN1 Report1
005800* Control break Processing Report1
005810 PERFORM RepFile-CBreak Report1
005820 Add 1 TO ix OF Sums(1) Report1
005830 PERFORM JZR-Detail Report1
005840* END PROCESS IN1;
Report1
005850 CONTINUE Report1
005860 END-IF.
Report1
005870******************************************************************Report1
005880**
**Report1
005890** Routines **Report1
005900**
**Report1
005910******************************************************************Report1
005920 JZR-PageHead.
Report1
005930 MOVE 'N' TO RepFile-NewPage-Enabled. Report1
005940* PLINE ('P','Printed
',JAZZ.$Today,'IN1 Report Title'
Report1
005950* COL(57),'Page '
COL(123),JAZZ.$PageNbr) PAGE;Report1
005960 MOVE JZ-ReportTimeStamp
TO JZ-Today OF JZ-PLINE24.
Report1
005970 MOVE RepFile-PageNbr
TO JZ-PageNbr OF JZ-PLINE24. Report1
005980 MOVE 60 TO RepFile-LineCount. Report1
005990 MOVE 1 TO RepFile-Space. Report1
006000 MOVE JZ-PLINE24 TO JZ-RepFile. Report1
006010 PERFORM Repfile-PRINT. Report1
006020* PLINE ('D'
Report1
006030*
INDEX(1),'*-----------------Name-----------------*' INDEX(2) Report1
006040* COL(9),'SalesThisMonth'
INDEX(3) COL(53),'*-SalesYTD-*' Report1
006050*
INDEX(4) COL(76));Report1
006060 MOVE 1 TO RepFile-Space. Report1
006070 MOVE JZ-PLINE25 TO JZ-RepFile. Report1
006080 PERFORM Repfile-PRINT. Report1
006090* END ROUTINE $R-PageHead; Report1
006100 MOVE 'Y' TO RepFile-NewPage-Enabled. Report1
006110* Report1
006120 JZR-Head.
Report1
006130* END ROUTINE $R-Head;
Report1
006140* Report1
006150
JZR-Head-Region.
Report1
006160* GET FR WHERE (FR.Region
= IN1.Region);
Report1
006170 PERFORM JZ-30-GET. Report1
006180*
Report1
006190 JZ-30-GET.
Report1
006200* GET FR WHERE (FR.Region
= IN1.Region); Report1
006210 MOVE 'N' TO FR-Get4Update-FLAG. Report1
006220 MOVE Region OF JZ-IN1 TO Region OF
JZ-FR. Report1
006230 MOVE 'Y' TO FR-Found-Flag. Report1
006240 READ
FR KEY Region OF JZ-FR INVALID KEY MOVE 'N' TO Report1
006250 FR-Found-Flag END-READ. Report1
006260 IF FR-Found-Flag = 'N' Report1
006270 PERFORM FR-Initialize-30 Report1
006280 END-IF.
Report1
006290* PLINE (' ','Region ',IN1.Region,FR.Name
COL(16)); Report1
006300 MOVE Region OF JZ-IN1 TO Region OF
JZ-PLINE31. Report1
006310 MOVE JZ-Name OF JZ-FR TO JZ-Name OF
JZ-PLINE31. Report1
006320 MOVE 1 TO RepFile-Space. Report1
006330 MOVE JZ-PLINE31 TO JZ-RepFile. Report1
006340 PERFORM Repfile-PRINT. Report1
006350* END ROUTINE $R-Head-Region; Report1
006360*
Report1
006370
JZR-Head-District.
Report1
006380* PLINE (' ','District ',IN1.District); Report1
006390 MOVE District OF JZ-IN1 TO District OF
JZ-PLINE34. Report1
006400 MOVE 1 TO RepFile-Space. Report1
006410 MOVE JZ-PLINE34 TO JZ-RepFile. Report1
006420 PERFORM Repfile-PRINT. Report1
006430* END ROUTINE $R-Head-District; Report1
006440*
Report1
006450 JZR-Detail.
Report1
006460* PLINE ('D' INDEX(1),IN1.Name INDEX(2) Report1
006470* COL(9),IN1.SalesThisMonth INDEX(3) SUM
COL(55),IN1.SalesYTD Report1
006480*
INDEX(4) SUM COL(76));Report1
006490 MOVE JZ-Name OF JZ-IN1 TO JZ-Name OF
JZ-PLINE37. Report1
006500 MOVE SalesThisMonth
OF JZ-IN1 TO SalesThisMonth OF Report1
006510 JZ-PLINE37.
Report1
006520 ADD SalesThisMonth
OF JZ-IN1 TO SalesThisMonth OF Sums(1). Report1
006530 MOVE SalesYTD OF
JZ-IN1 TO SalesYTD OF JZ-PLINE37. Report1
006540 ADD SalesYTD OF
JZ-IN1 TO SalesYTD OF Sums(1). Report1
006550 MOVE 1 TO RepFile-Space. Report1
006560 MOVE JZ-PLINE37 TO JZ-RepFile. Report1
006570 PERFORM Repfile-PRINT. Report1
006580* END ROUTINE $R-Detail; Report1
006590* Report1
006600
JZR-End-District.
Report1
006610* Break.Sub =
1;
Report1
006620 MOVE 1 TO Sub OF Break. Report1
006630* PLINE ('D' INDEX(1),'District ',Break.District,'
Report1
006640* Subtotal',Sums.SalesThisMonth(1)
INDEX(3) Report1
006650* COL(50),Sums.SalesYTD(1)
INDEX(4) COL(71));Report1
006660 MOVE District OF Break TO District OF
JZ-PLINE41. Report1
006670 MOVE SalesThisMonth
OF Sums(1) TO SalesThisMonth OF Report1
006680 JZ-PLINE41. Report1
006690 MOVE SalesYTD OF
Sums(1) TO SalesYTD OF JZ-PLINE41. Report1
006700 MOVE 1 TO RepFile-Space. Report1
006710 MOVE JZ-PLINE41 TO JZ-RepFile. Report1
006720 PERFORM Repfile-PRINT. Report1
006730* Averages.SalesThisMonth
= Sums.SalesThisMonth(1) / Report1
006740*
sums.ix(1);Report1
006750 COMPUTE SalesThisMonth
OF Averages = SalesThisMonth OF Sums Report1
006760 (1 )/ ix OF Sums (1 ). Report1
006770* Averages.SalesYTD
= sums.salesYTD(1)/Sums.ix(1); Report1
006780 COMPUTE SalesYTD
OF Averages = SalesYTD OF Sums (1 )/ ix OF Report1
006790 Sums (1 ).
Report1
006800* PLINE (' ','Count' COL(4),Sums.ix(1) COL(11),'Average' Report1
006810* COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD Report1
006820*
COL(76));Report1
006830 MOVE ix OF Sums(1) TO ix OF
JZ-PLINE44. Report1
006840 MOVE SalesThisMonth
OF Averages TO SalesThisMonth OF Report1
006850 JZ-PLINE44.
Report1
006860 MOVE SalesYTD OF
Averages TO SalesYTD OF JZ-PLINE44. Report1
006870 MOVE 1 TO RepFile-Space. Report1
006880 MOVE JZ-PLINE44 TO JZ-RepFile. Report1
006890 PERFORM Repfile-PRINT. Report1
006900* END ROUTINE $R-End-District; Report1
006910 PERFORM JZR-Sums-Rollup. Report1
006920*
Report1
006930
JZR-End-Region.
Report1
006940* Break.Sub =
2;
Report1
006950 MOVE 2 TO Sub OF Break. Report1
006960* PLINE ('D' INDEX(1),'Region ',Break.Region,' Report1
006970* Subtotal',Sums.SalesThisMonth(2)
INDEX(3) Report1
006980* COL(50),Sums.SalesYTD(2) INDEX(4) COL(71));Report1
006990 MOVE Region OF Break TO Region OF
JZ-PLINE48. Report1
007000 MOVE SalesThisMonth
OF Sums(2) TO SalesThisMonth OF Report1
007010 JZ-PLINE48.
Report1
007020 MOVE SalesYTD OF
Sums(2) TO SalesYTD OF JZ-PLINE48. Report1
007030 MOVE 1 TO RepFile-Space. Report1
007040 MOVE JZ-PLINE48 TO JZ-RepFile. Report1
007050 PERFORM Repfile-PRINT. Report1
007060* Averages.SalesThisMonth
= Sums.SalesThisMonth(2) / Report1
007070*
sums.ix(2);Report1
007080 COMPUTE SalesThisMonth
OF Averages = SalesThisMonth OF Sums Report1
007090 (2 )/ ix OF Sums (2 ). Report1
007100* Averages.SalesYTD
= sums.salesYTD(2)/Sums.ix(2); Report1
007110 COMPUTE SalesYTD
OF Averages = SalesYTD OF Sums (2 )/ ix OF Report1
007120 Sums (2 ).
Report1
007130* PLINE (' ','Count' COL(4),Sums.ix(2) COL(11),'Average' Report1
007140* COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD Report1
007150*
COL(76));Report1
007160 MOVE ix OF Sums(2) TO ix OF JZ-PLINE51. Report1
007170 MOVE SalesThisMonth
OF Averages TO SalesThisMonth OF Report1
007180 JZ-PLINE51.
Report1
007190 MOVE SalesYTD OF
Averages TO SalesYTD OF JZ-PLINE51. Report1
007200 MOVE 1 TO RepFile-Space. Report1
007210 MOVE JZ-PLINE51 TO JZ-RepFile. Report1
007220 PERFORM Repfile-PRINT. Report1
007230* END ROUTINE $R-End-Region; Report1
007240 PERFORM JZR-Sums-Rollup. Report1
007250*
Report1
007260 JZR-End.
Report1
007270* PLINE (' ','Grand Total'); Report1
007280 MOVE 1 TO RepFile-Space. Report1
007290 MOVE JZ-PLINE54 TO JZ-RepFile. Report1
007300 PERFORM Repfile-PRINT. Report1
007310* PLINE ('D' INDEX(1),Sums.SalesThisMonth(3)
INDEX(3) Report1
007320* COL(50),Sums.SalesYTD(3) INDEX(4) COL(71));Report1
007330 MOVE SalesThisMonth
OF Sums(3) TO SalesThisMonth OF Report1
007340 JZ-PLINE55.
Report1
007350 MOVE SalesYTD OF
Sums(3) TO SalesYTD OF JZ-PLINE55. Report1
007360 MOVE 1 TO RepFile-Space. Report1
007370 MOVE JZ-PLINE55 TO JZ-RepFile. Report1
007380 PERFORM Repfile-PRINT. Report1
007390* Averages.SalesThisMonth
= Sums.SalesThisMonth(3) / Report1
007400*
sums.ix(3);Report1
007410 COMPUTE SalesThisMonth
OF Averages = SalesThisMonth OF Sums Report1
007420 (3 )/ ix OF Sums (3 ). Report1
007430* Averages.SalesYTD
= sums.salesYTD(3)/Sums.ix(3); Report1
007440 COMPUTE SalesYTD
OF Averages = SalesYTD OF Sums (3 )/ ix OF Report1
007450 Sums (3 ).
Report1
007460* PLINE (' ','Count' COL(4),Sums.ix(3) COL(11),'Average' Report1
007470* COL(44),Averages.SalesThisMonth
COL(55),Averages.SalesYTD Report1
007480* COL(76));Report1
007490 MOVE ix OF Sums(3) TO ix OF
JZ-PLINE58. Report1
007500 MOVE SalesThisMonth
OF Averages TO SalesThisMonth OF Report1
007510 JZ-PLINE58. Report1
007520 MOVE SalesYTD OF
Averages TO SalesYTD OF JZ-PLINE58. Report1
007530 MOVE 1 TO RepFile-Space. Report1
007540 MOVE JZ-PLINE58 TO JZ-RepFile. Report1
007550 PERFORM Repfile-PRINT. Report1
007560* END ROUTINE $R-End;
Report1
007570*
Report1
007580 JZR-PageFoot.
Report1
007590 MOVE 'N' TO RepFile-NewPage-Enabled. Report1
007600* PLINE (' ','Printed ',JAZZ.$Today,'IN1
Report Title' Report1
007610* COL(57),'Page ' COL(123),JAZZ.$PageNbr) SPACE(2);Report1
007620 MOVE JZ-ReportTimeStamp
TO JZ-Today OF JZ-PLINE61.
Report1
007630 MOVE RepFile-PageNbr
TO JZ-PageNbr OF JZ-PLINE61. Report1
007640 MOVE 2 TO RepFile-Space. Report1
007650 MOVE JZ-PLINE61 TO JZ-RepFile. Report1
007660 PERFORM Repfile-PRINT. Report1
007670* END ROUTINE $R-PageFoot; Report1
007680 MOVE 'Y' TO RepFile-NewPage-Enabled. Report1
007690*
Report1
007700
JZR-Sums-Rollup. Report1
007710* END ROUTINE $R-Sums-Rollup; Report1
007720 ADD ix OF Sums(SUB OF Break) TO ix OF
Sums(SUB OF Break + 1).Report1
007730 MOVE 0 TO ix OF Sums(SUB OF Break). Report1
007740 ADD SalesThisMonth
OF Sums(SUB OF Break) TO SalesThisMonth OFReport1
007750 Sums(SUB OF Break + 1). Report1
007760 MOVE 0 TO SalesThisMonth
OF Sums(SUB OF Break).
Report1
007770 ADD SalesYTD OF
Sums(SUB OF Break) TO SalesYTD OF Sums(SUB OFReport1
007780 Break + 1).
Report1
007790 MOVE 0 TO SalesYTD
OF Sums(SUB OF Break).
Report1
007800******************************************************************Report1
007810**
**Report1
007820** Code Conversion
Routines **Report1
007830** **Report1
007840******************************************************************Report1
007850*
Report1
007860* Convert JZSMth-SMth
code to value Report1
007870 JZCvt-JZSMth-SMth.
Report1
007880* Input: SEARCH-FOR OF JZCodes-JZSMth-SMth Report1
007890* Output: FOUND-VALUE OF JZCodes-JZSMth-SMth Report1
007900* If Invalid, FOUND-VALUE will be set to
'****', Report1
007910* field JZ-CHAR80 will contain an
error message Report1
007920 SET JZIX-JZSMth-SMth TO SEARCH-FOR OF JZCodes-JZSMth-SMth. Report1
007930 IF JZIX-JZSMth-SMth < 1 OR JZIX-JZSMth-SMth > 12
Report1
007940 MOVE 'Outside Code Range' TO
JZ-CHAR80 Report1
007950 MOVE '***' TO FOUND-VALUE OF JZCodes-JZSMth-SMth
Report1
007960 ELSE Report1
007970 MOVE CODE-Value OF JZCodes-JZSMth-SMth(JZIX-JZSMth-SMth) Report1
007980 TO FOUND-VALUE OF JZCodes-JZSMth-SMth Report1
007990 END-IF. Report1
008000******************************************************************Report1
008010**
**Report1
008020** Print Routine **Report1
008030**
**Report1
008040******************************************************************Report1
008050*
Report1
008060 RepFile-PRINT.
Report1
008070 If RepFile-LineCount
>= 58
Report1
008080 If RepFile-NewPage-Enabled = 'Y' Report1
008090 MOVE JZ-RepFile
TO JZ-RepFile-SAVE Report1
008100 IF RepFile-PageNbr
> ZERO
Report1
008110 PERFORM JZR-PageFoot Report1
008120 END-IF
Report1
008130 Move 'Y' TO RepFile-NewPage Report1
008140 Add 1 TO Repfile-PageNbr Report1
008150 PERFORM JZR-PageHead Report1
008160 MOVE JZ-RepFile-SAVE
TO JZ-RepFile Report1
008170 END-IF
Report1
008180 IF RepFile-NewPage
= 'Y' Report1
008190 WRITE JZ-RepFile
AFTER ADVANCING PAGE
Report1
008200 Move 'N' TO RepFile-NewPage Report1
008210 Move 0 TO RepFile-LineCount Report1
008220 ELSE
Report1
008230 WRITE JZ-RepFile
AFTER ADVANCING RepFile-SPACE LINES Report1
008240 END-IF
Report1
008250 ELSE
Report1
008260 WRITE JZ-RepFile
AFTER ADVANCING RepFile-SPACE LINES Report1
008270 ADD RepFile-SPACE
TO RepFile-LineCount Report1
008280 END-IF.
Report1
008290******************************************************************Report1
008300**
**Report1
008310** Sundry Routines **Report1
008320**
**Report1
008330******************************************************************Report1
008340* Report1
008350* Format Date for reports Report1
008360 JZDT01.
Report1
008370* Move Corresponding JZ-DATETIME-2 TO JZ-ReportTS
Report1
008380 MOVE JZ-DAY OF JZ-DateTIME-2 TO JZ-DAY OF
JZ-ReportTS.
Report1
008390 MOVE JZ-YEAR OF JZ-DateTIME-2 TO JZ-YEAR
OF JZ-ReportTS.
Report1
008400 MOVE JZ-HOUR OF JZ-DateTIME-2 TO JZ-HOUR
OF JZ-ReportTS.
Report1
008410 MOVE JZ-MINUTE OF JZ-DateTIME-2 TO
JZ-MINUTE OF JZ-ReportTS. Report1
008420 MOVE JZ-SECOND OF JZ-DateTIME-2 TO
JZ-SECOND OF JZ-ReportTS. Report1
008430* Format Month Report1
008440 MOVE JZ-MONTH TO SMth
OF JZSMth. Report1
008450 MOVE SMth OF JZSMth TO SEARCH-FOR OF JZCodes-JZSMth-SMth. Report1
008460 PERFORM JZCvt-JZSMth-SMth. Report1
008470 MOVE FOUND-VALUE OF JZCodes-JZSMth-SMth
TO JZ-MONTH-NAME. Report1
008480*
Report1
008490 RepFile-CBreak.
Report1
008500* 1.
Set LEVEL OF BREAK Report1
008510 Add 1 TO Rec-Count OF BREAK. Report1
008520 IF Rec-Count OF BREAK = 1 Report1
008530* 1st Record, just set control fields. Level
already 0 Report1
008540 MOVE Region OF JZ-IN1 TO Region OF
BREAK Report1
008550 MOVE District OF JZ-IN1 TO District OF
BREAK Report1
008560 ELSE Report1
008570 IF Region OF JZ-IN1 IS NOT = Region OF
BREAK Report1
008580 MOVE 2 TO Level OF BREAK Report1
008590 ELSE Report1
008600 IF District OF JZ-IN1 IS NOT =
District OF BREAK Report1
008610 MOVE 1 TO Level OF BREAK Report1
008620 ELSE Report1
008630 MOVE 0 TO Level OF BREAK Report1
008640 END-IF
Report1
008650 END-IF
Report1
008660 END-IF.
Report1
008670* 2.
IF level of control break > 0, perform END routines Report1
008680 IF Level OF BREAK > 0 Report1
008690 PERFORM JZR-END-District Report1
008700 END-IF.
Report1
008710 IF Level OF BREAK > 1 Report1
008720 PERFORM JZR-END-Region Report1
008730 END-IF.
Report1
008740* 3.
Reset for new control break Report1
008750 IF Rec-Count OF BREAK = 1 Report1
008760 PERFORM JZR-HEAD
Report1
008770 PERFORM JZR-HEAD-Region Report1
008780 PERFORM JZR-HEAD-District Report1
008790 END-IF.
Report1
008800 IF Level OF BREAK >= 2 Report1
008810 Move Region OF JZ-IN1 TO Region OF
BREAK Report1
008820 PERFORM JZR-HEAD-Region Report1
008830 END-IF.
Report1
008840 IF Level OF BREAK >= 1 Report1
008850 Move District OF JZ-IN1 TO District OF
BREAK Report1
008860 PERFORM JZR-HEAD-District Report1
008870 END-IF.
Report1
008880* Report1
008890
FR-Initialize-30.
Report1
008900 PERFORM FR-Initialize. Report1
008910 MOVE Region OF JZ-IN1 TO Region OF
JZ-FR. Report1
008920*
Report1
008930
FR-Initialize.
Report1
008940* Initialize non-key fields Report1
008950 Move 'No Record found' TO JZ-Name OF
JZ-FR. Report1