Writing Advantage CA-Earl Report Requests: 2 - Beyond The Basics

Document ID : KB000056258
Last Modified Date : 14/02/2018
Show Technical Document Details

By: Connie Thompson, Level 1 Support

In our previous E-News article,"Writing Advantage CA-Earl Report Requests: The Basics", we discussed the 3 required sections in an Advantage CA-Earl report request (the File Definitions Section, the Report Section and the End statement). In this article, we'll discuss the other 3 sections, which are optional (the Options Section, the GSA Definitions Section and the Presort Section).

The Options Section

The Options Section permits you to override the default CA-Earl options set at installation time for a single processing run. Some of the more frequently used options are:

OPTION COMPILE - Permits you to do syntax checking of your program source without actually executing it.

OPTION LIST ON|OFF - Controls the printing of the compile listing. The default is ON.

OPTION OMIT DETAIL|TOTAL|ALL BLANK|ZERO LINES - Compresses printed reports by omitting all detail and/or total lines that are entirely blank or zero. Page and column headings are not affected.

OPTION PRINTER=nnn - Specifies the width of the print line. The default is 132.

OPTION SAVE - Saves the code generated by the compile in a load library for later execution.

A complete list of the OPTION parameters can be found in the CA-Earl Reference Guide, Section 2.14.

The GSA Definitions Section

CA-Earl's GSA (General Storage Area) is comparable to COBOL working-storage. These fields are not part of the input data, but are to be included on the printed report or used internally for processing. To store data in GSA, you must

1.    Define an area of storage by assigning it a unique name.
2.    Specify the type and size of the data to be stored there.
3.    Assign an initial value to the field.

Each GSA field can be defined explicity (via a DEFINE statement), or implicitly (by specifying the variable name as the receiving field on a SET statement).

The Presort Section

Presort processing specifies operations to be carried out before the data is copied to the hitfile and sorted. Presort processing can include computations, file handling, database access, table lookup and selective processing and branching. Selective processing and branching will be discussed in a future article.

NOTE =======================================================
NOTE This is the OPTIONS section - used to override the default
NOTE options specified at install time…
NOTE =======================================================
OPTION LIST ON
OPTION OMIT ALL BLANK LINES
OPTION PRINTER=133
NOTE =======================================================
NOTE This is the File Definitions section - the file and
NOTE fields to be used are identified here…
NOTE =======================================================
AIRPORTS: FILE DISK RECORD=80
DEF A_NAME 1-18 X 'NAME OF' 'AIRPORT'
DEF A_CITY 20-35 X 'CITY'
DEF A_COUNTRY 40-43 X 'COUNTRY' 'ABBREVIATION'
DEF A_PASS 50-57 N 'NUMBER OF' 'PASSENGERS'
PIC 'ZZ,ZZZ,ZZ9'
NOTE =======================================================
NOTE This is the GSA section - comparable to COBOL working-storage.
NOTE =======================================================
DEF MILLIONS_PASS (N 4.2) = NONE 'PASSENGERS' '(IN MILLIONS)'
PIC '9,999.99'
NOTE =======================================================
NOTE This is the PRESORT section - where you can specify operations
NOTE to be carried out before the data is copied to the hit file and
NOTE sorted.
NOTE =======================================================
SET MILLIONS_PASS = A_PASS / 1000000
NOTE =======================================================
NOTE This is the Report section - one or more reports
NOTE may be defined here…
NOTE =======================================================
REPORT 'WORLD''S BUSIEST AIRPORTS'
CONTROL MILLIONS_PASS DOWN
PRINT A_NAME A_CITY MILLIONS_PASS
! ==========================================================
! This is the required END statement
! ==========================================================
END ! This is the last statement of the request

For more information about writing Advantage CA-Earl requests, refer to the publications, CA-Earl User Guide and CA-Earl Reference Guide.