Converting Easytrieve™ to COBOL with MANASYS Jazz

This is the third of a 10-part series of articles about MANASYS Jazz.
            Click here to see the first article, What is MANASYS Jazz?
            Click here to see the 2nd Article, How does MANASYS Work?

Converting Easytrieve™ to COBOL with MANASYS Jazz. 1

Why use MANASYS Jazz to Convert Easytrieve™ to COBOL?. 1

Step 1.  Convert Easytrieve Library to Jazz Definitions. 1

Step 2.  Create Program Structure. 1

Step 3.  Convert Easytrieve Logic: the Easytrieve Conversion Notepad. 1

Controlling Report Layout 1

Field Display Format 1

Report Layout 1

Easytrieve Conversion – Current Development Status. 1

Supported Databases. 1

Data Types. 1

Macros. 1

Let us Prove It – Ask us for a Quote. 1

Appendices. 1

Record IN1. 1

Record FR.. 1

Program IN1R.. 1

Report from IN1R.. 1

Program IN1R2. 1

Report from IN1R2. 1

Report from IN1R2, with ALL. 1

Report from IN1R2, with BREAK.. 1

Program IN1R2 as COBOL. 1

A Report-Designer Program.. 1

Why use MANASYS Jazz to Convert Easytrieve™ to COBOL?

Easytrieve™ was the inspiration for the very first version of MANASYS, which was essentially “Easytrieve that generated PL/I”.  This makes MANASYS Jazz the easiest and best way of converting Easytrieve to COBOLEasy because an Easytrieve program has a similar structure to a basic report program in Jazz.  You can even copy/paste some Easytrieve code into Jazz and make minor edits and it will be correct.  Best because you are left with high quality COBOL that needs no run-time support. 

With MANASYS Jazz you should be able to convert simple Easytrieve programs into COBOL in a few minutes. Complex programs shouldn’t take more than an hour.

Converting Easytrieve to Jazz is very simple: -

1.    Prepare Jazz-format definitions of your data with a few clicks using dialog New/Data/Import from Easytrieve.  Optionally, edit the definitions to take advantage of Jazz features.

2.    For each JOB in the Easytrieve program, create a basic program structure with the dialog New/Logic/Batch, checking the option Enable EZT Conversion.   This creates an Easytrieve-like Jazz program similar to those shown in the Initial demonstration video, but with a button [EZT Conv] and markers indicating where converted code will go.

3.    If the Easytrieve programs has calculations or other logic, click [EZT Conv] to open the Easytrieve Conversion Notepad which is a modified Jazz Workbench.  Copy/paste the Easytrieve logic into this (in chunks if it is a very large EZT program), and click [Convert].  Then click [Exit] and choose [Yes], and the converted code is inserted into your Jazz program.

The resulting Jazz program will be similar in length to the Easytrieve™ program.  Click [Process] to turn this into efficient, well written, and easy to understand COBOL that requires no special run-time support.  When compiled, the program will produce a report that will be similar to that from Easytrieve, but with minor layout changes.

Step 1.  Convert Easytrieve Library to Jazz Definitions

Using dialog New/Data/Import from Easytrieve,

·         Click [Browse] and navigate to PAYSRT.EZT  (the program above)

·         Click [Jazz Defn]

Jazz definitions of PERSNL and PAYSORT are produced.  Here’s the definition of PERSNL.   It has been edited as highlighted to add DSNAME.  With the correct DSNAME, MANASYS Jazz can create JCL that will not need editing.



        FILLER CHAR(16),

        EMPNAME CHAR(16),

        FILLER CHAR(61),

        GROSS MONEY(7,2),

        DEPT PIC '999',

        FILLER CHAR(50),

        End GROUP)



Import from Easytrieve will handle invalid COBOL names, redefinitions, working data, and other issues, to produce structures that are valid for Jazz and COBOL definitions.   For details about Data/Import from Easytrieve and the types of definitions that can be converted to Jazz, see Converting Easytrieve Data.  Time so far: about 1½ minutes.

Jazz data definitions can also be created with Data/Import from SQL, Data/Import from COBOL, or created with the Jazz Workbench.  

Step 2.  Create Program Structure

Dialog New/Logic/Batch creates our program outline. For example: -

With each of ORDER, WHERE, and PRINT checked, there are several Select Data dialogs.  First we select GROSS and enter 500 to create a WHERE condition, then we select DEPT and GROSS (with Descending Order) for ORDER, and finally the fields we want for the PRINT statement.  After a simple edit (the condition is changed from = to >=) this program will compile and produce a similar report to PAYSORT.  Time so far – another 2 minutes, plus the previous 1½ minutes.


* You may need to edit these statements


*# Copy Files here ==>


*#Copy Process logic here ==>

    COPY JZSMth;



*#Copy Routines here ==>

No further changes are required, but I chose to remove the comments.   Click [Process] and 6 lines of Jazz immediately become 430 lines of COBOL which will compile and run.  This program is not only simpler than the original Easytrieve it is more efficient, sorting only 23 bytes instead of the 120 bytes of PAYSORT.  Not bad for 3½ minutes!

Step 3.  Convert Easytrieve Logic: the Easytrieve Conversion Notepad.

Program PAY-RPT has logic calculating DEDUCTIONS and NET-PAY, and report LINESIZE and TITLE are specified.   Our Jazz (and COBOL) program will need to include these calculations and details.  

FILE PERSNL FB(150 1800)

  EMPNAME  17  8  A

  EMP#      9  5  N

  DEPT     98  3  N

  GROSS    94  4  P  2

  DEDUCTIONS  W  4  P  2

  NET-PAY     W  4  P  2



  IF GROSS GE  500










Like PAYSRT, first we use Import from Easytrieve to define PERSNL, resulting in this Jazz data definition.  EMP# is changed to EMPNbr, as EMP# would be invalid in COBOL.

*# Converted from FIRST-Plus.txt by JAZZUSR at 17/01/2021 3:05:01 PM



    EMPNbr PIC ‘99999’ HEADING ‘EMP#’,



    FILLER CHAR(69),

    GROSS MONEY(7,2),

    DEPT PIC ‘999’,

    FILLER CHAR(50));



    NET-PAY MONEY(7,2));

Then we use Logic/Batch to create the program structure, checking Enable EZT Conversion and PRINT, but leaving ORDER and WHERE unchecked.  We select fields from PERSNL that we want to print, and [Finish] then produces this program: -

Now we deal with logic, such as calculating DEDUCTIONS and NET-PAY.

Click [EZT Conv] and the Easytrieve Conversion Notepad appears. We copy/paste everything after Job, except for PRINT and LINE, into it.  We’re ignoring PRINT and LINE because we’ve already generated our PRINT statement.

  IF GROSS GE  500









Click [Convert] and it is converted into Jazz.  Mostly the changes are very simple, like adding semicolons, but there are some syntax differences and keyword changes.

Click [Exit] and then [Yes] and this is copied into our Jazz program at the correct markers.


* You may need to edit these statements



*# Copy Files here ==>


    IF PERSNL.GROSS >= 500;






    END IF;

*#Copy Process logic here ==>

    COPY JZSMth;



*#Copy Routines here ==>

Now we complete the program by adding Deductions and NET-PAY to the PRINT, and SUM to the numeric fields: -


             Deductions Sum, Net-Pay sum) ;

[Check] qualifies the new names: -



Now click [Process] and this is instantly turned into COBOL.

Click Easytrieve Logic Conversion for more detailed information on using the Easytrieve Conversion Notepad, the rules of Jazz conversion, and how to deal some issues that you’ll encounter in more complex programs.

Controlling Report Layout

Easytrieve and MANASYS have different rules for determining field positioning and format, so you can expect minor differences in the report appearance.   This may not matter, but if it does then this section is for you.

Once you have created Jazz definitions of the input data then to create reports you have two choices.  The first choice is to start with New/Logic/Batch as in the examples above, creating a MANASYS Jazz program that is similar to Easytrieve.  PRINT statements are used to define what is to be printed, and you largely let the system figure out where the data is to be placed on each line, although it can be controlled as we’ll see later.  This is the approach taken by the examples above, and demonstrated in Program IN1R and Program IN1R2. 

The second choice is to use the report designer.  Start with New/Logic/Report and, as with New/Logic/Batch, you’ll give information such as the name of the primary file, lookup files, and whether the input needs to be sorted, as well as report characteristics like the page size and line width.  But then the Report Designer dialog appears and you design the report by placing the fields exactly where you want them.  This video shows you how it works, and this Users’ Guide Help chapter  gives step-by-step instructions. Use this approach if

