BASIC  REPORTING
INTRODUCTION
 Sample  Report request
Rules for report generation
END
RUN
QUIT
SOME   COMMON  VERBS
LIST
SORTING
 ACROSS
 NO-DATA  OPTION.
OFFLINE
  GROUPING VERBS
SUM
COUNT
Additional options
 
 
INTRODUCTION
   This  chapter deals with  the  basics of  report  preparation .  An exhaustive
     mention of this is dealt with  in the subsequent chapter.

 Report  request  requirements :-
    1)  The  MFD and the data file must be set up .
    2)  A knowledge of the fields in the MFD is  needed as also the  format ( usage & actual )
          of the fields , for complex reports ,the  format of the data structure  structure must also be
          known.
    3)  The file and the MFD must be accessible i.e. , one must have proper
           access rights as would the report request stipulate.

A sample  report request  is  shown  below

TABLE FILE MAST
PRINT AREA SALES1 DATE1 DATE2
END

The  output of the  focexec  is   shown below.
 

AREA        SALES1  DATE1     DATE2
-------        --------   --------     ---------
HUSTON   111111  98/02/23   00/11/01
CALCUT    888888  98/02/27   00/02/23
BOMBAY  888888   98/03/01  00/02/23
CALCUT   888888   98/03/02   00/02/23
TEXAS      888888   98/03/03   00/02/23
CALCUT   888888   00/02/28   00/02/23
MADRAS  888888   00/02/29   00/02/23
CALCUT   888888   01/03/01   00/02/23

 Rules for report generation
1. Up to  95 fields can be printed.
2. Fields can be identified by their  Field name , Alias , or Unique truncation
 Unique Truncation :-- A  field like sales can be  referred to in the report request as sal as long as
   any other field does not have  the same set of first three letters  such as  salary.
3.     Fields are printed in the order in which they are requested.

 A  few other PRINT options.
  To print all the fields in the file use the PRINT * option.
  To print all the fields in a segment , use the  PRINT  SEG.date1
  ie,  the SEG. followed by any field in that segment.

END
  It terminates a report request.
  It processes the report.
  Returns the user to the Focus command level.
 
RUN

  It terminates a report request.
  It processes the report.
  It maintains  the query environment.
   User will see the T>
   The file need not be TABLEd again.

QUIT
  It terminates a report request.
  The request is not processed.
  Returns user to the Focus command level.
 
  SOME   COMMON  VERBS
LIST
  Creates a line numbered report.
   Prints values for up to 95 fields.
   Uses the field name, alias , or unique truncation.
 E.g. .  Table file <file name>
  List field1 field2 field3
  End
 

 LIST        Field1       field2
 1             value          value
 2             value          value
 etc...

SORTING
  Two  verbs are used for it, BY and   ACROSS .
  E.g..   Table file  mast
   Print sales1 sales2
   By date1
   End
 The output   is as
  DATE1        SALES1      SALES2
---------        --------       -----------
  97/01/01         1111111     2222222
  97/12/20         243689       6230894
  98/01/02         3248784      872349
 
   In a table request there can be up to 32 BY ‘S.
  A report is sorted in Ascending order . A  to  Z , then 0  to 9.
  Sort fields are  printed first.
  Duplicate sort fields  values are suppressed.
   E.g..   Table file  mast
   Print sales1 sales2
   By date1
   By date2
   End
 The output  is as
  DATE1     DATE2       SALES1      SALES2
---------     --------       ---------       ----------
  97/01/01      97/02/02    1111111     2222222
  97/12/20      98/02/03    243689       6230894
  98/01/02      99/02/21   3248784      872349

 The sort fields, if are not needed to be displayed in the report request can be suppressed with the
   noprint  option such as :
            By date1 noprint
This results in the report being sorted on date1 but  date1 is not displayed.
 If another name instead of the Field name is desired in the report , it can be specified as
             By date1 as ‘Start Date’
 If the sort order is to be changed to  be sorted in an Descending  order ,then
 BY  HIGHEST DATE1.

SORTING   IN  GROUPS  OF OCCURRENCES.
 BY  <sortfield>  in-groups-of  <quantity>
E.g..
 TABLE  FILE  EMPLOYEE
 COUNT  EID  BY  SALARY IN-GROUPS-OF  10
 END

 SALARY                EMPLOYEE-ID
 ---------                 -----------------
 0.00                             0
 5,000                         10
 15,000                      250
 25,000                          8
 50,000                          2

 ACROSS
   This too sorts , however the report is   Across the page , sorted on the
 Field in the across, such as
 Table File xxxx
 Print sales1  sales2
 Across Area
 End
 results in a report as

 AREA
 AREA1      AREA2  AREA3  AREA4
--------       --------   --------  --------
 1253          1245          6867  3547
 6487          7878          9874  3476

 Similar  to  By,  here too
  ACROSS [ HIGHEST ] sortfield [IN-GROUPS-OF ]
 is  applicable.

NO-DATA  OPTION.
  SET NODATA = [value]
  value is from 1 - 11  characters.
  This must precede the Table request.
  If set then for values viz Read from the database in case contains blanks, is reported as
  as the value viz set.
 ROW AND  COLMN TOTALS.

 Provides for  row and column total  in a report  request.

   OFFLINE.
  This is an  directive statement. It indicates to the  Focus that the report is to sent to the
  printer. If set to ONLINE, it is sent to the terminal for display.
   GROUPING VERBS
SUM
 Sum field1 [ field2, field3,   .... ]
 

 Sums the value of each field for each sort value.
 Numeric fields are added and alpha fields are overlaid.
 If there are no sort fields then the grand total is printed.
 E.g..
  TABLE  FILE EMPLOYEE                 TABLE FILE EMPLOYEE
  SUM DED_AMT BY EID                       SUM   DED_AMT
  END                                                          END
 
 EMP_ID        DED_AMT                              DED_AMT
 ---------         -----------                                ------------
 1234              1,600                                            51,800
 2345              8,000
 4671              2,500
 8723              1,637
 

COUNT
 COUNT  field1  [field2, field3,.... ]
   Counts for  occurrences  of data.
  If there a  BY  phrase , it counts  it counts the number of  field values  within  a  sort  value.
  If  there is  no BY phrase, then it counts the number of times the field occurs within the    entire  file.
  COUNT appears  in the column heading below the field name.

TABLE FILE  EMPLOYEE
COUNT CURR_SAL  BY  DEPT.
END

DEPARTMENT                  CURRENT_SAL
                                              COUNT
 ---------------                    -------------------
SOFTWARE                              980
HARDWARE                             100

Additional options
Functions             Meaning                                           Example

 MAX           MAXIMUM FIELD VALUE                  MAX.SAL
 MIN           MINIMUM  FIELD  VALUE                   MIN.SAL
 AVE           AVERAGE OF FIELD VALUES             AVE.SAL
 PCT            PERCENT OF COLUMN TOTAL          PCT.SAL
 RPCT         PERCENT OF ROW TOTAL                  RPCT.GROSS
 FST            FIRST RETRIVED VALUE                     RPCT.SAL
 LST            LAST RETRIEVED VALUE.                      LST.SAL
 CNT           COUNT OF  FIELDS RETRIEVED.          CNT.EID
 SUM           SUM OF FIELDS RETRIEVED                  SUM.SAL

Click here to learn more FOCUS verbs and their usage