CA-Earl is a powerful report writing tool, capable of producing complex reports. In fact, many of CA Technologies products distribute tailored CA-Earl report request samples. But, no matter how complex a report request is, it still only contains at most 6 sections. In fact, only 3 sections are required in an Advantage CA-Earl report request: the File Definitions Section, the Report Section and the End statement. These are the sections we will be looking at in this article. The other 3 sections, which are optional, are the Options Section, the GSA Area Definitions Section and the Presort Section.
While CA-Earl has many control statements and syntax options available for use, only the following 5 statements are required in every report:
|FILE (or DB)||Identifies the data file (or database) to be accessed by the request.|
|DEFINE||Assigns a name to a field or variable to be used in the request.|
|REPORT ||Identifies each report within a request, and optionally specifies the report headers and footers.|
|PRINT ||Specifies the fields to be included on each line of the report and the|
order in which the fields will appear on each line of the report. Optionally,
may specify accumulations to be performed, whether the report is to be
a Detail or a Summary report, and a global spacing value to be used for
the entire report.
|END||Identifies the end of the Advantage CA-Earl request, and must be the last statement of the request.|
Using only these 5 statements and the standard CA-Earl AIRPORTS sample file, we can write the basic CA-Earl report request shown below. The rules for coding CA-Earl source statements are simple. CA-Earl source statements are free-form, and normally only columns 1 through 72 are used. A command may begin in any column, and a single source line may contain multiple commands. A single source statement may be coded on multiple source lines, but command words, field names, numeric constants and alphanumeric literals cannot spill from one line to the next. Comments are optional and may be added anywhere in an CA-Earl request. The entire line will be treated as a comment if the first word in the line is NOTE or an exclamation point (!). A comment may be added to another CA-Earl statement by following the command with the word NOTE or an exclamation point (!). Comments are never continued; the end of the source line is the end of the comment statement.
NOTE This is the File Definitions section - the file and
NOTE fields to be used are identified here?
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'
NOTE This is the Report section - one or more reports
NOTE may be defined here?
REPORT 'World''s 50 Busiest Airports, 1998' ! report title
PRINT A_NAME A_CITY A_COUNTRY A_PASS ! print line contents
! This is the required END statement
END ! This is the last statement of the request
That's it! We've now created a basic CA-Earl report request.