·         you want precise layout control,

·         you have an input record with repeating data and want each input record to produce several print lines,

·         you want logic such as average or other calculations on control break, or

·         you want to print control break identification on separate lines so that the full report width is available for other data. 

All of these are much easier to control with the report designer than with a basic batch program.

The next sections are relevant to both approaches, until Report Layout.  A Report-Designer Program in the appendices shows you the type of programs produced by the report designer.

Field Display Format

Here is the definition of file IN1: -


    Region DECIMAL(3),

    District DECIMAL(3),

    Name CHAR(40),

    SalesThisMonth MONEY(7,2),

    SalesYTD MONEY(7,2),

    BillingCycle LIKE Types.Month,

    DateCommenced DATE DPIC 'dd mmm yyyy')

And here is the beginning of the report produced by Program IN1R

Region District *-----------------Name-----------------* *SalesThisMonth-* *----SalesYTD---* BillingCycle DateCommenced             


     1        1 REEDE, Phillip                                   $468.55         $4,685.50            Oct   28 Feb 2018             

Numeric Fields

Region, District, SalesThisMonth, and SalesYTD are all numeric fields, and so are printed right-aligned with their heading which, in the absence of a HEADING property in the DEFINE or PRINT statement, is the field name.

Region and District are 2-byte packed numbers:  in Jazz DECIMAL(3),  in COBOL PIC S9(3) COMP-3.  Allowing for a negative sign, 4 characters are needed to print these fields, but the column width needs to be wider to accommodate the heading.

SalesThisMonth and SalesYTD are also packed decimal, in COBOL PIC S9(5)V9(2) COMP-3, but have type MONEY so that they print with a leading currency sign.  Because they are totalled the column needs to be wide enough to allow for the maximum value so there’s space for extra digits and so the columns are quite wide, causing the headings to be formed by extending the field name with hyphens and then asterisks to mark the column boundaries.

Easytrieve 2 byte Binary fields are SMALLINT in Jazz, 4 byte Binary fields are INTEGER, which are also numeric fields handled like Region etc.

Easytrieve Numeric fields, like DEPT 98 3 N, are display-form numbers, having type like PIC '999'.  They will be printed right-aligned, like other numeric fields.

String Fields

Name has type CHAR(40), in COBOL PIC X(40), in Easytrieve 40 A.   String fields are left aligned under their column heading, which, as before, is the field name extended with hyphens and blanks.

Other Field Types

MANASYS Jazz supports many more field types.  In1 shows two of these: -

DateCommenced DATE DPIC 'dd mmm yyyy'. DATE fields hold date values in format yyyymmdd, i.e. the 28th May 1963 would be a number with value 19630528.  You may encounter these when you are using MANASYS Jazz with data from DB2, which supports this format.  You will probably use DPIC to control the format with which they are displayed.

BillingCycle LIKE Types.Month illustrates both indirect definitions, and a field defined with CODES.  LIKE obviously means that BillingCycle has the same format as Types.Month, and the definition of IN1 will have been preceded by COPY Types;  If we look at the definition of Types we’ll see that Month is defined: -

Month CODES(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec),

Month is a single-byte number with values in the range 0 to 255 (TINYINT), with 1 meaning Jan etc.  As you see from the report line, 10 is printed as Oct

You can define fields of any format with CODES.  For example

SEX CHAR(1) CODES(M:Male,F:Female),

Using this feature in the definition will avoid the need to write logic to convert the code value into its meaning.  Invalid code values will be printed as asterisks.

Explicit Display Formats

You can control the format of numbers and dates explicitly with DPIC, meaning “Display Picture”.  DPIC is basically a COBOL PICTURE, as is the Easytrieve MASK.   As far as I know, both Easytrieve and Jazz follow the same rules, but if not you can easily edit the Easytrieve mask into the correct format for Jazz.

Field Headings

When you don’t want the field name to be the field heading, use HEADING: -

    EMPNbr PIC '99999' HEADING 'EMP#',

Report Layout

(This section is not relevant if you are Using the Report Designer, it only applies to Easytrieve-like reports using PRINT).

Several reports are illustrated in Appendices.

·         By default, fields are arranged from left to right, with one blank separating each column.

·         The column width is the larger of the width required by the field and the heading.  Short headings are extended with - and *.

·         A PRINT statement may contain both field names and constants, for example

PRINT (PERSNL.GROSS SUM, ' less ', PERSNL-WS.DEDUCTIONS SUM, ' gives ', PERSNL-WS.NET-PAY);                                                        

There is no column heading for the constants, and field columns are separated exactly by the constant value.

·         If there is too much data to fit on a print line, then the line overflows and a 2nd print line (and a second set of headings) is created.  This can result in a messy report, so you probably want to control where the line breaks and ensure that columns align neatly.

·         Field position can be specified by adding COL or RCOL to the print item.  COL specifies the left character, and you’d use this for string (CHAR) data.  RCOL specifies the right character, and you usually use this for numbers.  You can use COL or RCOL to force a line break at a particular field, for example



·         By default, control fields are not printed on every detail line, only on the first detail line of the group, plus the first line after every page overflow.  Other fields are printed on every detail line. Have a look at Report from IN1R and Report from Program IN1R2 to see examples of these default rules applied. Note that Region and District are only printed on the first details lines of a control group, although they are both printed on the subtotal lines at the end of each control group.

·         Control break fields can be printed on every line with the addition of ALL, e.g. Report from IN1R2, with ALL shows the effect of changing the PRINT by adding ALL to Region and District, to

    PRINT (IN1.Region ALL, FR.Name,IN1.District ALL,IN1.Name, IN1.SalesThisMonth,

        IN1.SalesYTD SUM);

·         Or fields can be related to particular control break levels by adding BREAK(break-field), for example

    PRINT (IN1.Region BREAK(IN1.District), FR.Name BREAK(IN1.District), IN1.District BREAK,

                  IN1.Name, IN1.SalesThisMonth,IN1.SalesYTD SUM);

See Report from IN1R2, with BREAK to see the results of this

A Jazz program may have several PRINT statements, and PRINT statements may be written before and after the PROCESS loop.

Easytrieve Conversion – Current Development Status

Easytrieve conversion is a new feature of MANASYS Jazz, and it is still under active development, and of course we will be keen to work with you to resolve any issues that you have.  Here are some issues that we are aware of: -

Supported Databases

MANASYS Jazz currently supports PSAM (F, FB, V, VB, and U) files, VSAM files (KSDS and ESDS), and SQL (=DB2 LUW and DB2 ZOS).  It does not support DL1, IDMS, or other pre-relational databases. 

SQL:  Our Easytrieve programs did not include any SQL examples, so we expect to have to enhance our software when these are encountered.  This will be done for licensees at no cost.   Similarly, we have only validated SQL with DB2, but it should function identically with Oracle.  We look forward to working with a user to validate this, again, at no cost.

Development of support for DL1, IDMS, ADABAS, etc is a significant development, which we guesstimate to be about 3 months’ work per database, working with a user.  This will have to be funded by either sufficient license fees, or direct development funding. Initial design work for DL1 has been done, and DL1 support was a feature of MANASYS version 1 in 1980, and Codasyl support (IDMS) was a feature of MANASYS Version 2.

Data Types

Import from Easytrieve handles formats A, B, N, P,  and U.   U, meaning Unsigned Packed, is treated like P but with a comment.  


The Easytrieve programs that we were given used macros, but the macros were not supplied.   We developed macro handling following the rules from the Easytrieve Plus Reference Manual, but we’d like more testing of this feature.  Please report any issues, and we’ll fix them.

Note that macros need to be copied into the same folder as the Easytrieve program that uses them.

Let us Prove It – Ask us for a Quote

PAYRPT and PAYSRT are simple examples but Easytrieve programs of any size and complexity can be converted, with only occasional editing help, unless they use DL1, IDMS, or another database that MANASYS Jazz doesn’t support.  The COBOL that results is clear and efficient, as you can see from examples PAYSRT and PAYRPT.  It requires no special run-time support, or licenses.  

Let us prove it.  Send us an Easytrieve program and let us quote for its conversion.  We’ll need the program plus any macros that it uses.  If you accept our quote we’ll return COBOL that will compile cleanly, and should produce the same results as the Easytrieve program except for minor report-layout differences. 

We challenge anybody to demonstrate a quicker or more cost-effective way of converting Easytrieve to COBOL!

See our web page if you want more information about MANASYS Jazz and to see what else it can do.  Contact us if you have any questions, or connect with us on LinkedInDownload a free evaluation copy if you want to try out MANASYS Jazz. 


