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 This is the OPTIONS section - used to override the default
NOTE options specified at install time…
OPTION LIST ON
OPTION OMIT ALL BLANK LINES
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 GSA section - comparable to COBOL working-storage.
DEF MILLIONS_PASS (N 4.2) = NONE 'PASSENGERS' '(IN MILLIONS)'
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
SET MILLIONS_PASS = A_PASS / 1000000
NOTE This is the Report section - one or more reports
NOTE may be defined here…
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.