The Jazz Report Designer

The Jazz Report Designer 1

Creating a New Report 2

Generating a New Report 3

Getting the WHERE condition. 3

Order: setting the control breaks. 4

Look-up files. 5

Generating the report 5

Jazz Program Report Layout 6

Report Editing. 7

Dropping Data. 7

Dropping on a Normal Line (not Detail) 7

Dragging data to the Detail Line. 8

Dropping Groups and Records. 11

Relocating Data. 11

Relocating Single Items. 11

Relocating Item Groups. 11

Managing multiple selection. 12

Deleting. 13

Deleting Filler 13

Deleting characters. 14

Deleting Items. 14

Deleting Lines. 14

Deleting Line Space. 14

Undo. 14

Item Properties. 14

Editing Text Fields. 15

Aligning Item Groups. 15

Line Tags (Control Characters) 15

Reports with Repeating (Table) Fields. 17

Table Cross-sections and Partial Extents. 18

Other Dimensions. 20

Jazz Report Programs. 20

The REPORT option. 21

DEFINE RepNbrs. 21

PROCESS statement and ROUTINE statements. 21

$R-xxx routines. 22

Special rules: $R-End-xxx routines. 22

Special rules: $R-Head. 22

PLINE statements. 23

Reports and Jazz Logic. 23

Counting Records. 24

Calculating Averages. 24

Running Counts and Totals. 24

Writing Files on Control Break. 24

Report 1 Editor View.. 24

Report 1 Sample Report 24


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.


Creating a New Report

To create a report click [JazzGen], and Select Report from the menu: -


The Report Form appears where you set overall report characteristics such as the report files, title, line width, etc. Click here for details of this form.

Generating a New Report

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 didnt 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]: -

Getting the WHERE condition

Weve 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: -


causing Jazz to invoke its query dialog.


Hint: drag the forms 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 >. Well have to edit the PROCESS statement later.

Order: setting the control breaks

On reaching ORDER(In1.?) the query dialog appears again. We expand In1 in the treeview and select the sequence fields. With each sequence field were 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.

Look-up files

By putting FR into Lookup File 1 Jazz knows that at the start of the first control break well want to GET something from FR, but what? Jazz generates


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);

Generating the report

When all queries are resolved Jazz generates a program, and then opens the Report editor.

Jazz Program Report Layout

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)




PROCESS In1 WHERE(IN1.SalesYTD > 1000)




Conversly, while it is possible to edit the PLINE statements, this is not recommended. It is 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 statements. 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.

Report Editing

Here is the Report Editor displaying newly-generated report REPORTX.



Dropping Data

Expand the treeview to locate the data that we want. Drag this to the position that we want on the report. You cant drop on to a tag (for example, #$R-Detail), not on to another item, but you can drop anywhere in the filler space (...) or +Add another line

Dropping on a Normal Line (not Detail)

In $R-Head-Region we have the Jazz statement

GET FR WHERE (FR.Region = IN1.Region);

so now we have the FR.Name value that corresponds to IN1.Region. Here weve expanded FR, and dragged Name to the position shown in the $R-Head-Region section.

Dragging data to the Detail Line

There are extra rules when data is dragged to the detail line. Here Ive dragged IN1.Name to the detail line, dropping it on to Add Another Line. Because Im 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 name of the field 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 were 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 well 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.

Dropping Groups and Records

So far weve 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 Data

Relocating Single Items

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 would always be blank because at this stage your program hasnt read the FR record.

Relocating Item Groups

When you click on one of the items resulting from a detail-line drop youll see that all of the related items are selected. You dont 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 youve 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 cant be moved left. Also, theres only two characters on the right before the total fields run into SalesYTDs total fields so thats its maximum right drag. When drag limits are exceeded youll 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.

Managing multiple selection

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, youve done as above and unselected the other items) then it may appear to be unselected, but youll 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/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.

Deleting Filler

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.

Deleting characters

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.

Deleting Items

With one or more item(s) selected press the Delete key, or click the Delete (trashcan) button. If several items are selected, then theyll all be deleted.

Deleting Lines

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.

Deleting Line Space

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.

Item Properties