Lacking test data for PERSNL and other Easytrieve programs, the rules that MANASYS Jazz uses for print layout are illustrated with our own test files.

Record IN1

*# Last Updated by JazzUser at 14/05/2019 2:15:39 PM

COPY Types;


    Region DECIMAL(3),

    District DECIMAL(3),

    Name CHAR(40),

    SalesThisMonth MONEY(7,2),

    SalesYTD MONEY(7,2),

    BillingCycle LIKE Types.Month,

    DateCommenced DATE DPIC 'dd mmm yyyy')


Record FR

*# Last Updated by JazzUser at 7/11/2018 4:20:03 PM


    Region PIC '999' KEY RANGE (1:20),

    Name CHAR(30) VALUE('No Record found') HEADING 'Region Name',

    Fill CHAR(47))


Program IN1R

 *# Last Updated by JazzUser at 22/09/2018 1:06:55 p.m.




PROCESS In1 ORDER(IN1.Region BREAK, IN1.District BREAK, IN1.Name);

    PRINT (IN1.Region,IN1.District,IN1.Name, IN1.SalesThisMonth SUM,

        IN1.SalesYTD SUM,IN1.BillingCycle,IN1.DateCommenced);


Report from IN1R

First Page (incomplete)

Printed at 02 Feb 2021, 14:00:21                                     RepNbr1                                     Page   1
Region District *-----------------Name-----------------* *SalesThisMonth-* *----SalesYTD---* BillingCycle DateCommenced  
     1        1 REEDE, Phillip                                   $468.55         $4,685.50            Oct   28 Feb 2018  
     1        1 District Subtotal                                $468.55         $4,685.50                               
              2 PYM, Freda Mary                                $8,642.65         $8,642.65            Jan   28 Feb 2018  
                PYM, Samuel Arnott                             $2,304.87        $23,048.70            Oct   28 Feb 2018  
     1        2 District Subtotal                             $10,947.52        $31,691.35                               
              3 CAMPBELL, Dennis                               $5,662.44        $56,624.40            Oct   28 Feb 2018  
                CORLETT, Norton Hesse                          $9,197.76        $10,373.12            Dec   28 Feb 2018  
                ROBERTS, Adelaide                              $4,138.56        $37,247.04            Sep   28 Feb 2018  
                ROBERTS, Margaret Annie                        $8,138.51        $73,246.59            Sep   28 Feb 2018  
                WILLIAMSON, Catherine                          $5,554.20        $33,325.20            Jun   28 Feb 2018  
     1        3 District Subtotal                             $32,691.47       $210,816.35                               
              4 SARTEN, Leslie Robert                          $3,824.97        $38,249.70            Oct   28 Feb 2018  
                VOLZKE, Mary                                   $8,275.54        $49,653.24            Jun   28 Feb 2018  
                WELLARD, Alfred Champion                       $7,611.58        $22,834.74            Mar   28 Feb 2018  
     1        4 District Subtotal                             $19,712.09       $110,737.68                               
              5 BARNES, Caroline                               $1,121.76         $1,121.76            Jan   28 Feb 2018

Last Page

Printed at 02 Feb 2021, 14:00:21                                     RepNbr1                                     Page   9
Region District *-----------------Name-----------------* *SalesThisMonth-* *----SalesYTD---* BillingCycle DateCommenced  
    10        6 EVANS, Charlotte                               $5,925.71        $11,851.42            Feb   28 Feb 2018  
                JURY, Reginal Charles                          $9,163.09        $64,141.63            Jul   28 Feb 2018  
    10        6 District Subtotal                             $23,682.92       $127,557.77                               
              7 GLANVILLE, Ann                                 $6,157.62        $73,891.44            Dec   28 Feb 2018  
                GOULD, John                                    $3,496.42        $31,467.78            Sep   28 Feb 2018  
                WILLIAMS, Claude William                       $5,380.12        $21,520.48            Apr   28 Feb 2018  
                WILLIAMSON, Norman Herbert James                  $52.97           $423.76            Aug   28 Feb 2018  
    10        7 District Subtotal                             $15,087.13       $127,303.46                               
    10          Region Subtotal                              $100,533.67       $688,678.96                               
                Grand Total                                $1,550,347.73    $10,140,367.60                               
* * * END OF RepNbr1 * * *                                                                                                           

Program IN1R2

Basically the same as IN1R, but with the addition of a lookup file (FR) to get the Region Name.  To avoid line overflow BillingCycle and Date Commenced have been dropped.  There is no FR record for Region=7, so the WHERE clause has been added to demonstrate the automatic handling of Record-Not-Found.

*# Last Updated by JAZZUSR at 2/02/2021 2:45:26 PM



#388 E FR.Region and IN1.Region have different types


PROCESS In1 ORDER(IN1.Region BREAK, IN1.District BREAK, IN1.Name)

        WHERE (IN1.Region IN (6,7));

    GET FR WHERE FR.Region = IN1.Region;

    PRINT (IN1.Region BREAK(IN1.District), FR.Name BREAK(IN1.District), IN1.District BREAK,

        IN1.Name, IN1.SalesThisMonth,IN1.SalesYTD SUM);


Report from IN1R2

(Selected lines)

Printed at 24 Nov 2021, 09:06:26                                    RepNbr1                                     Page   1            


Region *--------Region Name---------* District *-----------------Name-----------------* SalesThisMonth *----SalesYTD---*            


     6 France                                1 BENJAMIN, John                              $6,492.73        $19,478.19              

                                               BENSON, Rosalind Margaret                   $9,848.46        $19,696.92              

                                               MEIER, Eileen Mary                            $835.57         $5,013.42               

                                               OLIVER, Willliam                              $347.07         $1,735.35              

                                               TREBILCOCK, Fanny                           $3,205.97         $6,411.94              

                                               WELLARD, Walter William                     $4,381.28        $39,431.52              

     6                                       1 District Subtotal                                            $91,767.34              

     6 France                                7 BENJAMIN, Percival                            $130.98         $1,047.84              

                                               GLUVIAS, Thomas                                $78.06           $936.72              

                                               WILLIAMSON, Amos Edward John                $6,822.64        $27,290.56              

     6                                       7 District Subtotal                                            $29,275.12              

                                               Region Subtotal                                           $1,293,605.80              


     7 No Record found                       1 DOUGLAS, Elizabeth Ann                      $5,827.94        $58,279.40              

                                               HEPBURN, Huia May                           $8,373.08        $66,984.64              

                                               WELLARD, Olive Dorothy Sparling             $8,891.75        $26,675.25              

     7                                       1 District Subtotal                                           $151,939.29              


     7 No Record found                       6 BARNES, Arthur Cyril                        $7,833.61        $86,169.71              

                                               JACOB, Lionel John                          $4,585.23        $18,340.92              

                                               MORTON, Margaret                            $7,220.78        $28,883.12              

                                               VARCOE, Robert                              $4,068.45        $40,684.50              

                                               WILLIAMSON, Horace                          $6,868.68        $68,686.80              

                                               WILLIAMSON, John Ernest                     $1,562.54        $10,937.78               

     7                                       6 District Subtotal                                           $253,702.83              

                                               Region Subtotal                                           $1,375,683.73              

                                               Grand Total                                               $2,669,289.53              

Report from IN1R2, with ALL

With the PRINT statement changed to

    PRINT (IN1.Region ALL, FR.Name,IN1.District ALL,IN1.Name, IN1.SalesThisMonth,

        IN1.SalesYTD SUM);

the report above changes to

Printed at 02 Feb 2021, 14:24:49                                    RepNbr1                                     Page   1
Region *--------Region Name---------* District *-----------------Name-----------------* SalesThisMonth *----SalesYTD---*
     1 New Zealand                           1 REEDE, Phillip                                $468.55         $4,685.50  
     1 District Subtotal                     1                                                               $4,685.50  
     1 New Zealand                           2 PYM, Freda Mary                             $8,642.65         $8,642.65  
     1 New Zealand                           2 PYM, Samuel Arnott                          $2,304.87        $23,048.70  
     1 District Subtotal                     2                                                              $31,691.35  
     1 New Zealand                           3 CAMPBELL, Dennis                            $5,662.44        $56,624.40  
     1 New Zealand                           3 CORLETT, Norton Hesse                       $9,197.76        $10,373.12  
     1 New Zealand                           3 ROBERTS, Adelaide                           $4,138.56        $37,247.04  
     1 New Zealand                           3 ROBERTS, Margaret Annie                     $8,138.51        $73,246.59  
     1 New Zealand                           3 WILLIAMSON, Catherine                       $5,554.20        $33,325.20  
     1 District Subtotal                     3                                                             $210,816.35  

