|  
|
|  
|  
|
|  
|
|  
|
|  
|
|  
|
|  
|
|  
|
  |
|
  |
|
  |
|
|
Spectrum Writer Overview of Features
Chapter 2. Report Writing Examples
 
Chapter Table of Contents
How to Produce a Report in 5 Minutes
How Spectrum Writer Works
Another Report Example
Using Multiple Input Files
A DB2 Example
To produce a new report without Spectrum Writer, a programmer has to write a
new program. Even for a relatively simple report, the cycle of coding, testing
and debugging can take days or even weeks. With Spectrum Writer, you no
longer write detailed programming instructions to produce a new report. Just
describe the desired report to Spectrum Writer with a few simple control
statements (much like SQL lets you do with DB2 data.) Spectrum Writer quickly
does all the hard work for you. (It handles the I/O routines, error exits, selection
tests, detail line formatting, date routines, heading routines, totalling, statistics,
sorts, control breaks, etc.) With Spectrum Writer your new report is ready right
away.
How to Produce a Report in 5 Minutes
When you use Spectrum Writer to produce a report, you specify what you want,
not how to produce it. That means you can produce new reports in just minutes,
rather than days.
You will tell Spectrum Writer about the desired report with a few simple "control
statements". Each statement tells Spectrum Writer about one aspect of the report
that you want to produce. You can produce a complete report with only two
statements: the INPUT statement and the COLUMNS statement.
The INPUT statement tells Spectrum Writer which of your company's files contains
the data needed in your report. For example:
INPUT: SALES-FILE
The above statement tells Spectrum Writer that you want to use a file named
SALES-FILE as the input for your report.
After identifying the file to be used, the next step is to tell Spectrum Writer which
fields from that file should appear in the report. Use the COLUMNS statement to do
that. Each field named in this statement will appear as one column of data in the
report. For example:
INPUT: SALES-FILE
COLUMNS: EMPL-NAME EMPL-NUM SALES-DATE CUSTOMER REGION AMOUNT TAX
The COLUMNS statement above tells Spectrum Writer that we want columns in our
report showing the employee name, employee number, the sales date, the
customer's name, the sales region, the amount of the sale, and the tax amount.
With just these two statements, we have given Spectrum Writer everything it
needs to produce a report. The report produced is shown in
How Spectrum Writer Works
Spectrum Writer runs as a batch job under MVS or VSE. To produce a report,
just type your control statements into a dataset. Then submit a simple batch job
for execution. Spectrum Writer reads the control statements describing your
report. It also automatically reads the appropriate statements that define your
input file. (This can be a COBOL or Assembler record layout, or Spectrum
Writer's own file definition statements.) Spectrum Writer then quickly produces
the desired report.
Another Report Example
In this example, we will add a few more control statements to illustrate additional
Spectrum Writer features.
First, let's add a COMPUTE statement. COMPUTE statements let you compute your own
new fields.
COMPUTE: TOTAL-DUE = AMOUNT + TAX
The above statement creates a new field named TOTAL-DUE. Its value is the sum of
the AMOUNT and the TAX fields.
The COMPUTE statement is a very powerful feature of Spectrum Writer. Computed
fields can be used in any way that other fields can be used: as data in the body of
the report; in report titles; as sort fields; as control break fields; within conditional
expressions; even as operands in other COMPUTE statements.
Let's also add a SORT statement to this example. The SORT statement tells Spectrum
Writer what order your want the report lines to appear in.
SORT: REGION
The above statement specifies that the report should be sorted on the REGION field.
You can also use the SORT statement to print subtotals in your report. For
example:
SORT: REGION(TOTAL)
The above statement sorts the report by region and prints subtotals whenever the
value of the REGION field changes.
Using Multiple Input Files
So far our reports have used data from a single input file -- the one named in the
INPUT statement. Now let's look at an example of using data from multiple files in
a report. One of Spectrum Writer's most powerful features is its ability to easily
read records from any number of additional files when producing a report.
Consider the first report example shown on page 9. That report uses only the
SALES-FILE as input. It shows information about each sale made by an employee.
Now let's modify that report to also show each employee's department number
and social security number. Our sample SALES-FILE does not contain that
information. But our imaginary shop has another file the employee file --
which does contain such information about each employee. That file, named
EMPL-FILE, is a keyed VSAM file containing one record for each employee. The
key to that file is the employee number. Since our SALES-FILE also contains the
employee number, we have a way to link these two files. To use data from the
EMPL-FILE, then, we simply add a READ statement, like this:
READ: EMPL-FILE READKEY(EMPL-NUM)
The READ statement above tells Spectrum Writer to use the EMPL-NUM field from the
records in the SALES-FILE as the key for reading records from the EMPL-FILE. Just
by adding one READ statement we now have all of the fields from the EMPL-FILE
available for use in our report. So, we can now add the DEPT-NUM and SOCIAL-SEC-NUM fields (from the EMPL-FILE) to the COLUMNS statement for our new report:
INPUT: SALES-FILE
READ: EMPL-FILE READKEY(EMPL-NUM)
COLUMNS: DEPT-NUM EMPL-NAME SOCIAL-SEC-NUM SALES-DATE CUSTOMER AMOUNT TAX
A DB2 Example
Spectrum Writer's DB2 Option lets you use DB2 data with Spectrum Writer exactly like you use other mainframe data. That means you can:
- produce attractive custom reports from DB2 tables in just minutes.
- turn DB2 data into PC files designed especially for PC spreadsheet, database and graphics programs.
- turn DB2 data into any custom file format you need for use on minis, Unix machines, database servers, other mainframe applications, etc.
- use DB2 data to create Web reports.
Spectrum Writer's DB2 Option has these features:
- no data dictionary is required when using DB2 data. You just use the standard DB2 names for your DB2 tables, views, and columns. This means you can start using Spectrum Writer with all of your DB2 tables right away.
- you can combine data from multiple DB2 tables to create your report or output file.
- you can also mix DB2 data with data from non–DB2 files. For example, you might have a tape file as the primary input to a Spectrum Writer job. Using data from that file, you could read additional data from VSAM files and/or DB2 tables. Or, you could use a DB2 table as your primary input and use data from it to read from additional DB2 tables or VSAM files. The possibilities are endless.
It's easy to use DB2 data with Spectrum Writer. You use the same control statements that you already know.
Proceed to Chapter 3. Creating ASCII Files
Return to Booklet Table of Contents
|