We can right-click an item on the report and a form appears describing the item. Here weve 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 cant change any of this here but in other cases this form offers opportunities to edit the report.

Editing Text Fields

We can type text anywhere on the edit form where wed 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.

Aligning Item Groups

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 cant be moved enough.

Line Tags (Control Characters)

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.

Line Spacing and New Pages

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 youll see (for example): -


The Space value must be 1 or greater. By increasing the Space value here youll 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 youll see: -

Summary-only Lines: Printing Totals Without Printing Detail Lines

Suppose that you want to print a report with subtotals and totals, but you dont 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.

Jazz Statements

* indicates a Jazz line, for example


These lines are not editable in the report editor, they are displayed as comments only.

Reports with Repeating (Table) Fields

Handling dimensioned fields with PRINT statements can be quite tricky. For example, with a record layout like this: -



Region DECIMAL(3),

District DECIMAL(3),


Name CHAR(15),

Sales(12) GROUP,


SalesThisMonth DECIMAL(7,2),



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)) ;


It gets even more complicated if you dont want non-subscripted fields like INDim.Region to be printed on every line.


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 cant 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) COL(45),INDim.SalesThisMonth(JZ.IX1) INDEX(6) SUM COL(52),

INDim.NbrSales(JZ.IX1) INDEX(7) SUM COL(69));


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


3 7 GIBBS,Ann 206.02


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: -



Sales(12(NbrSales)) GROUP,


SalesThisMonth DECIMAL(7,2),



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.

Table Cross-sections and Partial Extents.

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 well 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));



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 New Zealand

1 BLEE,ElliottLin 78.00





















1 HANNAH,Honour 241.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 New Zealand

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 New Zealand

1 BLEE,ElliottLin 78.00







1 HANNAH,Honour 241.00


         Drag Sales to the report twice more, each time changing the subscript to a number (2 or 3), and checking Sum: -

         Change the reports 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 New Zealand

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

Other Dimensions

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: -



Region DECIMAL(3),

District DECIMAL(3),


Name CHAR(15),

Sales(12) GROUP,

Month TINYINT, [LIKE types.month,'

SalesThisMonth DECIMAL(7,2),



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 cant 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) );


Jazz Report Programs

In this section we discuss the special features of the Jazz language designed to support Report programs, using Jazz program Report 1 as our example. You might like to look at Report 1 Editor View to see what this looks like when you click the [Report] button, and Report 1 Sample Report to see the report produced from some test-data. Here is program Report1: -


*# Last Updated by IBMUSER at 12/05/2017 9:02:13 a.m.

PROGRAM Report1 REPORT(132) PAGE(60);


Width SMALLINT VALUE 132 Constant,

Page SMALLINT VALUE 60 Constant,

Title CHAR(16) VALUE 'in1 Report Title' Constant);

COPY in1;




ROUTINE $R-PageHead;

* Top of every page

PLINE ('P','Printed ',COBOL.$Today,'in1 Report Title' COL(57),'Page ' COL(123),COBOL.$PageNbr) PAGE;

PLINE ('D' INDEX(1),'Region' INDEX(2) COL(14),'District' INDEX(3),'*----Name-----*' INDEX(4) COL(29),'SalesThisMonth' INDEX(5),'*SalesYTD*' INDEX(6) COL(63),'BillingCycle' INDEX(7),'DateCommenced' INDEX(8) COL(86));



* Before first record has been read


ROUTINE $R-Head-Region;

* Start of control break: Region

GET FR WHERE (FR.Region = IN1.Region);

PLINE (' ','Region ',IN1.Region,FR.Name COL(18));

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.Region INDEX(2) COL(16),IN1.District INDEX(3) COL(24),IN1.Name INDEX(4) COL(29),IN1.SalesThisMonth INDEX(5) SUM COL(48),IN1.SalesYTD INDEX(6) SUM COL(63),IN1.BillingCycle INDEX(7) COL(76),IN1.DateCommenced INDEX(8) COL(86));


ROUTINE $R-End-District;

* End of control break: District

PLINE (' ','District ',Break.District,' Subtotal');

PLINE ('D' INDEX(1),Sums.SalesThisMonth(1) INDEX(5) COL(43),Sums.SalesYTD(1) INDEX(6));