Report from IN1R2, with BREAK

The PRINT statement has been changed to

    PRINT (IN1.Region BREAK(IN1.District), FR.Name BREAK(IN1.District), IN1.District BREAK,

        IN1.Name, IN1.SalesThisMonth,IN1.SalesYTD SUM);

This will cause IN1.Region, FR.Name, and IN1.District to be printed on every change of IN1.District or IN1.Region.  Results would have been the same if we’d written IN1.District, or IN1.District BREAK(IN1.District).

Printed at 02 Feb 2021, 14:49:17                                    RepNbr1                                     Page   1
Region *--------Region Name---------* District *-----------------Name-----------------* SalesThisMonth *----SalesYTD---*
     1 New Zealand                           1 REEDE, Phillip                                $468.55         $4,685.50  
     1                                       1 District Subtotal                                             $4,685.50  
     1 New Zealand                           2 PYM, Freda Mary                             $8,642.65         $8,642.65  
                                               PYM, Samuel Arnott                          $2,304.87        $23,048.70  
     1                                       2 District Subtotal                                            $31,691.35  
     1 New Zealand                           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  
     1                                       3 District Subtotal                                           $210,816.35 

Program IN1R2 as COBOL

You don’t need to change the COBOL that MANASYS Jazz produces.  When MANASYS is configured to work with z/OS a job is submitted to compile, link, and run the program, so you don’t even need to see it.  When configured for Micro Focus it is written into the your COBOL project’s .cbl folder where a few clicks achieves the same result.

000010*    C:\tutorials\TSTSQL\cbl\IN1R2.CBL                           

000020 IDENTIFICATION DIVISION.                                         IN1R2

000030 PROGRAM-ID.    IN1R2.                                            IN1R2

000040 AUTHOR.        JAZZUSR (Using Jazz from Visual Studio)           IN1R2

000050 DATE-WRITTEN.  2/02/2021 2:35:35 PM                              IN1R2

000060 ENVIRONMENT DIVISION.                                            IN1R2

000070*# Last Updated by JAZZUSR at 2/02/2021 2:35:35 PM                IN1R2

000080*PROGRAM IN1R2 BATCH;                                             IN1R2

000090*COPY IN1;                                                        IN1R2

000100*COPY FR;                                                         IN1R2

000110*COPY JZSMth;                                                     IN1R2

000120*PROCESS In1 ORDER(IN1.Region BREAK, IN1.District BREAK,          IN1R2

000130*    IN1.Name);                                                   IN1R2

000140*    GET FR WHERE FR.Region = IN1.Region;                         IN1R2

000150*    PRINT (IN1.Region BREAK(IN1.District), FR.Name               IN1R2

000160*        BREAK(IN1.District), IN1.District BREAK,IN1.Name,        IN1R2

000170*        IN1.SalesThisMonth,                                      IN1R2

000180*        IN1.SalesYTD SUM);                                       IN1R2

000190*END PROCESS In1;                                                 IN1R2


000210**                                                              **IN1R2

000220**               INPUT-OUTPUT Section/File-Control              **IN1R2

000230**                                                              **IN1R2


000250 INPUT-OUTPUT Section.                                            IN1R2

000260 FILE-CONTROL.                                                    IN1R2

000270     SELECT IN1  ASSIGN TO IN1                                    IN1R2

000280                 FILE STATUS IS IN1-STATUS.                       IN1R2

000290     SELECT SORTWORK ASSIGN TO SORTWK01.                          IN1R2

000300     SELECT FR  ASSIGN TO FR                                      IN1R2


000320                RECORD KEY IS Region OF JZ-FR                     IN1R2

000330                FILE STATUS IS FR-STATUS.                         IN1R2

000340     SELECT RepNbr1  ASSIGN TO RepNbr1                            IN1R2

000350                     FILE STATUS IS RepNbr1-STATUS.               IN1R2


000370**                                                              **IN1R2

000380**                         Data Division                        **IN1R2

000390**                                                              **IN1R2


000410 DATA DIVISION.                                                   IN1R2


000430**                                                              **IN1R2

000440**                         File Section.                        **IN1R2

000450**                                                              **IN1R2


000470 File SECTION.                                                    IN1R2


000490**                                                              **IN1R2

000500**                              IN1                             **IN1R2

000510**                                                              **IN1R2


000530 FD  IN1                                                          IN1R2

000540     RECORDING MODE V.                                            IN1R2

000550*                                                                 IN1R2

000560 01  JZ-IN1.                                                      IN1R2

000570      03 Region PIC S9(3) COMP-3.                                 IN1R2

000580      03 District PIC S9(3) COMP-3.                               IN1R2

000590      03 JZ-Name PIC X(40).                                       IN1R2

000600      03 SalesThisMonth PIC S9(5)V9(2) COMP-3.                    IN1R2

000610      03 SalesYTD PIC S9(5)V9(2) COMP-3.                          IN1R2

000620      03 BillingCycle PIC X.                                      IN1R2

000630      03 DateCommenced PIC S9(9) COMP.                            IN1R2


000650**                                                              **IN1R2

000660**                           SORTWORK                           **IN1R2

000670**                                                              **IN1R2


000690*                                                                 IN1R2

000700 SD  SORTWORK.                                                    IN1R2

000710*                                                                 IN1R2

000720 01  JZ-SORTWORK.                                                 IN1R2

000730      03 Region PIC S9(3) COMP-3.                                 IN1R2

000740      03 District PIC S9(3) COMP-3.                               IN1R2

000750      03 JZ-Name PIC X(40).                                       IN1R2

000760      03 SalesThisMonth PIC S9(5)V9(2) COMP-3.                    IN1R2

000770      03 SalesYTD PIC S9(5)V9(2) COMP-3.                          IN1R2


000790**                                                              **IN1R2

000800**                               FR                             **IN1R2

000810**                                                              **IN1R2


000830 FD  FR                                                           IN1R2

000840     RECORD IS VARYING IN SIZE.                                   IN1R2

000850*                                                                 IN1R2

000860 01  JZ-FR.                                                       IN1R2

000870      03 Region PIC 999.                                          IN1R2

000880      03 JZ-Name PIC X(30).                                       IN1R2

000890      03 Fill PIC X(47).                                          IN1R2


000910**                                                              **IN1R2

000920**                            RepNbr1                           **IN1R2

000930**                                                              **IN1R2


000950 FD  RepNbr1                                                      IN1R2

000960     RECORDING MODE F.                                            IN1R2

000970*                                                                 IN1R2

000980 01  JZ-RepNbr1                   PIC X(132).                     IN1R2


001000**                                                              **IN1R2

001010**         Working Storage Section: General Program Data        **IN1R2

001020**                                                              **IN1R2


001040*                                                                 IN1R2

001050 WORKING-STORAGE SECTION.                                         IN1R2


001070**                                                              **IN1R2

001080**                  General Program Information                 **IN1R2

001090**                                                              **IN1R2


001110*                                                                 IN1R2

001120*    Status Flags and control data                                IN1R2

001130 01  JZ-FileControl.                                              IN1R2

001140     03  SORTWORK-ENDFILE PIC X VALUE 'N'.                        IN1R2

001150     03  IN1-ENDFILE PIC X VALUE 'N'.                             IN1R2

001160     03  IN1-STATUS PIC XX VALUE '00'.                            IN1R2

001170     03  FR-ENDFILE PIC X VALUE 'N'.                              IN1R2

001180     03  FR-STATUS PIC XX VALUE '00'.                             IN1R2

001190     03  FR-FOUND-FLAG PIC X VALUE 'Y'.                           IN1R2

001200         88  FR-FOUND VALUE 'Y'.                                  IN1R2

001210     03  FR-UPDATEPENDING-FLAG PIC X VALUE 'N'.                   IN1R2

001220         88  FR-UPDATEPENDING VALUE 'Y'.                          IN1R2

001230     03  FR-Get4Update-FLAG PIC X VALUE 'N'.                      IN1R2

001240         88  FR-Get4Update VALUE 'Y'.                             IN1R2

001250     03  FR-HighKey PIC X(3) VALUE HIGH-VALUES.                   IN1R2

001260     03  RepNbr1-STATUS PIC XX VALUE '00'.                        IN1R2

001270     03  RepNbr1-PageNbr PIC 99999 COMP-3 VALUE 0.                IN1R2

