Question:
How do I write a CA Earl report?
Resolution:
CA-Earl Service is a powerful report writing tool, capable of producing complex reports. In fact, many of Computer Associates' products distribute tailored CA-Earl Service 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 a CA-Earl Service 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 Service has many control statements and syntax options available for use, only the following 5 statements are required in every report:
FILE - Identifies the file exit or module 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 CA-Earl Service request, and must be the last statement of the request.
Using only these 5 statements and the standard CA-Earl Service EARLGET user module (which is provided on the CA Common Services tape and contains AIRPORTS file data), we can write the basic CA-Earl Service report request shown below. The rules for coding CA-Earl Service source statements are simple. CA-Earl Service 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 a CA-Earl Service 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 Service 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 ==============================================================
NOTE This is the FILE DEFINITIONS section - the file and fields
NOTE to be used are identified here
NOTE ==============================================================
AIRPORTS: FILE EARLGET RECORD=48
DEF A_NAME 1-18 X 'NAME OF' 'AIRPORT'
DEF A_CITY 20-35 X 'CITY'
DEF A_COUNTRY 37-39 X 'COUNTRY' 'ABBREVIATION'
DEF A_PASS 41-48 N 'NUMBER OF' 'PASSENGERS'
PIC 'ZZ,ZZZ,ZZ9'
NOTE ==============================================================
NOTE This is the REPORT SECTION - one or more reports may be
NOTE defined here
NOTE ==============================================================
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 Service report request.
Additional Information:
For more information about writing CA-Earl Service requests, refer to the publications, Advantage CA-Earl User Guide and Advantage CA-Earl Reference Guide.