END ROUTINE $R-End-District;

ROUTINE $R-End-Region;

* End of control break: Region

PLINE (' ','Region ',Break.Region,' Subtotal');

PLINE ('D' INDEX(1),Sums.SalesThisMonth(2) INDEX(5) COL(43),Sums.SalesYTD(2) INDEX(6));

END ROUTINE $R-End-Region;


* End of Records

PLINE (' ','Grand Total');

PLINE ('D' INDEX(1),Sums.SalesThisMonth(3) INDEX(5) COL(43),Sums.SalesYTD(3) INDEX(6));


ROUTINE $R-PageFoot;

* Page Footer

PLINE (' ','Printed ',COBOL.$Today,'in1 Report Title' COL(57),'Page ' COL(123),COBOL.$PageNbr) SPACE(2);


The REPORT option

The PROGRAM and PROCESS statements both have option REPORT. PROGRAM REPORT enables the [Report] button, and allows other Jazz language features such as PROCESS REPORT.


This as 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. Dont change this definition.

PROCESS statement and ROUTINE statements



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 file are read data is tested for control breaks (in this example IN1.Region and IN1.District) and:

If there is a control break change the $R-End-name routines are called

Then the $R-Head routine(s) are called

Then $R-Detail handles the current record


Since all the logic is generated into the routines, there is no need for logic between PROCESS and END PROCESS.


END PROCESS is followed by the set of generated routines.


If you modify the PROCESS statement you should be very careful. There should be little problem adding further options such as WHERE or INDEX), but errors will probably result from adding or deleting control breaks unless you are very careful to create exactly the correct ROUTINE structure.

$R-xxx routines

You can write any logic you like within the generated ROUTINE statements. If you write logic within the PROCESS loop, for example



W.N += 1;


note that this is executed AFTER the input record has been processed by the control break and detail logic of the routines. This statement should probably have been written within the $R-Detail routine.


You can write your own ROUTINE statements and PERFORM them as you would normally. Although possibly valid, you should avoid using names starting with $ for your our own routines.

Special rules: $R-End-xxx routines

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 mightnt even be such a record, as these routines (and $R-End) are invoked on endfile also.



ROUTINE $R-End-Region;

* End of control break: Region

PLINE (' ','Region ',Break.Region,' Subtotal');

PLINE ('D' INDEX(1),Sums.SalesThisMonth(2) INDEX(5) COL(43),Sums.SalesYTD(2) INDEX(6));

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.

Special rules: $R-Head

Routine $R-Head is executed before ANY data has been read from IN1, so you should not refer to any file data unless your $R-Head routine first reads it with its own GET statement.

PLINE statements

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 the 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. While it is possible to edit the PLINE statements within the workbench it is a normal Jazz statement it is better to use the report editor.

Reports and Jazz Logic

You can write any logic you like (provided that it makes sense) within a routine. 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. When youre writing logic within a $R-xxx routine you need to understand when this routine is invoked, and so what data will be available to it. The following notes suggest how youd handle some common situations.

Counting Records

Calculating Averages

Running Counts and Totals

Writing Files on Control Break

Report 1 Editor View

Report 1 Sample Report

1Printed 10 May 2017, 23:13:15 in1 Report Title Page 2

RegionDistrict *----Name-----*SalesThisMonth *SalesYTD*BillingCycle DateCommenced

District 10 Subtotal

618.06 13,920.75

Region 1 Subtotal

3,090.30 69,603.75

Region 2 Australia

District 1

2 1 AXCELL,Flora 206.02 4,640.25 July

2 1 CHRISTOPHERSDAT 206.02 4,640.25 ********* 2013-06-11

District 1 Subtotal

412.04 9,280.50

District 2

2 2 ANDREW,Andrs 206.02 4,640.25 June 2013-06-11

2 2 APTHORPE,BILL 206.02 4,640.25 April 2013-06-11

2 2 AXCELL,Aves 206.02 4,640.25 January 2013-06-11

2 2 AXCELL,HarrietM 206.02 4,640.25 September 2013-06-11

2 2 DINGMANSE,Alber 206.02 4,640.25 June 2013-06-11

District 2 Subtotal

1,030.10 23,201.25