001280     03  RepNbr1-LineCount PIC 9999 COMP VALUE 1000.              IN1R2

001290     03  RepNbr1-Space PIC 9999 COMP VALUE 1.                     IN1R2

001300*                                                                 IN1R2

001310 01  JZ-TODAY.                                                    IN1R2

001320     05  JZ-DATETIMEGMT.                                          IN1R2

001330         10  JZ-DATETIME        PIC  9(16).                       IN1R2

001340         10  JZ-GMTDIFF         PIC  S9(4).                       IN1R2

001350     05  JZ-DATETIME-1          REDEFINES JZ-DATETIMEGMT.         IN1R2

001360         10  JZ-DATE            PIC  9(8).                        IN1R2

001370         10  JZ-TIME            PIC  9(8).                        IN1R2

001380         10  FILLER             PIC  S9(4).                       IN1R2

001390     05  JZ-DATETIME-2          REDEFINES JZ-DATETIMEGMT.         IN1R2

001400         10  JZ-YEAR            PIC  9(4).                        IN1R2

001410         10  JZ-MONTH           PIC  9(2).                        IN1R2

001420         10  JZ-DAY             PIC  9(2).                        IN1R2

001430         10  JZ-HOUR            PIC  9(2).                        IN1R2

001440         10  JZ-MINUTE          PIC  9(2).                        IN1R2

001450         10  JZ-SECOND          PIC  9(2).                        IN1R2

001460         10  JZ-MS              PIC  9(2).                        IN1R2

001470         10  FILLER             PIC  S9(4).                       IN1R2

001480     05  JZ-DATETIME-3          REDEFINES JZ-DATETIMEGMT.         IN1R2

001490         10  FILLER             PIC  9(12).                       IN1R2

001500         10  JZ-SECONDS         PIC  99V99.                       IN1R2

001510         10  FILLER             PIC  S9(4).                       IN1R2

001520*    Report Time Stamp                                            IN1R2

001530*                                                                 IN1R2

001540 01  JZ-ReportTS.                                                 IN1R2

001550         10  JZ-DAY             PIC  9(2).                        IN1R2

001560         10  FILLER             PIC  X VALUE SPACE.               IN1R2

001570         10  JZ-MONTH-NAME      PIC  X(3).                        IN1R2

001580         10  FILLER             PIC  X VALUE SPACE.               IN1R2

001590         10  JZ-YEAR            PIC  9(4).                        IN1R2

001600         10  JZ-COMMA           PIC  XX VALUE ', '.               IN1R2

001610         10  JZ-HOUR            PIC  9(2).                        IN1R2

001620         10  JZ-SEPCHAR1        PIC  X VALUE ':'.                 IN1R2

001630         10  JZ-MINUTE          PIC  9(2).                        IN1R2

001640         10  JZ-SEPCHAR2        PIC  X VALUE ':'.                 IN1R2

001650         10  JZ-SECOND          PIC  9(2).                        IN1R2

001660*                                                                 IN1R2

001670 01  JZ-ReportTimeStamp REDEFINES JZ-ReportTS PIC X(21).          IN1R2

001680*                                                                 IN1R2

001690 LOCAL-STORAGE SECTION.                                           IN1R2


001710**                                                              **IN1R2

001720**                      RepNbr1 Print Lines                     **IN1R2

001730**                                                              **IN1R2


001750*                                                                 IN1R2

001760*    Save line while headings are printed                         IN1R2

001770 01  JZ-RepNbr1-Save          PIC X(132).                         IN1R2

001780*                                                                 IN1R2

001790*    Page Header and footer                                       IN1R2

001800 01  JZ-RepNbr1-Heading.                                          IN1R2

001810     03  Filler               PIC X(11) Value 'Printed at '.      IN1R2

001820     03  DateTime             PIC X(21).                          IN1R2

001830     03  Filler               PIC X(36) VALUE SPACES.             IN1R2

001840     03  Filler  PIC X(7) VALUE 'RepNbr1'.                        IN1R2

001850     03  Filler               PIC X(37) VALUE SPACES.             IN1R2

001860     03  Filler               PIC XXXX VALUE 'Page'.              IN1R2

001870     03  PageNbr              PIC ZZZ9.                           IN1R2

001880*                                                                 IN1R2

001890*    Column Headings                                              IN1R2

001900 01  RepNbr1-L1-H.                                                IN1R2

001910     03 FILLER  PIC X(132) VALUE 'Region *--------Region Name-----IN1R2

001920-        '----* District *-----------------Name-----------------* IN1R2

001930-        'SalesThisMonth *----SalesYTD---*            '.          IN1R2

001940*                                                                 IN1R2

001950*    Data line                                                    IN1R2

001960 01  RepNbr1-L1-D.                                                IN1R2

001970     03  FILLER               PIC X(2) VALUE SPACE.               IN1R2

001980     03  Region               PIC ---9.                           IN1R2

001990     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002000     03  JZ-Name              PIC X(30).                          IN1R2

002010     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002020     03  FILLER               PIC X(4) VALUE SPACE.               IN1R2

002030     03  District             PIC ---9.                           IN1R2

002040     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002050     03  JZ-Name1             PIC X(40).                          IN1R2

002060     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002070     03  FILLER               PIC X(2) VALUE SPACE.               IN1R2

002080     03  SalesThisMonth       PIC $$$,$$9.99CR.                   IN1R2

002090     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002100     03  SalesYTD             PIC $$$$,$$$,$$9.99CR.              IN1R2

002110     03  FILLER               PIC X(11) VALUE SPACES.             IN1R2

002120*                                                                 IN1R2

002130*    Print line for Totals                                        IN1R2

002140 01  RepNbr1-L1-T.                                                IN1R2

002150     03  FILLER               PIC X(2) VALUE SPACE.               IN1R2

002160     03  Region               PIC ---9.                           IN1R2

002170     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002180     03  JZ-Name              PIC X(30).                          IN1R2

002190     03  FILLER               PIC X(1) VALUE SPACES.              IN1R2

002200     03  FILLER               PIC X(4) VALUE SPACE.               IN1R2

002210     03  District             PIC ---9.                           IN1R2

002220     03  Description          PIC X(57) VALUE SPACES.             IN1R2

002230     03  SalesYTD             PIC $$$$,$$$,$$9.99CR.              IN1R2


002250**                                                              **IN1R2

002260**                    JZ - Jazz Sundry fields                   **IN1R2

002270**                                                              **IN1R2


002290*                                                                 IN1R2

002300 01  JZ.                                                          IN1R2

002310      03 JZ-AL PIC S9(4) COMP VALUE ZERO.                         IN1R2

002320      03 JZ-ALIM PIC S9(4) COMP VALUE ZERO.                       IN1R2

002330      03 JZ-NOFML PIC S9(4) COMP VALUE ZERO.                      IN1R2

002340      03 JZ-INDEX PIC S9(4) COMP VALUE ZERO.                      IN1R2

002350      03 JZ-INDEX2 PIC S9(4) COMP VALUE ZERO.                     IN1R2

002360      03 JZ-IXMth PIC S9(4) COMP VALUE ZERO.                      IN1R2

002370      03 IX1 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002380      03 IX2 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002390      03 IX3 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002400      03 IX4 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002410      03 IX5 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002420      03 IX6 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002430      03 IX7 PIC S9(4) COMP VALUE ZERO.                           IN1R2

002440      03 JZ-ST PIC S9(4) COMP VALUE ZERO.                         IN1R2

002450      03 JZ-SL PIC S9(4) COMP VALUE ZERO.                         IN1R2

002460      03 JZ-BLANK PIC XXXX VALUE SPACES.                          IN1R2

002470      03 JZ-CHAR80 PIC X(80) VALUE SPACES.                        IN1R2

002480      03 JZ-FNAME PIC X(30) VALUE SPACES.                         IN1R2

002490      03 JZ-KL PIC S9(4) COMP VALUE ZERO.                         IN1R2

002500      03 JZ-MLTH PIC S9(4) COMP VALUE ZERO.                       IN1R2

002510      03 JZ-INT PIC S9(9) COMP VALUE ZERO.                        IN1R2

002520      03 JZ-TRUEFALSE PIC XXXXX VALUE SPACES.                     IN1R2

002530      03 JZ-TinyNbr PIC S9(9) COMP VALUE ZERO.                    IN1R2

002540      03 JZ-TinyGr REDEFINES JZ-TinyNbr.                          IN1R2

002550        05 FILLER PIC XXX.                                        IN1R2

002560        05 JZ-Tiny PIC X.                                         IN1R2

