Professional Documents
Culture Documents
Introduction to Easytrieve
Capabilities
Structure of Easytrieve program
Environment Definition
Data Definition
Processing Activities
Decision and Branching Logic
Input & Output Specification
Report Processing
Table Processing
Synchronized File Processing
INTRODUCTION
Logic Process
Provides standard programming constructions
Provides powerful calculation capabilities
Performs special tests useful in editing
Supports Move for corresponding fields
Includes special start & finish procedures
Sorts on any number of keys
CAPABILITIES
Report Output
Automatic formatting of reports & customizing options
Provides Control breaks on any number of keys
Automatically creates summary file for subtotals
Processes only fields that are required for REPORT
Allows explicit positioning of print layout for pre-printed
forms
MODES OF OPERATION
Easytrieve provides five modes of operation that facilitate
production as well as ad-hoc programming.
FILE filename
File Type => [IS/ VIRTUAL/ DLI/
VS ([ES] [CREATE [RESET]/ UPDATE]
Device Type => [CARD/PUNCH/PRINTER/DISK/TAPE]
Record Format => [F/V/U/FB/VB/VBS]
DATA / LIBRARY DEFINITION
DEFINE Statement
Fields are defined in the library using DEFINE statement. Two categories of data
can be defined :
1. File data
2. Working Storage data
Field names must be unique within a file or working storage. The keyword
DEFINE is optional within Library section
DATA / LIBRARY DEFINITION
Basic syntax of DEFINE statement is as follows :
Procs
Separate modules of program code used to
perform specific tasks
Defined at the end of each activity
Local to the activity after which they are coded
JOB STATEMENT
JOB statement identifies the files whose records are automatically provided to the
program (automatic input)
JOB [INPUT {file-name KEY(field-name)}…{NULL}]
[START start-proc-name] [FINISH finish-proc-name]
[NAME job-name]
INPUT file-name - Optional parameter identifying automatic input
- provides the name of the file used in automatic input
KEY field-name - identifies fields used in synchronized file processing
NULL - inhibits automatic input. Normally, a job is implicitly
stopped when the automatic file is exhausted. With NULL,
the program continues until a STOP statement is executed.
JOB STATEMENT
JOB statement identifies the files whose records are automatically provided to the
program (automatic input)
JOB [INPUT {file-name KEY(field-name)}…{NULL}]
[START start-proc-name] [FINISH finish-proc-name]
[NAME job-name]
START - The optional START start-proc-name parameter
identifies a procedure to be executed during the initiation of the
JOB.
FINISH - The optional FINISH finish-proc-name parameter
identifies a procedure to be executed during the normal termination
of the JOB.
NAME job-name - names the JOB activity.Used for documentation only.
JOB CONTROL FLOW
Reset working storage
Open I/O files
[PERFORM start-proc] Step 1
JOB …retrieve automatic input
IF EOF . . . Logic generated by JOB
reset working storage
closes I/O files
[PERFORM finish-proc]
wrap-up REPORTS
go to the next JOB/SORT activity
END-IF
IF …. Step 2
... Data examination and
END-IF Manipulation statements
SORT STATEMENT
SORT statement orders any file which can be processed sequentially.
| |
| Option ===> |
| V View employee |
| E Edit employee |
| D Delete employee |
| X Exit |
| |
| F1=Help F3=Exit F12=Cancel |
|------------------------------------------------------------------------------------------------------------------------------------------------|
DECISION & BRANCHING LOGIC
IF condition
statements
ELSE-IF (optional)
statements
ELSE (optional)
statements
END-IF
DO WHILE / DO UNTIL condition
statements
ENDDO
DECISION & BRANCHING LOGIC
CASE field-name
WHEN condition
statements
OTHERWISE condition
statements
END-CASE
GOTO {label/JOB}
PERFORM proc-name
EXECUTE job-name|sort-name|screen-name
STOP [EXECUTE]
INPUT / OUTPUT
SPECIFICATION
PRINT report-name
PRINT statement initiates report output by causing the named report to extract the
current values of the fields to be output and to format them according to the
specifications in the report declaratives. The next statement to be executed
after the PRINT statement is the associated REPORT statement.
GET & PUT STATEMENTS
POINT statement only locates the specified position of the record in the file. GET
statement is necessary to retrieve the data for processing.
POINT STATEMENT EXAMPLE
FILE PAYFILE VS
REC-KEY 1 3 N
JOB INPUT NULL
POINT PAYFILE GE 500
GET PAYFILE
DO WHILE (REC-KEY < 600 AND NOT EOF PAYFILE)
PRINT PAY-RPT
GET PAYFILE
ENDDO
STOP
REPORT PAY-RPT …
Above statements retrieve those records with keys between 500 and 599 inclusive
from file PAY-FILE and output them to report PAY-RPT.
READ STATEMENT
READ statement provides random access to keyed and relative-
record VSAM and ISAM files.
The above report is ordered by department number and within each department, by last-
name. The report is segmented by department, the dollar values are subtotalled for each
department. There are 5 columns spaced three characters apart across the 63-
character-wide report.
REPORT TYPES
Standard format - Default format consisting of Title area, Heading
area and Report Body.
TITLE AREA
HEADING AREA
LINESIZE
Label Format - Includes mailing labels, form-letters and other
special-purpose reports.
SIZE DOWN
LINESIZE
REPORT STATEMENT
REPORT report-name +
[SUMMARY]
Parameters + Format Determination
[SUMFILE sum-file-name] +
[LABELS ([ACROSS lit-1] + Label Parameters
[DOWN lit-2] +
[SIZE lit-3] +
[NEWPAGE]] +
[PRINTER file-name] + File Directing Parameters
[PAGESIZE lit-4] + Spacing control Parameters
[LINESIZE lit-5] +
[SPREAD] +
[NOSPREAD] +
[NOADJUST] +
[NODATE] +
[NOPAGE] +
[LIMIT lit-6] + Testing aids Parameters
[EVERY lit-7]
REPORT STATEMENT
Specifies the order in which the fields on the report should be ordered.
Inclusion of ‘D’ indicates the field is sequenced in descending order,
default is ascending order.
CONTROL STATEMENT
CONTROL [field-name FINAL] [NEWPAGE/RENUM] [NOPRINT]
Each title line is centered horizontally within the title area of the report.
Current date is printed in leftmost 8 positions unless NODATE option is specified
on the REPORT statement.
The word PAGE and page number are printed in rightmost 11 positions unless
NOPAGE option is specified on the REPORT statement.
lit-1 - Specifies the position of the title line within the title area.
field-name- Specifies that the contents of the named field will appear on the title
line.
‘lit-2’ - Specifies a character string (enclosed in quotes) for the title item.
+lit-3 / -lit-3 - Specifies the no. of characters to be added/subtracted from the
normal 3 character space between items.
COL lit-4 - Specifies the column number where the 1st character of the next title
item will be printed
HEADING STATEMENT
HEADING field-name (‘literal’...)
Multiple literals within parentheses are stacked vertically over the column when
printed.
Eg. HEADING LAST-NAME (‘EMPLOYEE’, ‘NAME’)
produces EMPLOYEE NAME
LINE STATEMENT
LINE [lit-1] {field-name, ‘lit-2’, +lit-3/-lit-3/COL lit-4/POS lit-5}
LINE statement defines the contents of the lines of the report.
lit-1 - Specifies the position of the line within the line group when there are multiple
lines.
field-name- Specifies that the contents of the named field will appear on the print
line.
‘lit-2’ - Specifies a character string (enclosed in quotes) for the line item.
+lit-3 / -lit-3 - Specifies the no. of characters to be added/subtracted from the normal
3 character space between items.
COL lit-4 - Specifies the column number where the 1st character of the next line
item will be printed
POS lit-5 - Enables to position items on lines 2 thru 99 so that they line up under
specified items on line 1. lit-5 specifies the item number on line 1 under which
the item is to be placed.
LINE STATEMENT
EXAMPLE.
LINE 1 REGION +
SSN +
NAME +
DOB
LINE 2 POS 2 PHONE +
POS 3 STREET +
POS 4 DATE-OF-HIRE
LINE 3 POS 3 CITY -2 STATE -2 ZIP
Line 2 lists phone number under Social Security number, street address under name and
date-of-hire under Date Of Birth. Line 3 lists the city, state and zip under Name and
street address
o/p : SOUTHWEST 571-40-8057 Florance Smith 11-26-72
785-4815 3250 Big street 08-03-81
Riverside CA 09265
TABLE PROCESSING
file-name - name of the file which describes the table and its
source.
WITH field-name-1 - This parameter identifies the field that contains
the search argument. Field-name-1 can be defined in Working
storage or in any file except a file with TABLE attribute.
GIVING field-name-2 - This parameter identifies the receiving field
for the results of the table search. This field can be defined in
Working storage or in any file except a file with TABLE attribute
TABLE SEARCH
OPERATION
FILE CALENDAR
DAY-OF-WEEK 12 1 A
NAME-OF-DAY 14 20 A
FILE WEEKDAY TABLE INSTREAM
ARG 1 1 A
DESC 3 9 A
1 SUNDAY
2 MONDAY
3 TUESDAY
4 WEDNESDAY
5 THURSDAY
6 FRIDAY
7 SATURDAY
ENDTABLE
JOB INPUT CALENDAR
SEARCH WEEKDAY WITH DAY-OF-WEEK GIVING NAME-OF-DAY
IF WEEKDAY
DISPLAY NAME-OF-DAY, ‘IS DAY’, DAY-OF-WEEK
ELSE
DISPLAY ‘****INVALID DAY OF WEEK = ’, DAY-OF-WEEK
END-IF
SYNCHRONIZED FILE
PROCESSING
Easytrieve simplifies combining data from more than one file.
Has the capacity to synchronize any number of files which can be processed
sequentially.
SYNCHRONIZED FILE
PROCESSING EG.
FILE PERSNL FB(150 1800)
OLD-EMP# 9 5 N
*
FILE PERSUPD
EMP# 1 5 N
RAISE-PERCENT 7 2 N
*
FILE SORTPER F 150 VIRTUAL
UPD-EMP# 9 5 N
NAME 17 8 A
PAY-GROSS 94 4 P 2
*
NEWSAL W 4 P 2
*
FILE NEWPERS FB(150 1800)
*
FILE ERRPRINT PRINTER
*
SYNCHRONIZED FILE
PROCESSING EG.
SORT PERSNL TO SORTPER USING OLD-EMP#
JOB INPUT (SORTPER KEY(UPD-EMP#) PERSUPD KEY (EMP#) )
IF MATCHED
NEWSAL = PAY-GROSS * (1 + RAISE-PERCENT /100)
PRINT NEW-RPT
PAY-GROSS = NEW-SAL
END-IF
IF SORTPER
PUT NEWPERS FROM SORTPER
ELSE
DISPLAY ERRPRINT EMP# ‘RECORD NOT MATCHED’
END-IF
REPORT NEW-RPT LINESIZE 80 NOPAGE NODATE
SEQUENCE NAME
TITLE ‘SALARY UPDATE REPORT’
LINE UPD-EMP# NAME PAY-GROSS NEWSAL RAISE-PERCENT
END
Sanjay x 4157
Kiran x 4155
Deepa x 4153