Read my Post-1, Post-2, Post-3, Post-4 on Easytrieve.
Report headings can be supplied in the field definition of a data item.
When NOT coded with the data item, the actual field name is used as a heading.
The heading can be specified by simply using the HEADING parameter of the field definition. The HEADING parameter has several important features . . . . .
* The HEADING is a literal
* You can print multiple words on the same line by placing a space between the words.
* By enclosing MULTIPLE literals within single quotes, you can stack and center the headings above the appropriate column
* You can code up to ninety-nine (99) literals for each heading
EXAMPLES OF HEADING PARAMETERS
SOC-SEC-NUM 4 5 –
MASK ‘999-99-9999’ –
HEADING (‘SOCIAL’ ‘SEC NUM’)
Now, in addition to having a mask for printing, there is an alternate column heading. The headings as coded in the above example will print as shown here . . . . .
DEDUCTIONS W 4 P 2 –
MASK (G BWZ) –
HEADING (‘PAYROLL DEDUCTIONS’)
Here you have the working storage field DEDUCTIONS. The column heading for PAYROLL DEDUCTIONS will print as shown below . . . . . .
Just as in COBOL, EZT+ Working Storage gives you a method for setting aside a temporary area of storage to define data items used in processing logic that is independent of FILE definitions.
EZT+ has two types of work fields:
* W fields – W fields are used mainly for additional report fields. They can also be SEQUENCE fields.
* S fields – S fields are static fields used mainly for totaling and percentages. They are not part of any VFM record.
Static fields (S-fields) are used to store accumulated values that are printed at the end of a report or at a control break. Static fields do NOT go to the work file.
Non-static fields (W-fields) are output to the work file for every record in the input file. Such a field used in accumulating totals will appear on the work-file. If the work file is re-sequenced, the accumulated values will be unpredictable.
HOW TO CODE WORKING STORAGE
* Define working storage by specifying W or S as the start location:
WORK-NAME W 25 A HEADING (‘EMPL’ ‘NAME’)
WORK-DEDUCT W 4 P 2 MASK ‘$$,$$9.99 CR’ +
TOTAL-READS S 2 P 0 +
MASK ‘ZZ9’ +
HEADING (‘TOTAL RECDS’ ‘READ’)
* The VALUE option initializes the contents of a working storage field. Zeroes (for numeric fields) or blanks (for alphabetic fields) are the defaults if no VALUE is specified.
- The data can be any valid literal whose type matches that of the field being initialized.
CURR-MON W 10 A VALUE ‘JANUARY’
* The RESET option when added to a Working Storage data item returns the W- field to its original value whenever a record is retrieved in a JOB/SORT activity.
NOTE: EZT+ sets Working-Storage data-items to the appropriate values at the beginning of execution.
NUMERICS – – – – – – – – – > set to ZEROES
ALPHA NUMERICS – – – > set to SPACES
Originally EZT would re-initialize Working-Storage data-items to their original value when a new record was retrieved. This is no longer the case. Now you have two (2) options available to you . . . . . .
- * reinitialize in your program logic
* use the RESET option when defining a Working-Storage data item
* The COPY statement duplicates the field definitions of a named file.
* Unlimited number of COPY statements can be used with a file.
* The syntax is:
* Because the same field-name can be used in more than one file, you must qualify duplicate field names by adding the file-name in parentheses – such as FLD-ONE (INTWO).
FLD-ONE * 1 A
FLD-TWO * 3 N
JOB INPUT INTWO NAME COPY-EXAMPLE
IF FLD-ONE (INTWO) …….
The Job Activity begins with the JOB STATEMENT. The JOB STATEMENT defines the primary input file and also activates AUTOMATIC FILE PROCESSING.
/ / SYSIN DD *
JOB INPUT file-name NAME job-name
- * INPUT : reserved word defining the primary input file
* file-name : primary input file
* NAME job-name : optional DOCUMENTATION information
DEACTIVATING AUTOMATIC FILE INPUT
JOB INPUT NULL NAME job-name
- * NULL: deactivates AUTOMATIC FILE PROCESSING, requires the EZT+ programmer to code I/O command that is needed for record retrieval
* EOF: because there is NO AUTOMATIC FILE PROCESSING, the EZT+ programmer MUST account for EOF. To check for an EOF condition, you should code the following . . . . . . .
IF (NOT) EOF file-name
START AND FINISH PROCS
/ / SYSIN DD *
data-names on file-name
JOB INPUT file-name +
START proc-name1 +
FINISH proc-name2 +
The optional START parameter identifies a procedure to be executed during the initiation of the JOB.
EZT+ performs the procedure coded in proc-name-1 before it retrieves the first automatic input record. A typical START procedure sets working storage fields to an initial value or positions an indexed or keyed sequentially processed file to a specific record. You cannot reference fields in automatic input files since no records have been retrieved at this stage of processing.
The optional FINISH parameter identifies a procedure to be executed during the normal termination of the JOB. After EZT+ processes the last automatic input record, it performs the proc-name-2 procedure. A typical FINISH procedure displays control information accumulated during the activity.
See USER PROCEDURE section for more information on the syntax of user procs.
You must be logged in to post a comment.