002570      03 JZ-Error PIC X VALUE 'N'.                                IN1R2

002580      03 JZ-NBR1 PIC 9999 VALUE ZERO.                             IN1R2

002590      03 JZ-NBR1X REDEFINES JZ-NBR1 PIC XXXX.                     IN1R2

002600      03 JZ-NBR2 PIC 9999 VALUE ZERO.                             IN1R2

002610      03 JZ-NBR2X REDEFINES JZ-NBR2 PIC XXXX.                     IN1R2

002620      03 JZ-SUBVAL PIC ZZZZZ9 VALUE ZERO.                         IN1R2

002630      03 JZ-SUBVALR REDEFINES JZ-SUBVAL PIC X(6).                 IN1R2

002640      03 JZ-SUBDIGIT PIC S9(4) COMP VALUE ZERO.                   IN1R2


002660         SPACES.                                                  IN1R2

002670      03 JZ-INDEXPR PIC X(6) VALUE SPACES.                        IN1R2

002680      03 FR-Region PIC 999 VALUE ZERO.                            IN1R2


002700**                                                              **IN1R2

002710**                             JZSMth                           **IN1R2

002720**                                                              **IN1R2


002740*                                                                 IN1R2

002750 01  JZSMth.                                                      IN1R2

002760      03 SMth PIC S9(4) COMP VALUE ZERO.                          IN1R2


002780**                                                              **IN1R2

002790**                             Break                            **IN1R2

002800**                                                              **IN1R2


002820*                                                                 IN1R2

002830 01  Break.                                                       IN1R2

002840      03 Level PIC S9(4) COMP VALUE ZERO.                         IN1R2

002850      03 Sub PIC S9(4) COMP VALUE ZERO.                           IN1R2

002860      03 Rec-Count PIC S9(4) COMP VALUE ZERO.                     IN1R2

002870      03 Region PIC S9(3) COMP-3 VALUE ZERO.                      IN1R2

002880      03 District PIC S9(3) COMP-3 VALUE ZERO.                    IN1R2

002890      03 Region1 PIC S9(3) COMP-3 VALUE ZERO.                     IN1R2

002900      03 JZ-Name PIC X(30) VALUE 'No Record found'.               IN1R2


002920**                                                              **IN1R2

002930**                          RepNbr1-CBD                         **IN1R2

002940**                                                              **IN1R2


002960*                                                                 IN1R2

002970 01  RepNbr1-CBD.                                                 IN1R2

002980      03 Description1.                                            IN1R2

002990        05 District PIC X(18) VALUE ' District Subtotal'.         IN1R2

003000        05 Region PIC X(18) VALUE ' Region Subtotal'.             IN1R2

003010        05 JZGrandTotal PIC X(18) VALUE ' Grand Total'.           IN1R2

003020      03 Description2 REDEFINES Description1 OCCURS 3 INDEXED BY  IN1R2

003030         JZIX2.                                                   IN1R2

003040        05 Descriptions PIC X(18).                                IN1R2


003060**                                                              **IN1R2

003070**                             Sums                             **IN1R2

003080**                                                              **IN1R2


003100*                                                                 IN1R2

003110 01  Sums.                                                        IN1R2

003120      03 SalesYTD OCCURS 4 INDEXED BY JZIX3  PIC S9(9)V9(2) COMP-3IN1R2

003130          VALUE ZERO.                                             IN1R2


003150**                                                              **IN1R2

003160**                          Code Tables                         **IN1R2

003170**                                                              **IN1R2


003190*                                                                 IN1R2

003200*    JZSMth.SMth                                                  IN1R2

003210 01  JZCodes-JZSMth-SMth.                                         IN1R2

003220     03 JZValues.                                                 IN1R2

003230         05 FILLER PIC X(3) VALUE 'Jan'.                          IN1R2

003240         05 FILLER PIC X(3) VALUE 'Feb'.                          IN1R2

003250         05 FILLER PIC X(3) VALUE 'Mar'.                          IN1R2

003260         05 FILLER PIC X(3) VALUE 'Apr'.                          IN1R2

003270         05 FILLER PIC X(3) VALUE 'May'.                          IN1R2

003280         05 FILLER PIC X(3) VALUE 'Jun'.                          IN1R2

003290         05 FILLER PIC X(3) VALUE 'Jul'.                          IN1R2

003300         05 FILLER PIC X(3) VALUE 'Aug'.                          IN1R2

003310         05 FILLER PIC X(3) VALUE 'Sep'.                          IN1R2

003320         05 FILLER PIC X(3) VALUE 'Oct'.                          IN1R2

003330         05 FILLER PIC X(3) VALUE 'Nov'.                          IN1R2

003340         05 FILLER PIC X(3) VALUE 'Dec'.                          IN1R2

003350     03  JZTABLE REDEFINES JZValues.                              IN1R2

003360         05  ITEM-VALUES OCCURS 12 INDEXED BY JZIX-JZSMth-SMth.   IN1R2

003370             07  CODE-VALUE PIC X(3).                             IN1R2

003380     03  FILLER.                                                  IN1R2

003390         05  SEARCH-FOR PIC S9(4) COMP.                           IN1R2

003400         05  FOUND-VALUE PIC X(3) VALUE '***'.                    IN1R2


003420**                                                              **IN1R2

003430**                      Procedure Division.                     **IN1R2

003440**                                                              **IN1R2


003460*                                                                 IN1R2

003470 PROCEDURE DIVISION.                                              IN1R2


003490     PERFORM JZDT01.                                              IN1R2

003500     OPEN INPUT IN1.                                              IN1R2

003510     IF IN1-Status IS NOT = '00' AND IN1-Status IS NOT = '41' AND IN1R2

003520         IN1-Status IS NOT = '97'                                 IN1R2

003530         DISPLAY 'PROGRAM TERMINATED. Invalid Status Code on OPEN IN1R2

003540-            'IN1. CODE=' IN1-Status                              IN1R2

003550         GOBACK                                                   IN1R2

003560     END-IF .                                                     IN1R2

003570     Move ZERO TO Region OF JZ-IN1.                               IN1R2

003580     Move ZERO TO District OF JZ-IN1.                             IN1R2

003590     Move SPACES TO JZ-Name OF JZ-IN1.                            IN1R2

003600     Move ZERO TO SalesThisMonth OF JZ-IN1.                       IN1R2

003610     Move ZERO TO SalesYTD OF JZ-IN1.                             IN1R2

003620     Move LOW-VALUE TO BillingCycle OF JZ-IN1.                    IN1R2

003630     Move ZERO TO DateCommenced OF JZ-IN1.                        IN1R2

003640     OPEN INPUT FR.                                               IN1R2

003650     IF FR-Status IS NOT = '00' AND FR-Status IS NOT = '41' AND   IN1R2

003660         FR-Status IS NOT = '97'                                  IN1R2

003670         DISPLAY 'PROGRAM TERMINATED. Invalid Status Code on OPEN IN1R2

003680-            'FR. CODE=' FR-Status                                IN1R2

003690         GOBACK                                                   IN1R2

003700     END-IF .                                                     IN1R2

003710     Move ZERO TO Region OF JZ-FR.                                IN1R2

003720     Move 'No Record found' TO JZ-Name OF JZ-FR.                  IN1R2

003730     Move SPACES TO Fill OF JZ-FR.                                IN1R2

003740     MOVE JZ-ReportTimeStamp TO DateTime OF JZ-RepNbr1-Heading.   IN1R2

003750     OPEN OUTPUT RepNbr1.                                         IN1R2

003760     IF RepNbr1-Status IS NOT = '00' AND RepNbr1-Status IS NOT = 'IN1R2

003770-        '41' AND RepNbr1-Status IS NOT = '97'                    IN1R2

003780         DISPLAY 'PROGRAM TERMINATED. Invalid Status Code on OPEN IN1R2

003790-            'RepNbr1. CODE=' RepNbr1-Status                      IN1R2

003800         GOBACK                                                   IN1R2

003810     END-IF .                                                     IN1R2

003820*    Main Program Logic                                           IN1R2

003830     PERFORM JZ-Main-Program-Logic.                               IN1R2

003840*                                                                 IN1R2

003850 JZ-Normal-Exit.                                                  IN1R2

003860     PERFORM RepNbr1-L1-SUBTOTAL VARYING Sub OF Break FROM 1 BY 1 IN1R2

003870         UNTIL Sub OF Break > 3.                                  IN1R2

003880     Move '* * * END OF RepNbr1 * * *' TO JZ-RepNbr1.             IN1R2

003890     WRITE JZ-RepNbr1.                                            IN1R2

003900*    Logical end-of-program                                       IN1R2

003910     GOBACK.                                                      IN1R2


003930**                                                              **IN1R2

003940**                       Main Program Logic                     **IN1R2

003950**                                                              **IN1R2


003970*                                                                 IN1R2

003980 JZ-Main-Program-Logic.                                           IN1R2

003990*    PROCESS In1 ORDER(IN1.Region BREAK, IN1.District BREAK,      IN1R2

004000*                                                      IN1.Name); IN1R2

004010     SORT SORTWORK                                                IN1R2

004020         ON ASCENDING KEY Region OF JZ-SORTWORK                   IN1R2

004030         ON ASCENDING KEY District OF JZ-SORTWORK                 IN1R2

004040         ON ASCENDING KEY JZ-Name OF JZ-SORTWORK                  IN1R2

004050         INPUT PROCEDURE IS JZ-19-PROCESSGroup-INPUT              IN1R2

004060         OUTPUT PROCEDURE IS JZ-19-PROCESSGroup-OUTPUT.           IN1R2

004070*                                                                 IN1R2

004080 JZ-19-PROCESSGroup-INPUT.                                        IN1R2


004100*                                                                 IN1R2

004110 JZ-19-PROCESSGroup-INPUT1.                                       IN1R2


004130     IF IN1-STATUS IS NOT = '00' AND IN1-STATUS IS NOT = '10'     IN1R2


004150-            'IN1.  Code=' IN1-STATUS                             IN1R2

004160         MOVE 'Y' TO IN1-ENDFILE                                  IN1R2

004170     END-IF.                                                      IN1R2

004180     IF IN1-ENDFILE = 'N'                                         IN1R2

004190*        Move referenced fields to Sortwork                       IN1R2

004200         Move Region OF JZ-IN1 TO Region OF JZ-SORTWORK           IN1R2

004210         Move District OF JZ-IN1 TO District OF JZ-SORTWORK       IN1R2

004220         Move JZ-Name OF JZ-IN1 TO JZ-Name OF JZ-SORTWORK         IN1R2

004230         Move SalesThisMonth OF JZ-IN1 TO SalesThisMonth OF       IN1R2

004240             JZ-SORTWORK                                          IN1R2

004250         Move SalesYTD OF JZ-IN1 TO SalesYTD OF JZ-SORTWORK       IN1R2

004260         RELEASE JZ-SORTWORK                                      IN1R2

004270     END-IF.                                                      IN1R2

004280*                                                                 IN1R2

004290 JZ-19-PROCESSGroup-OUTPUT.                                       IN1R2


004310-        'Y'.                                                     IN1R2

004320*                                                                 IN1R2

004330 JZ-19-PROCESSGroup-OUTPUT1.                                      IN1R2


004350         END-RETURN.                                              IN1R2

004360     IF SORTWORK-ENDFILE = 'N'                                    IN1R2

004370*        Move referenced fields back from Sortwork                IN1R2

004380         Move Region OF JZ-SORTWORK TO Region OF JZ-IN1           IN1R2

004390         Move District OF JZ-SORTWORK TO District OF JZ-IN1       IN1R2

004400         Move JZ-Name OF JZ-SORTWORK TO JZ-Name OF JZ-IN1         IN1R2

004410         Move SalesThisMonth OF JZ-SORTWORK TO SalesThisMonth OF  IN1R2

004420             JZ-IN1                                               IN1R2

004430         Move SalesYTD OF JZ-SORTWORK TO SalesYTD OF JZ-IN1       IN1R2

004440*        GET FR WHERE FR.Region = IN1.Region;                     IN1R2

004450         PERFORM JZ-20-GET                                        IN1R2

004460     END-IF.                                                      IN1R2

004470*                                                                 IN1R2

004480 JZ-20-GET.                                                       IN1R2

004490*    GET FR WHERE FR.Region = IN1.Region;                         IN1R2

004500     MOVE 'N' TO FR-Get4Update-FLAG.                              IN1R2

004510     MOVE Region OF JZ-IN1 TO Region OF JZ-FR.                    IN1R2

004520     MOVE 'Y' TO FR-Found-Flag.                                   IN1R2

004530     READ FR KEY Region OF JZ-FR INVALID KEY MOVE 'N' TO          IN1R2

004540         FR-Found-Flag END-READ.                                  IN1R2

004550     IF FR-Found-Flag = 'N'                                       IN1R2

004560         PERFORM FR-Initialize-20                                 IN1R2

004570     END-IF.                                                      IN1R2

004580*    PRINT (IN1.Region BREAK(IN1.District), FR.Name               IN1R2

004590*    BREAK(IN1.District), IN1.District BREAK,IN1.Name,            IN1R2

004600*                                              IN1.SalesThisMonth,IN1R2

004610*    IN1.SalesYTD SUM);                                           IN1R2

004620     PERFORM JZ-21-Print.                                         IN1R2

004630*    END PROCESS In1;                                             IN1R2

004640     CONTINUE.                                                    IN1R2

004650*                                                                 IN1R2

004660 JZ-21-Print.                                                     IN1R2

004670*    PRINT (IN1.Region BREAK(IN1.District), FR.Name               IN1R2

004680*    BREAK(IN1.District), IN1.District BREAK,IN1.Name,            IN1R2

004690*                                              IN1.SalesThisMonth,IN1R2

004700*    IN1.SalesYTD SUM);                                           IN1R2

004710*    Control break Processing                                     IN1R2

004720     PERFORM RepNbr1-CBreak.                                      IN1R2

004730*    Print Detail Line                                            IN1R2

004740     IF Level OF Break >= 1 OR RepNbr1-LineCount < 1 OR           IN1R2

004750         RepNbr1-LineCount >= 54                                  IN1R2

004760         MOVE Region OF JZ-IN1 TO Region OF RepNbr1-L1-D          IN1R2

004770     ELSE                                                         IN1R2

004780         MOVE SPACES TO RepNbr1-L1-D(1:6)                         IN1R2

004790     END-IF.                                                      IN1R2

004800     IF Level OF Break >= 1 OR RepNbr1-LineCount < 1 OR           IN1R2

004810         RepNbr1-LineCount >= 54                                  IN1R2

004820         MOVE JZ-Name OF JZ-FR TO JZ-Name OF RepNbr1-L1-D         IN1R2

004830     ELSE                                                         IN1R2

004840         MOVE SPACES TO RepNbr1-L1-D(8:30)                        IN1R2

004850     END-IF.                                                      IN1R2

004860     IF Level OF Break >= 1 OR RepNbr1-LineCount < 1 OR           IN1R2

004870         RepNbr1-LineCount >= 54                                  IN1R2

004880         MOVE District OF JZ-IN1 TO District OF RepNbr1-L1-D      IN1R2

004890     ELSE                                                         IN1R2

004900         MOVE SPACES TO RepNbr1-L1-D(39:8)                        IN1R2

004910     END-IF.                                                      IN1R2

004920     MOVE JZ-Name OF JZ-IN1 TO JZ-Name1 OF RepNbr1-L1-D.          IN1R2

004930     MOVE SalesThisMonth OF JZ-IN1 TO SalesThisMonth OF           IN1R2

004940         RepNbr1-L1-D.                                            IN1R2

004950     MOVE SalesYTD OF JZ-IN1 TO SalesYTD OF RepNbr1-L1-D.         IN1R2

004960     ADD  SalesYTD OF JZ-IN1 TO SalesYTD OF Sums(1).              IN1R2

004970     MOVE RepNbr1-L1-D TO JZ-RepNbr1.                             IN1R2

004980     PERFORM RepNbr1-Print.                                       IN1R2


005000**                                                              **IN1R2

005010**                   Code Conversion Routines                   **IN1R2

005020**                                                              **IN1R2


005040*                                                                 IN1R2

005050*    Convert JZSMth-SMth code to value                            IN1R2

005060 JZCvt-JZSMth-SMth.                                               IN1R2

005070*    Input: SEARCH-FOR OF JZCodes-JZSMth-SMth                     IN1R2

005080*    Output: FOUND-VALUE OF JZCodes-JZSMth-SMth                   IN1R2

005090*        If Invalid, FOUND-VALUE will be set to '****',           IN1R2

005100*             field JZ-CHAR80 will contain an error message       IN1R2

005110     SET JZIX-JZSMth-SMth TO SEARCH-FOR OF JZCodes-JZSMth-SMth.   IN1R2

005120     IF JZIX-JZSMth-SMth < 1 OR JZIX-JZSMth-SMth > 12             IN1R2

005130         MOVE 'Outside Code Range' TO JZ-CHAR80                   IN1R2

005140         MOVE '***' TO FOUND-VALUE OF JZCodes-JZSMth-SMth         IN1R2

005150     ELSE                                                         IN1R2

005160         MOVE CODE-Value OF JZCodes-JZSMth-SMth(JZIX-JZSMth-SMth) IN1R2

005170             TO FOUND-VALUE OF JZCodes-JZSMth-SMth                IN1R2

005180     END-IF.                                                      IN1R2


005200**                                                              **IN1R2

005210**                         Print Routine                        **IN1R2

005220**                                                              **IN1R2


005240*                                                                 IN1R2

005250 RepNbr1-PRINT.                                                   IN1R2

005260     IF RepNbr1-LineCount >= 54                                   IN1R2

005270         MOVE JZ-RepNbr1 TO JZ-RepNbr1-Save                       IN1R2

005280         IF RepNbr1-PageNbr > ZERO                                IN1R2

005290             Write JZ-RepNbr1 FROM JZ-RepNbr1-HEADING AFTER       IN1R2

005300                 ADVANCING 2 LINES                                IN1R2

005310         END-IF                                                   IN1R2

005320         Move 0 TO RepNbr1-LineCount                              IN1R2

005330         Add 1 TO RepNbr1-PageNbr                                 IN1R2

005340         MOVE RepNbr1-PageNbr TO PageNbr OF JZ-RepNbr1-HEADING    IN1R2

005350         Write JZ-RepNbr1 FROM JZ-RepNbr1-HEADING AFTER ADVANCING IN1R2

005360             PAGE                                                 IN1R2


005380         WRITE JZ-RepNbr1 FROM JZ-RepNbr1-SAVE AFTER ADVANCING 2  IN1R2

005390             LINES                                                IN1R2

005400     ELSE                                                         IN1R2

005410         WRITE JZ-RepNbr1 AFTER ADVANCING RepNbr1-SPACE LINES     IN1R2

005420     END-IF.                                                      IN1R2

005430     ADD RepNbr1-SPACE TO RepNbr1-LineCount.                      IN1R2

005440     MOVE 1 TO RepNbr1-SPACE.                                     IN1R2


005460**                                                              **IN1R2

005470**                        Sundry Routines                       **IN1R2

005480**                                                              **IN1R2


005500*                                                                 IN1R2

005510*    Format Date for reports                                      IN1R2

005520 JZDT01.                                                          IN1R2

005530*    Move Corresponding JZ-DATETIME-2 TO JZ-ReportTS              IN1R2

005540     MOVE JZ-DAY OF JZ-DateTIME-2 TO JZ-DAY OF JZ-ReportTS.       IN1R2

005550     MOVE JZ-YEAR OF JZ-DateTIME-2 TO JZ-YEAR OF JZ-ReportTS.     IN1R2

005560     MOVE JZ-HOUR OF JZ-DateTIME-2 TO JZ-HOUR OF JZ-ReportTS.     IN1R2



005590*    Format Month                                                 IN1R2

005600     MOVE JZ-MONTH TO SMth OF JZSMth.                             IN1R2

005610     MOVE SMth OF JZSMth TO SEARCH-FOR OF JZCodes-JZSMth-SMth.    IN1R2

005620     PERFORM JZCvt-JZSMth-SMth.                                   IN1R2


005640*                                                                 IN1R2

005650 FR-Initialize-20.                                                IN1R2

005660     PERFORM FR-Initialize.                                       IN1R2

005670     MOVE Region OF JZ-IN1 TO Region OF JZ-FR.                    IN1R2

005680*                                                                 IN1R2

005690 FR-Initialize.                                                   IN1R2

005700*    Initialize non-key fields                                    IN1R2

005710     Move 'No Record found' TO JZ-Name OF JZ-FR.                  IN1R2

005720*                                                                 IN1R2

005730 RepNbr1-L1-SUBTOTAL.                                             IN1R2

005740*    Print Subtotals, then Roll up to next level                  IN1R2

005750     MOVE SPACE TO RepNbr1-L1-T.                                  IN1R2

005760     MOVE SalesYTD OF Sums(SUB OF Break) TO SalesYTD OF           IN1R2

005770         RepNbr1-L1-T.                                            IN1R2

005780     ADD SalesYTD OF Sums(SUB OF Break) TO SalesYTD OF Sums(SUB OFIN1R2

005790          Break + 1).                                             IN1R2

005800     MOVE 0 TO SalesYTD OF Sums(SUB OF Break).                    IN1R2

005810     IF SUB OF Break <= 1                                         IN1R2

005820         MOVE Region OF Break TO Region OF RepNbr1-L1-T           IN1R2

005830     END-IF.                                                      IN1R2

005840     IF SUB OF Break <= 1                                         IN1R2

005850         MOVE District OF Break TO District OF RepNbr1-L1-T       IN1R2

005860     END-IF.                                                      IN1R2

005870     Move Descriptions OF RepNbr1-CBD (SUB OF Break) TO           IN1R2

005880         Description OF RepNbr1-L1-T.                             IN1R2

005890     Move RepNbr1-L1-T TO JZ-RepNbr1.                             IN1R2

005900     PERFORM RepNbr1-Print.                                       IN1R2

005910*                                                                 IN1R2

005920 RepNbr1-CBreak.                                                  IN1R2

005930*    1.   Set LEVEL OF Break                                      IN1R2

005940     Add 1 TO Rec-Count OF Break.                                 IN1R2

005950     IF Rec-Count OF Break = 1                                    IN1R2

005960*        1st Record, just set control fields. Level already 0     IN1R2

005970         MOVE Region OF JZ-IN1 TO Region OF Break                 IN1R2

005980         MOVE JZ-Name OF JZ-FR TO JZ-Name OF Break                IN1R2

005990         MOVE District OF JZ-IN1 TO District OF Break             IN1R2

006000     ELSE                                                         IN1R2

006010         IF Region OF JZ-IN1 IS NOT = Region OF Break             IN1R2

006020             MOVE 2 TO Level OF Break                             IN1R2

006030         ELSE                                                     IN1R2

006040             IF District OF JZ-IN1 IS NOT = District OF Break     IN1R2

006050                 MOVE 1 TO Level OF Break                         IN1R2

006060             ELSE                                                 IN1R2

006070                 MOVE 0 TO Level OF Break                         IN1R2

006080             END-IF                                               IN1R2

006090         END-IF                                                   IN1R2

006100     END-IF.                                                      IN1R2

006110*    2.  IF level of control break > 0, Print and roll up         IN1R2

006120*                                       subtotals to current levelIN1R2

006130     IF Level OF Break > 0                                        IN1R2

006140         PERFORM RepNbr1-L1-SUBTOTAL VARYING Sub OF Break FROM 1  IN1R2

006150             BY 1 UNTIL Sub OF Break > Level OF Break             IN1R2

006160         Move 2 TO RepNbr1-SPACE                                  IN1R2

006170     END-IF.                                                      IN1R2

006180*    3.   Reset for new control break                             IN1R2

006190     IF Level OF Break >= 2                                       IN1R2

006200     END-IF.                                                      IN1R2

006210     IF Level OF Break >= 1                                       IN1R2

006220         MOVE Region OF JZ-IN1 TO Region OF Break                 IN1R2

006230         MOVE JZ-Name OF JZ-FR TO JZ-Name OF Break                IN1R2

006240         MOVE District OF JZ-IN1 TO District OF Break             IN1R2

006250     END-IF.                                                      IN1R2

A Report-Designer Program

Here is an example of a program produced by the report designer.  Note the different style:

1.    Both the PROGRAM and PROCESS statements use the REPORT option.

2.    Logic is not written within the PROCESS/END Process section.  Instead all the logic is implied by REPORT, causing the generated COBOL to invoke routines at the start and end of every page, of every control break, and when an input record is processed.  A series of routines are generated for each of these situations.

3.    Instead of PRINT, the program uses PLINE, defining explicitly where every constant and field is to be placed on the report.

This makes the program look much more complicated than a report program using PRINT, but remember that although you can edit the PLINE statements as easily as PRINT or any other statement, you’re not expected to.  Instead you’d click [Report] to see the report editor view, and edit the layout by drag and drop as shown in the video. You simply switch between Jazz Workbench and Report Editor views on the click of a button.

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


This is the report-editor view of this program, and this is the report that it produces.  Here is the COBOL that MANASYS produces.